forked from unicode-org/conformance
-
Notifications
You must be signed in to change notification settings - Fork 0
/
genData100.sh
147 lines (111 loc) · 3.35 KB
/
genData100.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
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
#!/bin/bash
# Generates new test data, then executes all tests on that new in the new
# directory.
# Save the results
set -e
# Rotate log files
logrotate -s logrotate.state logrotate.conf
##########
# Setup (generate) test data & expected values
##########
export NVM_DIR=$HOME/.nvm;
source $NVM_DIR/nvm.sh;
#
# Setup
#
# Ensure that ICU4C binaries have been downloaded locally
if [[ ! -d gh-cache ]]
then
bash setup.sh
fi
export TEST_LIMIT=100
export TEMP_DIR=TEMP_DATA_100
rm -rf $TEMP_DIR
# Clear out old data, then create new directory and copy test / verify data there
mkdir -p $TEMP_DIR/testData
#
# Setup (generate) test data & expected values
#
echo "PARSING run_config.json"
source_file=${1:-'run_config.json'}
# Generates all new test data
pushd testgen
all_icu_versions=$(jq '.[].run.icu_version' ../$source_file | jq -s '.' | jq 'unique' | jq -r 'join(" ")')
python3 testdata_gen.py --icu_versions $all_icu_versions --run_limit $TEST_LIMIT
# And copy results to subdirectories.
cp -r icu* ../$TEMP_DIR/testData
popd
# Verify that schema files are valid
pushd schema
python3 check_schemas.py $pwd
# And check generated data against schemas.
python3 check_generated_data.py ../$TEMP_DIR/testData
popd
##########
# Run tests using per-platform executors
##########
#
# Run test data tests through all executors
#
all_execs_json=$(jq '.[].run.exec' $source_file | jq -s '.' | jq 'unique')
if jq -e 'index("dart_native")' <<< $all_execs_json > /dev/null
then
echo "DART NATIVE COMPILE"
pushd executors/dart_native/
dart pub get
dart compile exe bin/executor.dart
popd
fi
if jq -e 'index("dart_web")' <<< $all_execs_json > /dev/null
then
echo "DART WEB COMPILE"
pushd executors/dart_web/
dart pub get
dart run bin/make_runnable_by_node.dart
popd
fi
# Executes all tests on that new data in the new directory
mkdir -p $TEMP_DIR/testOutput
echo "Created $TEMP_DIR/testOutput"
# Invoke all tests on all platforms
pushd testdriver
# Set to use NVM
source "$HOME/.nvm/nvm.sh"
echo "RUNNING FROM $source_file"
jq -c '.[]' ../$source_file | while read i; do
if jq -e 'has("prereq")' <<< $i > /dev/null
then
command=$(jq -r -c '.prereq.command' <<< $i)
eval "$command"
fi
icu_version=$(jq -r -c '.run.icu_version' <<< $i)
exec_command=$(jq -r -c '.run.exec' <<< $i)
test_type=$(jq -r -c '.run.test_type | join(" ")' <<< $i)
per_execution=$(jq -r -c '.run.per_execution' <<< $i)
ignore=$(jq -r -c '.run.ignore' <<< $i)
python3 testdriver.py --icu_version $icu_version --exec $exec_command --test_type $test_type --file_base ../$TEMP_DIR --per_execution $per_execution --ignore $ignore --run_limit $TEST_LIMIT
echo $?
done
# Done with test execution
popd
#
# Run verifier
#
# Verify that test output matches schema.
pushd schema
python3 check_test_output.py ../$TEMP_DIR/testOutput
popd
# Verify everything
mkdir -p $TEMP_DIR/testReports
pushd verifier
all_test_types=$(jq '.[].run.test_type' ../$source_file | jq -s '.' | jq 'add' | jq 'unique' | jq -r 'join(" ")')
all_execs=$(jq -r 'join(" ")' <<< $all_execs_json)
python3 verifier.py --file_base ../$TEMP_DIR --exec $all_execs --test_type $all_test_types
popd
#
# Push testresults and test reports to Cloud Storge
# TODO
echo "End-to-end script finished successfully"
# Clean up directory
# ... after results are reported
#rm -rf ../$TEMP_DIR