jlahoda@618
|
1 |
#!/bin/bash -x
|
jlahoda@1036
|
2 |
|
jlahoda@1036
|
3 |
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
|
jlahoda@1036
|
4 |
#
|
jlahoda@1036
|
5 |
# Copyright 2009-2017 Oracle and/or its affiliates. All rights reserved.
|
jlahoda@1036
|
6 |
#
|
jlahoda@1036
|
7 |
# Oracle and Java are registered trademarks of Oracle and/or its affiliates.
|
jlahoda@1036
|
8 |
# Other names may be trademarks of their respective owners.
|
jlahoda@1036
|
9 |
#
|
jlahoda@1036
|
10 |
# The contents of this file are subject to the terms of either the GNU
|
jlahoda@1036
|
11 |
# General Public License Version 2 only ("GPL") or the Common
|
jlahoda@1036
|
12 |
# Development and Distribution License("CDDL") (collectively, the
|
jlahoda@1036
|
13 |
# "License"). You may not use this file except in compliance with the
|
jlahoda@1036
|
14 |
# License. You can obtain a copy of the License at
|
jlahoda@1036
|
15 |
# http://www.netbeans.org/cddl-gplv2.html
|
jlahoda@1036
|
16 |
# or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
|
jlahoda@1036
|
17 |
# specific language governing permissions and limitations under the
|
jlahoda@1036
|
18 |
# License. When distributing the software, include this License Header
|
jlahoda@1036
|
19 |
# Notice in each file and include the License file at
|
jlahoda@1036
|
20 |
# nbbuild/licenses/CDDL-GPL-2-CP. Oracle designates this
|
jlahoda@1036
|
21 |
# particular file as subject to the "Classpath" exception as provided
|
jlahoda@1036
|
22 |
# by Oracle in the GPL Version 2 section of the License file that
|
jlahoda@1036
|
23 |
# accompanied this code. If applicable, add the following below the
|
jlahoda@1036
|
24 |
# License Header, with the fields enclosed by brackets [] replaced by
|
jlahoda@1036
|
25 |
# your own identifying information:
|
jlahoda@1036
|
26 |
# "Portions Copyrighted [year] [name of copyright owner]"
|
jlahoda@1036
|
27 |
#
|
jlahoda@1036
|
28 |
# Contributor(s):
|
jlahoda@1036
|
29 |
#
|
jlahoda@1036
|
30 |
# The Original Software is NetBeans. The Initial Developer of the Original
|
jlahoda@1036
|
31 |
# Software is Sun Microsystems, Inc. Portions Copyright 2009-2010 Sun
|
jlahoda@1036
|
32 |
# Microsystems, Inc. All Rights Reserved.
|
jlahoda@1036
|
33 |
#
|
jlahoda@1036
|
34 |
# If you wish your version of this file to be governed by only the CDDL
|
jlahoda@1036
|
35 |
# or only the GPL Version 2, indicate your decision by adding
|
jlahoda@1036
|
36 |
# "[Contributor] elects to include this software in this distribution
|
jlahoda@1036
|
37 |
# under the [CDDL or GPL Version 2] license." If you do not indicate a
|
jlahoda@1036
|
38 |
# single choice of license, a recipient has the option to distribute
|
jlahoda@1036
|
39 |
# your version of this file under either the CDDL, the GPL Version 2 or
|
jlahoda@1036
|
40 |
# to extend the choice of license to its licensees as provided above.
|
jlahoda@1036
|
41 |
# However, if you add GPL Version 2 code and therefore, elected the GPL
|
jlahoda@1036
|
42 |
# Version 2 license, then the option applies only if the new code is
|
jlahoda@1036
|
43 |
# made subject to such option by the copyright holder.
|
jlahoda@1036
|
44 |
|
jlahoda@618
|
45 |
do_index() {
|
jlahoda@618
|
46 |
rm -rf cache
|
jlahoda@618
|
47 |
mkdir -p cache
|
jlahoda@618
|
48 |
for g in `pwd`/data/*; do
|
jlahoda@618
|
49 |
NAME=`basename $g`;
|
jlahoda@618
|
50 |
PROJECTS=`find $PWD/data/group1/ -maxdepth 1 -mindepth 1 -type d`
|
jlahoda@618
|
51 |
USERDIR="`pwd`/cache/userdir"
|
jlahoda@618
|
52 |
rm -rf "$USERDIR"
|
jlahoda@618
|
53 |
(cd ../indexer; ant "-Drun.args=--nosplash --nogui -J-Xmx128m --category-id '$NAME' --category-name '$NAME-display-name' --cache-target ../tests/cache/temp.zip --category-root-dir '$g' --category-projects '$PROJECTS'" "-Dtest.user.dir=$USERDIR" "$@" run)
|
jlahoda@618
|
54 |
(cd cache; unzip temp.zip; rm temp.zip)
|
jlahoda@618
|
55 |
rm -rf "$USERDIR"
|
jlahoda@618
|
56 |
done
|
jlahoda@618
|
57 |
}
|
jlahoda@618
|
58 |
|
jlahoda@618
|
59 |
#XXX: copied from cmdline/test/scripted/harness
|
jlahoda@618
|
60 |
write_passed_results_file() {
|
jlahoda@618
|
61 |
cat >$RESULT_FILE <<EOF
|
jlahoda@618
|
62 |
<?xml version="1.0" encoding="UTF-8" ?>
|
jlahoda@618
|
63 |
<testsuite errors="0" failures="0" hostname="foo" name="$TEST_NAME" tests="1" time="0" timestamp="`date`">
|
jlahoda@618
|
64 |
<properties/>
|
jlahoda@618
|
65 |
<testcase classname="$TEST_NAME" name="main" time="0" />
|
jlahoda@618
|
66 |
</testsuite>
|
jlahoda@618
|
67 |
EOF
|
jlahoda@618
|
68 |
}
|
jlahoda@618
|
69 |
|
jlahoda@618
|
70 |
write_failure_results_file() {
|
jlahoda@618
|
71 |
cat >$RESULT_FILE <<EOF
|
jlahoda@618
|
72 |
<?xml version="1.0" encoding="UTF-8" ?>
|
jlahoda@618
|
73 |
<testsuite errors="0" failures="1" hostname="foo" name="$TEST_NAME" tests="1" time="0" timestamp="`date`">
|
jlahoda@618
|
74 |
<properties/>
|
jlahoda@618
|
75 |
<testcase classname="$TEST_NAME" name="main" time="0">
|
jlahoda@768
|
76 |
<failure message="Test failed" type="junit.framework.AssertionFailedError"><![CDATA[$1]]></failure>
|
jlahoda@618
|
77 |
</testcase>
|
jlahoda@618
|
78 |
</testsuite>
|
jlahoda@618
|
79 |
EOF
|
jlahoda@618
|
80 |
}
|
jlahoda@618
|
81 |
|
jlahoda@721
|
82 |
do_index "$@"
|
jlahoda@618
|
83 |
|
jlahoda@618
|
84 |
(cd ../web/web.main; ant jar)
|
jlahoda@720
|
85 |
OUT=`mktemp`;
|
jlahoda@720
|
86 |
trap "rm $OUT" EXIT
|
jlahoda@724
|
87 |
java -jar ../web/web.main/dist/web.main.jar --port 0 cache >"$OUT" &
|
jlahoda@618
|
88 |
|
jlahoda@619
|
89 |
trap "kill %1" EXIT
|
jlahoda@618
|
90 |
|
jlahoda@720
|
91 |
while [ -z "$PORT" ] ; do
|
jlahoda@720
|
92 |
sleep 1s;
|
jlahoda@720
|
93 |
PORT=`cat "$OUT" | grep "Running on port: " | cut -d ':' -f 2 | tr -d ' '`;
|
jlahoda@720
|
94 |
done
|
jlahoda@618
|
95 |
|
jlahoda@618
|
96 |
rm -rf results
|
jlahoda@618
|
97 |
mkdir results
|
jlahoda@618
|
98 |
|
jlahoda@618
|
99 |
for tc in `find testcases -name "*.tc" -type d`; do
|
jlahoda@1036
|
100 |
REQUEST=`cat $tc/request | grep -v '^#'`;
|
jlahoda@763
|
101 |
TEST_NAME=`echo ${tc#testcases/} | tr '/' '-'`;
|
jlahoda@618
|
102 |
RESULT_FILE="`pwd`/results/TEST-$TEST_NAME.xml"
|
jlahoda@720
|
103 |
if wget -O - "http://localhost:${PORT}$REQUEST" | diff -w - $tc/response; then
|
jlahoda@618
|
104 |
write_passed_results_file
|
jlahoda@618
|
105 |
else
|
jlahoda@618
|
106 |
write_failure_results_file
|
jlahoda@618
|
107 |
fi;
|
jlahoda@618
|
108 |
done
|
jlahoda@618
|
109 |
|
jlahoda@618
|
110 |
exit 0
|