OLD | NEW |
1 #!/bin/sh | 1 #!/bin/sh |
2 # Copyright (c) 2005, Google Inc. | 2 # Copyright (c) 2005, Google Inc. |
3 # All rights reserved. | 3 # All rights reserved. |
4 # | 4 # |
5 # Redistribution and use in source and binary forms, with or without | 5 # Redistribution and use in source and binary forms, with or without |
6 # modification, are permitted provided that the following conditions are | 6 # modification, are permitted provided that the following conditions are |
7 # met: | 7 # met: |
8 # | 8 # |
9 # * Redistributions of source code must retain the above copyright | 9 # * Redistributions of source code must retain the above copyright |
10 # notice, this list of conditions and the following disclaimer. | 10 # notice, this list of conditions and the following disclaimer. |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
77 shift | 77 shift |
78 expected_regexp="$1" | 78 expected_regexp="$1" |
79 shift | 79 shift |
80 unexpected_regexp="$1" | 80 unexpected_regexp="$1" |
81 shift | 81 shift |
82 | 82 |
83 echo -n "Testing $EXE with $@ ... " | 83 echo -n "Testing $EXE with $@ ... " |
84 output="$TMPDIR/output" | 84 output="$TMPDIR/output" |
85 ALARM $timeout env "$@" $EXE > "$output" 2>&1 | 85 ALARM $timeout env "$@" $EXE > "$output" 2>&1 |
86 actual_ec=$? | 86 actual_ec=$? |
87 ec_ok=`expr "$actual_ec" : "$expected_ec$" >/dev/null || echo false` | 87 ec_ok=$(expr "$actual_ec" : "$expected_ec$" >/dev/null || echo false) |
88 matches_ok=`test -z "$expected_regexp" || \ | 88 matches_ok=$(test -z "$expected_regexp" || \ |
89 grep "$expected_regexp" "$output" >/dev/null 2>&1 || echo false` | 89 grep -q "$expected_regexp" "$output" || echo false) |
90 negmatches_ok=`test -z "$unexpected_regexp" || \ | 90 negmatches_ok=$(test -z "$unexpected_regexp" || \ |
91 ! grep "$unexpected_regexp" "$output" >/dev/null 2>&1 || echo f
alse` | 91 ! grep -q "$unexpected_regexp" "$output" || echo false) |
92 if $ec_ok && $matches_ok && $negmatches_ok; then | 92 if $ec_ok && $matches_ok && $negmatches_ok; then |
93 echo "PASS" | 93 echo "PASS" |
94 return 0 # 0: success | 94 return 0 # 0: success |
95 fi | 95 fi |
96 # If we get here, we failed. Now we just need to report why | 96 # If we get here, we failed. Now we just need to report why |
97 echo "FAIL" | 97 echo "FAIL" |
98 if [ $actual_ec -eq 255 ]; then # 255 == SIGTERM due to $ALARM | 98 if [ $actual_ec -eq 255 ]; then # 255 == SIGTERM due to $ALARM |
99 echo "Test was taking unexpectedly long time to run and so we aborted it." | 99 echo "Test was taking unexpectedly long time to run and so we aborted it." |
100 echo "Try the test case manually or raise the timeout from $timeout" | 100 echo "Try the test case manually or raise the timeout from $timeout" |
101 echo "to distinguish test slowness from a real problem." | 101 echo "to distinguish test slowness from a real problem." |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
167 Test 60 1 "" "Starting tracking the heap" \ | 167 Test 60 1 "" "Starting tracking the heap" \ |
168 HEAP_CHECKER_TEST_TEST_LEAK=1 HEAP_CHECKER_TEST_NO_THREADS=1 PERFTOOLS_VERBOSE
=-10 \ | 168 HEAP_CHECKER_TEST_TEST_LEAK=1 HEAP_CHECKER_TEST_NO_THREADS=1 PERFTOOLS_VERBOSE
=-10 \ |
169 || exit 12 | 169 || exit 12 |
170 | 170 |
171 cd / # so we're not in TMPDIR when we delete it | 171 cd / # so we're not in TMPDIR when we delete it |
172 rm -rf $TMPDIR | 172 rm -rf $TMPDIR |
173 | 173 |
174 echo "PASS" | 174 echo "PASS" |
175 | 175 |
176 exit 0 | 176 exit 0 |
OLD | NEW |