From 06eaf7232e9a920468c0f8d74dcf2fe8b555501c Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Sat, 13 Apr 2024 14:24:36 +0200 Subject: Adding upstream version 1:10.11.6. Signed-off-by: Daniel Baumann --- dbug/tests-t.pl | 456 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 456 insertions(+) create mode 100755 dbug/tests-t.pl (limited to 'dbug/tests-t.pl') diff --git a/dbug/tests-t.pl b/dbug/tests-t.pl new file mode 100755 index 00000000..22526a7b --- /dev/null +++ b/dbug/tests-t.pl @@ -0,0 +1,456 @@ +#!/usr/bin/env perl + +# +# A driver program to test DBUG features - runs tests (shell commands) +# from the end of file to invoke tests.c, which does the real dbug work. +# + +use Test::More; + +$exe=$0; +$exe =~ s@[^/]+$@tests@; + +die unless -x $exe; + +# load tests +@tests=(); +while () { + if (/^% \.\/tests /) { + push @tests, [ $' ] + } elsif (/^#/) { + next; + } else { + push @{$tests[$#tests]}, $_ + } +} + +plan skip_all => "because dbug is disabled" if system $exe; + +plan tests => scalar(@tests); + +for (@tests) { + $t=$exe . ' ' . shift @$_; + chomp($t); + open F, '-|', $t or die "open($t|): $!"; + local $"; + $out=join($", ); close(F); + # special cases are handled here: + $out =~ s/Memory: 0x[0-9A-Fa-f]+/Memory: 0x####/g if $t =~ /dump/; + # compare ("\n" at the beginning makes better output in case of errors) + is("\n$out","\n@$_", $t); +} + +__DATA__ +% ./tests -#d +func2: info: s=ok +=> execute +=> evaluate_if: OFF +main: explain: dbug explained: d +func2: info: s=ok +% ./tests d,ret3 +=> evaluate_if: OFF +# +## Testing negative lists +# +% ./tests d:-d,ret3 +func2: info: s=ko +=> execute +=> evaluate_if: OFF +main: explain: dbug explained: d:-d,ret3 +func2: info: s=ko +% ./tests t:-d,ret3 +>main +| >func1 +| | >func2 +| | | >func3 +| | | evaluate_if: OFF +| >func2 +| | >func3 +| | main +| >func1 +| | >func2 +| | | >func3 +| | | evaluate_if: OFF +| >func2 +| | >func3 +| | main +| >func1 +| | | >func3 +| | | evaluate_if: OFF +| | >func3 +| | evaluate_if: OFF +% ./tests t:d,info:-d,ret3:-f,func2 d,evaluate_if +=> evaluate_if: ON +% ./tests t:d:-d,ret3:-f,func2 d,evaluate_if +=> evaluate_if: ON +% ./tests t:d:-d,ret3:-f,func2 +>main +| >func1 +| | | >func3 +| | | execute +=> evaluate_if: OFF +| explain: dbug explained: d:-d,ret3:f:-f,func2:t +| | >func3 +| | main +| >func1 +| | | >func3 +| | | evaluate_if: ON +| | >func3 +| | main +| >func1 +| | | >func3 +| | | evaluate_if: OFF +| | >func3 +| | main +| >func1 +| | | >func3 +| | | evaluate_if: OFF +| | >func3 +| | main +| >func1 +| | | >func3 +| | | evaluate_if: OFF +| | >func3 +| | main +| >func1 +| | | >func3 +| | | evaluate_if: OFF +| explain: dbug explained: d,dump,explain:-d,ret3:f:-f,func2:t +| | >func3 +| | main +dbug-tests: | >func1 +dbug-tests: | | | >func3 +dbug-tests: | | | evaluate_if: OFF +dbug-tests: | explain: dbug explained: d,dump,explain:-d,ret3:f:-f,func2:P:t +dbug-tests: | | >func3 +dbug-tests: | | main +dbug-tests: tests.c: | >func1 +dbug-tests: tests.c: | | | >func3 +dbug-tests: tests.c: | | | evaluate_if: OFF +dbug-tests: tests.c: | explain: dbug explained: d,dump,explain:-d,ret3:f:-f,func2:F:P:t +dbug-tests: tests.c: | | >func3 +dbug-tests: tests.c: | | main +| >func1 +| | | >func3 +| | | execute +=> evaluate_if: OFF +| explain: dbug explained: d:-d,ret3:f:-f,func2:t +| | >func3 +| | main +| >func1 +| | >func2 +| | | >func3 +| | | execute +=> evaluate_if: OFF +| explain: dbug explained: d:-d,ret3:t +| >func2 +| | >func3 +| | evaluate_if: OFF +| >func2 +| | >func3 +| | evaluate_if: OFF +| explain: dbug explained: d,info,push,explain:-d,ret3:t +| >func2 +| | >func3 +| | evaluate_if: OFF +main: explain: dbug explained: d,info,explain:-d,ret3 +func2: info: s=ko +% ./tests d,info:-d,ret3:d,explain,pop +func2: info: s=ko +=> evaluate_if: OFF +% ./tests d,info:-d,ret3:d,explain t:d,pop +>main +| >func1 +| | >func2 +| | | >func3 +| | | evaluate_if: OFF +main: explain: dbug explained: d,info,explain:-d,ret3 +func2: info: s=ko +% ./tests d,info:-d,ret3:d,explain,pop +t +>main +| >func1 +| | >func2 +| | | >func3 +| | | evaluate_if: OFF +main: explain: dbug explained: d,info,explain,pop:-d,ret3 +func2: info: s=ko +% ./tests d,info:-d,ret3:d,explain,set +func2: info: s=ko +=> evaluate_if: OFF + tests.c: main: explain: dbug explained: d,info,explain,set:-d,ret3:F + tests.c: func2: info: s=ko +% ./tests d,info:-d,ret3:d,explain,set:t +>main +| >func1 +| | >func2 +| | | >func3 +| | | evaluate_if: OFF + tests.c: | explain: dbug explained: d,info,explain,set:-d,ret3:F:t + tests.c: | >func2 + tests.c: | | >func3 + tests.c: | | main +| >func1 +| | >func2 +| | | >func3 +| | | evaluate_if: OFF + tests.c: | explain: dbug explained: d,info,explain,set:-d,ret3:F:t + tests.c: | >func2 + tests.c: | | >func3 + tests.c: | | evaluate_if: OFF +| >func2 +| | >func3 +| | func2 +| | evaluate_if: OFF +| >func2 +| main +| >func1 +| execute +=> evaluate_if: OFF +| explain: dbug explained: d:f:-f,func2/:t +
func1 +| | >func2 +| | | >func3 +| | | evaluate_if: OFF +% ./tests t:f,main/:d,pop +>main +| >func1 +| | >func2 +| | | >func3 +| | | evaluate_if: OFF +% ./tests f,main/:d,push +=> evaluate_if: OFF +| >func2 +| | >func3 +| | func1 +| | >func2 +| | | >func3 +| | | push1 +=> evaluate_if: OFF +| | >func3 +| | main +=> push1 +| evaluate_if: OFF +| >func2 +| | >func3 +| | func3 +| | | push1 +| evaluate_if: OFF +| >func2 +| | >func3 +| | main +| >func1 +| | >func2 +| | | >func3 +| | | push1 +=> evaluate_if: OFF +# change the defaults +% ./tests t:f,func3 --push1=t +| | | >func3 +| | | push1 +| evaluate_if: OFF +| >func2 +| | >func3 +| | execute +=> evaluate_if: OFF +main: explain: dbug explained: d:-d,info +% ./tests d:-d,info/,info +=> execute +=> evaluate_if: OFF +main: explain: dbug explained: d:-d,info/ -- cgit v1.2.3