From: Pavel Charvat Date: Thu, 21 Jun 2007 13:13:49 +0000 (+0200) Subject: run testing utities in rundir instead of in source tree X-Git-Tag: holmes-import~506^2~68 X-Git-Url: http://mj.ucw.cz/gitweb/?a=commitdiff_plain;h=fef3014ec8e0c56fcfd29bfe2fc182aab80ce76a;p=libucw.git run testing utities in rundir instead of in source tree --- diff --git a/build/tester b/build/tester index a9bdfd60..73794d93 100755 --- a/build/tester +++ b/build/tester @@ -1,6 +1,7 @@ #!/usr/bin/perl # A simple unit testing script # (c) 2004 Martin Mares +# (c) 2007 Pavel Charvat my @tests = (); my $tt; @@ -36,8 +37,8 @@ foreach $tt (@tests) { $prev_run = $run; my ($ifi, $ofi); if (defined $tt->{'In'}) { - $ifi = "run/tmp/test$i.in"; - open X, ">$ifi" or die "Unable to create $ifi"; + $ifi = "tmp/test$i.in"; + open X, ">run/$ifi" or die "Unable to create $ifi"; print X $tt->{'In'}, "\n"; close X; $run .= " <$ifi"; @@ -45,20 +46,20 @@ foreach $tt (@tests) { $run .= " {'Out'}) { - $ofi = "run/tmp/test$i.out"; - unlink $ofi; + $ofi = "tmp/test$i.out"; + unlink "run/$ofi"; $run .= " >$ofi"; } else { $run .= " >/dev/null"; } - `$run`; + system "cd run && ( $run )"; if ($?) { print "FAILED with exit code $?\n"; $errors++; next; } if (defined $tt->{'Out'}) { - open X, "<$ofi" or die "Unable to read $ofi"; + open X, " diff --git a/lib/bitops.t b/lib/bitops.t index abf350ea..97b2b358 100644 --- a/lib/bitops.t +++ b/lib/bitops.t @@ -1,6 +1,6 @@ # Tests for bitops modules -Run: obj/lib/bit-ffs-t +Run: ../obj/lib/bit-ffs-t In: 1 2 3 @@ -26,7 +26,7 @@ Out: 0 30 31 -Run: obj/lib/bit-fls-t +Run: ../obj/lib/bit-fls-t In: 1 2 3 diff --git a/lib/getopt.t b/lib/getopt.t index 6a821cdb..79e7fe2c 100644 --- a/lib/getopt.t +++ b/lib/getopt.t @@ -1,6 +1,6 @@ # Tests for getopt -Run: obj/lib/getopt-t -a -b --longc 2819 -d -a 1 2 3 +Run: ../obj/lib/getopt-t -a -b --longc 2819 -d -a 1 2 3 Out: option a option b option c with value `2819' @@ -13,7 +13,7 @@ Out: option a option d with value `-a' 3 nonoption arguments -Run: obj/lib/getopt-t -a -x +Run: ../obj/lib/getopt-t -a -x Out: option a unknown option reset diff --git a/lib/hash-test.t b/lib/hash-test.t index 1f3692cc..ba5a61e5 100644 --- a/lib/hash-test.t +++ b/lib/hash-test.t @@ -1,13 +1,13 @@ # Tests for the hash table modules -Run: obj/lib/hash-test 1 +Run: ../obj/lib/hash-test 1 Out: OK -Run: obj/lib/hash-test 2 +Run: ../obj/lib/hash-test 2 Out: OK -Run: obj/lib/hash-test 3 +Run: ../obj/lib/hash-test 3 Out: OK -Run: obj/lib/hash-test 4 +Run: ../obj/lib/hash-test 4 Out: OK diff --git a/lib/kmp-test.t b/lib/kmp-test.t index 2a9bce3f..bfcc1271 100644 --- a/lib/kmp-test.t +++ b/lib/kmp-test.t @@ -1,3 +1,3 @@ # Tests for the kmp module -Run: obj/lib/kmp-test +Run: ../obj/lib/kmp-test diff --git a/lib/mempool.t b/lib/mempool.t index bebe922b..10c396e1 100644 --- a/lib/mempool.t +++ b/lib/mempool.t @@ -1,11 +1,11 @@ # Tests for mempool modules -Run: obj/lib/mempool-t +Run: ../obj/lib/mempool-t -Run: obj/lib/mempool-fmt-t +Run: ../obj/lib/mempool-fmt-t Out: -Run: obj/lib/mempool-str-t +Run: ../obj/lib/mempool-str-t Out: <<12345>> bugs.gnats.insects bugsgnatsinsects diff --git a/lib/regex.t b/lib/regex.t index 9b47cd99..45b92a5d 100644 --- a/lib/regex.t +++ b/lib/regex.t @@ -1,6 +1,6 @@ # Tests for the regex module -Run: obj/lib/regex-t 'a.*b.*c' +Run: ../obj/lib/regex-t 'a.*b.*c' In: abc ajkhkbbbbbc Aabc @@ -8,7 +8,7 @@ Out: MATCH MATCH NO MATCH -Run: obj/lib/regex-t -i 'a.*b.*c' +Run: ../obj/lib/regex-t -i 'a.*b.*c' In: aBc ajkhkbBBBBC Aabc @@ -16,7 +16,7 @@ Out: MATCH MATCH MATCH -Run: obj/lib/regex-t -i '(ahoj|nebo)' +Run: ../obj/lib/regex-t -i '(ahoj|nebo)' In: Ahoj nEBo ahoja @@ -26,19 +26,19 @@ Out: MATCH NO MATCH NO MATCH -Run: obj/lib/regex-t '\(ahoj\)' +Run: ../obj/lib/regex-t '\(ahoj\)' In: (ahoj) ahoj Out: MATCH NO MATCH -Run: obj/lib/regex-t '(.*b)*' +Run: ../obj/lib/regex-t '(.*b)*' In: ababababab ababababababababababababababababababababababababababababa Out: MATCH NO MATCH -Run: obj/lib/regex-t '(.*)((aabb)|cc)(b.*)' '\1<\3>\4' +Run: ../obj/lib/regex-t '(.*)((aabb)|cc)(b.*)' '\1<\3>\4' In: aaabbb aabbccb abcabc @@ -48,13 +48,13 @@ Out: ab NO MATCH aa<>bb -Run: obj/lib/regex-t '.*\?(.*&)*([a-z_]*sess[a-z_]*|random|sid|S_ID|rnd|timestamp|referer)=.*' +Run: ../obj/lib/regex-t '.*\?(.*&)*([a-z_]*sess[a-z_]*|random|sid|S_ID|rnd|timestamp|referer)=.*' In: /nemecky/ubytovani/hotel.php?sort=&cislo=26&mena=EUR&typ=Hotel&luz1=ANO&luz2=ANO&luz3=&luz4=&luz5=&maxp1=99999&maxp2=99999&maxp3=99999&maxp4=99999&maxp5=99999&apart=&rada=8,9,10,11,19,22,26,27,28,29,3&cislo=26&mena=EUR&typ=Hotel&luz1=ANO&luz2=ANO&luz3=&luz4=&luz5=&maxp1=99999&maxp2=99999&maxp3=99999&maxp4=99999&maxp5=99999&apart=&rada=8,9,10,11,19,22,26,27,28,29,3&cislo=26&mena=EUR&typ=Hotel&luz1=ANO&luz2=ANO&luz3=&luz4=&luz5=&maxp1=99999&maxp2=99999&maxp3=99999&maxp4=99999&maxp5=99999&apart=&rada=8,9,10,11,19,22,26,27,28,29,3 /test...?f=1&s=3&sid=123&q=3& Out: NO MATCH MATCH -Run: obj/lib/regex-t '.*[0-9a-f]{8,16}.*' +Run: ../obj/lib/regex-t '.*[0-9a-f]{8,16}.*' In: abcdabcdabcd aaaaaaaaaaaaaaaaaaaaaaaaaaaa asddajlkdkajlqwepoiequwiouio diff --git a/lib/shell/config.t b/lib/shell/config.t index 97fad73d..a8aeb727 100644 --- a/lib/shell/config.t +++ b/lib/shell/config.t @@ -1,6 +1,6 @@ # Tests for configuration parser -Run: obj/lib/shell/config -C/dev/null -S 'sec1{int1=23; long1=1234567812345678; long2=4321; str1="s1"; str2="s2"}' 'sec1 {#int1; ##long1; -str1; str2; #int2=123; ##long2=1234; #int3=0x10; #int4; $dbl1=001.100; $dbl2}; sec2{str3}' +Run: ../obj/lib/shell/config -C/dev/null -S 'sec1{int1=23; long1=1234567812345678; long2=4321; str1="s1"; str2="s2"}' 'sec1 {#int1; ##long1; -str1; str2; #int2=123; ##long2=1234; #int3=0x10; #int4; $dbl1=001.100; $dbl2}; sec2{str3}' Out: CF_sec1_int1='23' CF_sec1_long1='1234567812345678' CF_sec1_str2='s2' @@ -12,13 +12,13 @@ Out: CF_sec1_int1='23' CF_sec1_dbl2='0' CF_sec2_str3='' -Run: obj/lib/shell/config -C/dev/null -S 'sec1{list1 1 a1 b1; list1:clear; list1 2 a2 b2 3 a3 b3}' 'sec1 {@list1 {#int1; str1; -str2}}' +Run: ../obj/lib/shell/config -C/dev/null -S 'sec1{list1 1 a1 b1; list1:clear; list1 2 a2 b2 3 a3 b3}' 'sec1 {@list1 {#int1; str1; -str2}}' Out: CF_sec1_list1_int1[1]='2' CF_sec1_list1_str1[1]='a2' CF_sec1_list1_int1[2]='3' CF_sec1_list1_str1[2]='a3' -Run: obj/lib/shell/config -C/dev/null -S 'sec1{ar1 a b c d; ar1 a b c; ar2 1 2; ar3 1.1}' 'sec1 {ar1[]; #ar2[2]; $ar3[-2]}' +Run: ../obj/lib/shell/config -C/dev/null -S 'sec1{ar1 a b c d; ar1 a b c; ar2 1 2; ar3 1.1}' 'sec1 {ar1[]; #ar2[2]; $ar3[-2]}' Out: CF_sec1_ar1[1]='a' CF_sec1_ar1[2]='b' CF_sec1_ar1[3]='c' @@ -26,7 +26,7 @@ Out: CF_sec1_ar1[1]='a' CF_sec1_ar2[2]='2' CF_sec1_ar3[1]='1.1' -Run: obj/lib/shell/config -C/dev/null -S 'sec1{list1 {str1=1; list2=a b c}; list1 {str1=2; list2=d e}}' 'sec1 {@list1 {str1; @list2{str2}}}' +Run: ../obj/lib/shell/config -C/dev/null -S 'sec1{list1 {str1=1; list2=a b c}; list1 {str1=2; list2=d e}}' 'sec1 {@list1 {str1; @list2{str2}}}' Out: CF_sec1_list1_str1[1]='1' CF_sec1_list1_list2_str2[1]='a' CF_sec1_list1_list2_str2[2]='b' @@ -35,5 +35,5 @@ Out: CF_sec1_list1_str1[1]='1' CF_sec1_list1_list2_str2[4]='d' CF_sec1_list1_list2_str2[5]='e' -Run: obj/lib/shell/config -C/dev/null 'sec{str=a'\''b"c'\''d"\\e'\''f"g}' +Run: ../obj/lib/shell/config -C/dev/null 'sec{str=a'\''b"c'\''d"\\e'\''f"g}' Out: CF_sec_str='ab"cd\e'\''fg' diff --git a/lib/slists.t b/lib/slists.t index f18dc7ad..fe642b1c 100644 --- a/lib/slists.t +++ b/lib/slists.t @@ -1,4 +1,4 @@ # Test for slists module -Run: obj/lib/slists-t +Run: ../obj/lib/slists-t Out: 9/7/3/1/2/4/8/10/ diff --git a/lib/stkstring.t b/lib/stkstring.t index 2b0c191c..7c7f90cd 100644 --- a/lib/stkstring.t +++ b/lib/stkstring.t @@ -1,6 +1,6 @@ # Tests for stkstring modules -Run: obj/lib/stkstring-t +Run: ../obj/lib/stkstring-t Out: Beware the Jabberwock, my son! 42 65 77 The jaws that bite diff --git a/lib/unicode-utf8.t b/lib/unicode-utf8.t index f41fb5a1..187afefd 100644 --- a/lib/unicode-utf8.t +++ b/lib/unicode-utf8.t @@ -1,33 +1,33 @@ # Tests for the Unicode UTF-8 module -Run: obj/lib/unicode-utf8-t put +Run: ../obj/lib/unicode-utf8-t put In: 0041 0048 004f 004a Out: 41 48 4f 4a -Run: obj/lib/unicode-utf8-t put +Run: ../obj/lib/unicode-utf8-t put In: 00aa 01aa 02a5 05a5 0a5a 15a5 2a5a 5a5a a5a5 Out: c2 aa c6 aa ca a5 d6 a5 e0 a9 9a e1 96 a5 e2 a9 9a e5 a9 9a ea 96 a5 -Run: obj/lib/unicode-utf8-t get +Run: ../obj/lib/unicode-utf8-t get In: 41 48 4f 4a Out: 0041 0048 004f 004a -Run: obj/lib/unicode-utf8-t get +Run: ../obj/lib/unicode-utf8-t get In: c2 aa c6 aa ca a5 d6 a5 e0 a9 9a e1 96 a5 e2 a9 9a e5 a9 9a ea 96 a5 Out: 00aa 01aa 02a5 05a5 0a5a 15a5 2a5a 5a5a a5a5 -Run: obj/lib/unicode-utf8-t get +Run: ../obj/lib/unicode-utf8-t get In: 84 ff f9 f8 c2 aa 41 Out: fffc fffc fffc fffc 00aa 0041 -Run: obj/lib/unicode-utf8-t put32 +Run: ../obj/lib/unicode-utf8-t put32 In: 15a5a 2a5a5 5a5a5 a5a5a 15a5a5 2a5a5a 5a5a5a a5a5a5 15a5a5a 2a5a5a5 5a5a5a5 a5a5a5a 15a5a5a5 2a5a5a5a 5a5a5a5a Out: f0 95 a9 9a f0 aa 96 a5 f1 9a 96 a5 f2 a5 a9 9a f5 9a 96 a5 f8 8a a5 a9 9a f8 96 a5 a9 9a f8 a9 9a 96 a5 f9 96 a5 a9 9a fa a9 9a 96 a5 fc 85 a9 9a 96 a5 fc 8a 96 a5 a9 9a fc 95 a9 9a 96 a5 fc aa 96 a5 a9 9a fd 9a 96 a5 a9 9a -Run: obj/lib/unicode-utf8-t get32 +Run: ../obj/lib/unicode-utf8-t get32 In: f0 95 a9 9a f0 aa 96 a5 f1 9a 96 a5 f2 a5 a9 9a f5 9a 96 a5 f8 8a a5 a9 9a f8 96 a5 a9 9a f8 a9 9a 96 a5 f9 96 a5 a9 9a fa a9 9a 96 a5 fc 85 a9 9a 96 a5 fc 8a 96 a5 a9 9a fc 95 a9 9a 96 a5 fc aa 96 a5 a9 9a fd 9a 96 a5 a9 9a Out: 15a5a 2a5a5 5a5a5 a5a5a 15a5a5 2a5a5a 5a5a5a a5a5a5 15a5a5a 2a5a5a5 5a5a5a5 a5a5a5a 15a5a5a5 2a5a5a5a 5a5a5a5a -Run: obj/lib/unicode-utf8-t get32 +Run: ../obj/lib/unicode-utf8-t get32 In: fe 83 81 Out: fffc fffc fffc