-
Notifications
You must be signed in to change notification settings - Fork 6
/
test-all-distributions.sh
executable file
·121 lines (102 loc) · 3.54 KB
/
test-all-distributions.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
#!/bin/bash
PRODUCT=${PRODUCT:-dm}
DATABASE=${PRODUCT:-default}
SERVER=${SERVER:-tomcat}
HERE=$(cd $(dirname $0); pwd -P)
LASTBUILD_URL=${LASTBUILD_URL:-http://qa.nuxeo.org/hudson/job/IT-nuxeo-5.5-build/lastSuccessfulBuild/artifact/trunk/release/archives}
ZIP_FILE=${ZIP_FILE:-}
SKIP_FUNKLOAD=${SKIP_FUNKLOAD:-}
# Cleaning
rm -rf ./jboss ./results ./download ./tomcat ./nuxeo-*/
mkdir ./results ./download || exit 1
cd download
if [ -z "$ZIP_FILE" ]; then
# extract link
link=`lynx --dump $LASTBUILD_URL | grep -E -o "http:.*archives\/nuxeo-.*(-sdk)*.zip(\.md5)*" | sort -u |grep $PRODUCT-[0-9]|grep $SERVER|grep -v ear`
wget -nv $link || exit 1
ZIP_FILE=$PWD/$(ls nuxeo-$PRODUCT*$SERVER.zip)
SDK_ZIP_FILE=$PWD/$(ls nuxeo-$PRODUCT*$SERVER-sdk.zip 2>/dev/null)
fi
unzip -q $ZIP_FILE || exit 1
cd ..
build=$(find ./download -maxdepth 1 -name 'nuxeo-*' -name "*$PRODUCT*" -type d)
mv $build ./$SERVER || exit 1
NXVERSION=`basename $ZIP_FILE`
NXVERSION=${NXVERSION#nuxeo-$PRODUCT-}
NXVERSION=${NXVERSION%-$SERVER.zip}
# Download sources (or copy if local)
SOURCES_ZIP_FILE=`dirname $ZIP_FILE`/nuxeo-$NXVERSION-sources.zip
cd download
if [ ! -e "$SOURCES_ZIP_FILE" ]; then
# extract link
link=`lynx --dump $LASTBUILD_URL |grep -o "http:.*archives\/.*sources.*\.zip"| sort -u`
wget -nv $link || exit 1
SOURCES_ZIP_FILE=$PWD/$(ls *sources*.zip)
fi
unzip -q $SOURCES_ZIP_FILE -d ../nuxeo-$NXVERSION || exit 1
cd ..
. $HERE/integration-lib.sh
if [ "$PRODUCT" = "cap" ]; then
SUITES="suite1,suite2,suite-cap,suite-webengine"
SKIP_FUNKLOAD=true
else
# run nuxeo-dm suites by default
SUITES="suite1,suite2,suite-dm,suite-webengine,suite-webengine-website,suite-webengine-tags"
fi
# Run Selenium tests
mvn verify -f "$NXDISTRIBUTION"/nuxeo-distribution-dm/ftest/selenium/pom.xml \
-Dzip.file=$ZIP_FILE \
-Pqa,$SERVER,$DATABASE \
-Dclassifier=nuxeo-$PRODUCT \
-Dsuites="$SUITES"
ret1=$?
ret2=0
if [ -z "$SKIP_FUNKLOAD" ]; then
java -version 2>&1 | grep 1.6.0
if [ $? == 0 ]; then
# Update selenium tests
[ "$SERVER" = jboss ] && setup_jboss 127.0.0.1
[ "$SERVER" = tomcat ] && setup_tomcat 127.0.0.1
# Use postgreSQL
if [ ! -z "$PGPASSWORD" ]; then
setup_postgresql_database
fi
# Use MySQL
if [ ! -z "$MYSQL_HOST" ]; then
setup_mysql_database
fi
# Use oracle
if [ ! -z "$ORACLE_SID" ]; then
setup_oracle_database
fi
start_server 127.0.0.1
# FunkLoad tests works only with java 1.6.0 (j_ids are changed by java6)
(cd "$NXDISTRIBUTION"/nuxeo-distribution-dm/ftest/funkload; make EXT="--no-color")
ret2=$?
stop_server
fi
fi
# Run WebDriver tests
if [ "$SERVER" = "tomcat" ] && [ -e "$NXDISTRIBUTION"/nuxeo-distribution-tomcat-tests/pom.xml ]; then
mvn verify -f "$NXDISTRIBUTION"/nuxeo-distribution-tomcat-tests/pom.xml \
-Dzip.file=$ZIP_FILE
ret3=$?
fi
# Exit if some tests failed
[ $ret1 -eq 0 -a $ret2 -eq 0 -a $ret3 -eq 0 ] || exit 9
# Upload successfully tested package and sources on $UPLOAD_URL
UPLOAD_URL=${UPLOAD_URL:-}
SRC_URL=${SRC_URL:-download}
if [ ! -z "$UPLOAD_URL" ]; then
date
scp -C $SRC_URL/*.zip* $UPLOAD_URL || exit 1
mkdir -p $HERE/download/mp
cd $HERE/download/mp
links=`lynx --dump $LASTBUILD_URL/mp | grep -E -o 'http:.*archives\/((nuxeo-.*(-sdk)*.zip(.md5)*)|packages.xml)' | sort -u`
if [ ! -z "$links" ]; then
wget -nv $links
scp -C $SRC_URL/mp/* $UPLOAD_URL/mp/ || true
fi
cd -
date
fi