forked from 10XGenomics/enclone
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathtest
executable file
·160 lines (133 loc) · 5.38 KB
/
test
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
148
149
150
151
152
153
154
155
156
157
158
159
160
#!/bin/csh
# Please see https://10xgenomics.github.io/enclone/pages/auto/dev.html for general information
# about testing.
#
# Run cargo t and other tests which it's not clear how to encapsulate within cargo t. This
# also does some tidying and reports time used. Note that the effect of cargo t is defined
# by .cargo/config.
#
# If you want to run this over and over to look for sporadic failures, use ./scripts/testtest.
#
# To run just one test,
# cargo t <testname>
# should work.
#
# ./test linkless ==> run without testing links, useful if a link is temporarily broken
set arg1 = $1
##### TEST UNRELIABLE LINKS #####
if !( -f stamps/last_linktest) then
echo 0 > stamps/last_linktest
endif
set last_linktest = `cat stamps/last_linktest`
set linkstart = `date +%s`
set elapsed_linktest = `expr $linkstart - $last_linktest`
if ( $elapsed_linktest > 86400 ) then
set timeout = 2
echo "\ntesting unreliable links; this test is only run once per day"
foreach link (`cat pages/unreliable_links`)
if ( $link !~ *"." ) then
set response = `curl -Is --max-time $timeout $link | head -1`
if ( "$response" !~ *" 200 "* && "$response" !~ *" 301 "* ) then
echo "$link may be broken, response was $response"
echo "If you see this fail repeatedly, link may be permanently broken."
echo "Note that timeout is $timeout seconds, so this could be a false alarm."
endif
endif
end
echo $linkstart > stamps/last_linktest
endif
#### COMPILE FOR TEST SO WE CAN SEPARATELY TRACK COMPILE TIME ####
set compile_start = `date +%s`
cargo test --features cpu test_accounting --no-run >& /dev/null
if ( $status != 0 ) then
echo "compilation failed 1"
exit 1
endif
cargo test --bin traceback1 --test enclone_test1 --test enclone_test2 --test enclone_test3 \
--test enclone_test4 --test enclone_test_peak_mem --no-run >& /dev/null
if ( $status != 0 ) then
echo "compilation failed 2"
exit 1
endif
cargo test -p enclone_tail --lib --no-run >& /dev/null
if ( $status != 0 ) then
echo "compilation failed 3"
exit 1
endif
set compile_end = `date +%s`
set compile_elapsed = `expr $compile_end - $compile_start`
##### GET START TIME #####
set start = `date +%s`
##### MAKE SURE POST_PROCESS_TEST IS IN PATH #####
if ( `where post_process_test` == "" ) then
echo "\nPlease add target/debug to your path.\n"
exit 1
endif
##### RUN UNACCOUNTED TIME TEST #####
# This is separate because we think it will fail less if it is not running at the same time
# as other tests. Also, we don't want it in GitHub Actions because it fails occasionally.
echo
cargo test --features cpu test_accounting -- --nocapture |& post_process_test
##### RUN TEST GROUP 1 #####
if ( $arg1 != linkless ) then
cargo t |& post_process_test
if ( $status != 0 ) then
echo "FAILED!"
exit 1
endif
else
cargo test --bin traceback1 --test enclone_test1 --test enclone_test2 --test enclone_test3 \
--test enclone_test4 --test enclone_test_peak_mem --features linkless \
-- --nocapture |& post_process_test
if ( $status != 0 ) then
echo "FAILED!"
exit 1
endif
endif
##### RUN TEST GROUP 2 #####
cargo test -p enclone_tail --lib -- --nocapture |& post_process_test
if ( $status != 0 ) then
echo "FAILED!"
exit 1
endif
##### TEST FOR A WEIRD PROBLEM #####
if ( -f enclone_exec/stdout ) then
echo "\nWeird, the file enclone_exec/stdout exists and it should not. One possibilty is"
echo "that the code incorrectly tested for writing stdout, and then (in principle) deleted"
echo "it, but something went wrong because parallel processes were doing the same thing."
echo "Another possibility is that stdout was specified as an argument in a test, and the"
echo "argument was not recognized as special. This error mode can be stochastic."
echo "If this failure occurs, and you can't trace its source, try creating a file"
echo "enclone_exec/stdout that lacks write permission. This should cause a traceback to"
echo "be omitted when an attempt is made to write the file.\n"
exit 1
endif
##### REPORT TIME USED #####
set end = `date +%s`
set elapsed = `expr $end - $start`
##### FAIL IF TOO MUCH TIME USED #####
echo "\ntest compile time = $compile_elapsed seconds"
set expected = 277
set fudge_num = 11
set fudge_den = 10
set expected_plus_times = `expr $expected \* $fudge_num`
set elapsed_times = `expr $elapsed \* $fudge_den`
if ( $elapsed_times > $expected_plus_times ) then
echo
echo "The expected time for the test is $expected seconds, with an allowed fudge factor of"
echo "10%, but the test actually took $elapsed seconds. If something has been done to make"
echo "the test actually slower, this is a real failure. However it may be that the failure"
echo "is due simply to server load, or bad luck, and in that case it is not a failure. In"
echo "addition, because executable generation is stochastic, it is possible that forcing"
echo "recompilation of all enclone crates will make the problem go away. Also the test time"
echo "is for a particular server, and if you are using a different machine, the time you"
echo "observe will be different."
echo
echo "FAILED"
echo
exit 1
else
echo "total noncompile test time = $elapsed seconds versus expected time of $expected seconds"
endif
##### DONE #####
echo