Mercurial > hg-stable
comparison tests/test-run-tests.t @ 32645:931bb962e0eb
tests: fix run-tests when there's a bad #if in a test
That has (and still does) caused the test to be skipped, but without
this fix it was possible to exit this block of code without clearing
the output channel, which poisoned the channel list for later test
method runs. Fix this by always clearing the channel in a finally.
The test for this is somewhat unfortunate. Sadly, I couldn't get a way
to reproduce this with less than 2n+1 test cases, nor could I get it
to reproduce reliably without the sleep statements. It's also crucial
that the test with the broken #if be smaller (in terms of byte count)
than the sleeping tests, so that it runs first and would poison the
channel list prior to another test needing that entry from the list.
author | Augie Fackler <augie@google.com> |
---|---|
date | Tue, 30 May 2017 20:48:43 -0400 |
parents | c2b7fb580794 |
children | 1270b00a385d |
comparison
equal
deleted
inserted
replaced
32644:c59451e11cbf | 32645:931bb962e0eb |
---|---|
901 python hash seed: * (glob) | 901 python hash seed: * (glob) |
902 [1] | 902 [1] |
903 | 903 |
904 $ cd .. | 904 $ cd .. |
905 | 905 |
906 Test a broken #if statement doesn't break run-tests threading. | |
907 ============================================================== | |
908 $ mkdir broken | |
909 $ cd broken | |
910 $ cat > test-broken.t <<EOF | |
911 > true | |
912 > #if notarealhghavefeature | |
913 > $ false | |
914 > #endif | |
915 > EOF | |
916 $ for f in 1 2 3 4 ; do | |
917 > cat > test-works-$f.t <<EOF | |
918 > This is test case $f | |
919 > $ sleep 1 | |
920 > EOF | |
921 > done | |
922 $ rt -j 2 | |
923 .... | |
924 # Ran 5 tests, 0 skipped, 0 warned, 0 failed. | |
925 skipped: unknown feature: notarealhghavefeature | |
926 | |
927 $ cd .. | |
928 $ rm -rf broken | |
929 | |
906 Test cases in .t files | 930 Test cases in .t files |
907 ====================== | 931 ====================== |
908 $ mkdir cases | 932 $ mkdir cases |
909 $ cd cases | 933 $ cd cases |
910 $ cat > test-cases-abc.t <<'EOF' | 934 $ cat > test-cases-abc.t <<'EOF' |