4 |
4 |
5 # Set up some environment variables (if not set by CI) |
5 # Set up some environment variables (if not set by CI) |
6 if [ -z "$BUILD_NUMBER" ]; then |
6 if [ -z "$BUILD_NUMBER" ]; then |
7 BUILD_NUMBER=0 |
7 BUILD_NUMBER=0 |
8 fi |
8 fi |
9 PETITCOMPILER_DATA_DIRECTORY=test-data |
9 |
|
10 # Environment variable PETITCOMPILER_DATA_DIRECTORY |
|
11 # should point to the directory where test data are |
|
12 # stored (or where they should be downloaded and |
|
13 # unpacked. To save bandwidth and disk space, when run |
|
14 # on (CTU FIT) Jenkins, point them to the shared directory |
|
15 |
|
16 case $(uname -n) in |
|
17 swing-h-win64) |
|
18 PETITCOMPILER_DATA_DIRECTORY="E:\\workspace\\petitcompiler_test_data" |
|
19 ;; |
|
20 swing-hudson-lin64) |
|
21 PETITCOMPILER_DATA_DIRECTORY="/ws/workspace/petitcompiler_test_data" |
|
22 ;; |
|
23 *) |
|
24 PETITCOMPILER_DATA_DIRECTORY=test-data |
|
25 ;; |
|
26 esac |
10 PETITCOMPILER_BENCHMARK_REPORT=benchmark-results-$BUILD_NUMBER.json |
27 PETITCOMPILER_BENCHMARK_REPORT=benchmark-results-$BUILD_NUMBER.json |
11 |
28 |
12 function ci_download_and_unzip_file { |
29 function ci_download_and_unzip_file { |
13 local url=$1 |
30 local url=$1 |
14 local where=$PETITCOMPILER_DATA_DIRECTORY |
31 local where=$PETITCOMPILER_DATA_DIRECTORY |
15 local file=${url##*/} |
32 local file=${url##*/} |
16 local directory=${file%.zip} |
33 local directory=${file%.zip} |
17 local status=0 |
34 local status=0 |
18 |
35 |
19 if [ ! -d "$PETITCOMPILER_DATA_DIRECTORY/$directory" ]; then |
36 if [ ! -d "$where/$directory" ]; then |
20 pushd "$PETITCOMPILER_DATA_DIRECTORY" |
37 pushd "$where" |
21 wget -O "$file" "$url" |
38 wget -O "$file" "$url" |
22 set +e |
39 set +e |
23 unzip -o "$file" |
40 unzip -o "$file" |
24 status=$? |
41 status=$? |
25 set -e |
42 set -e |