runtests (1054B)
1 #!/usr/bin/perl 2 # This program is licensed under the terms of GNU GPL v3 or (at your option) 3 # any later version. Copyright (C) 2022-2026 Страхиња Радић. 4 # See the file LICENSE for exact copyright and license details. 5 6 7 use 5.010; 8 use File::Find; 9 10 my $errors = 0; 11 my @files; 12 my $maxlen = 60; 13 my $testdir = 'tests'; 14 15 system("sh -c 'command -v expect' >/dev/null") == 0 || 16 die "Test suite requires expect"; 17 18 find(sub { 19 push @files, $File::Find::name if (/\.test$/); 20 }, $testdir . "/"); 21 22 for (@files) 23 { 24 system $_; 25 $results{$_} = $?>>8; 26 } 27 28 # Clear the screen 29 print "\033[0m\033[2J\033[2K\033[1;1H"; 30 31 print <<"!"; 32 TEST RESULTS 33 ============================================================ 34 ! 35 36 for (@files) 37 { 38 printf "%s:%*s%s\t%s\n", $_, $maxlen-5-length($_), " ", 39 $results{$_} == 0 ? " OK" : "FAIL"; 40 if ($results{$_}) 41 { 42 $errors = 1; 43 } 44 } 45 46 if ($errors == 1) 47 { 48 printf "Some tests were unsuccessful - please report\n"; 49 } 50 else 51 { 52 printf "All tests passed\n"; 53 } 54 55 print <<"!"; 56 ============================================================ 57 !