File: run-tests.pl

package info (click to toggle)
cl-xmls 3.0.2-1
  • links: PTS, VCS
  • area: main
  • in suites: bullseye, buster, sid
  • size: 720 kB
  • sloc: xml: 7,639; lisp: 1,084; perl: 101; makefile: 39
file content (151 lines) | stat: -rwxr-xr-x 4,628 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
#!/usr/bin/env perl

use Getopt::Long;
use FindBin;
use File::Find;

our $FORM = "(xmls::test)";
our $EVAL = "--eval";
our $SEPARATOR="";
our $quicklisp = 0;
our $usage = <<'USAGE';
usage: run-tests.pl [options]
options: 
    --abcl run tests with abcl
    --allegro run tests with Allegro Common Lisp, ANSI mode
    --allegromodern run tests with Allegro Common Lisp, modern case-sensitive mode
    --ccl run tests with clozure common lisp
    --cmucl run tests with cmucl
    --sbcl run tests with sbcl (default)
    --quicklisp run against quicklisp
    --verbose output parsed xml

Note, there are two ways to run this system: either you can run it in an environment
where Quicklisp is available, and the ancillary libraries needed for the tests are
available that way, or you can use the CL_SOURCE_REGISTRY configuration to set up
ASDF to find the ancillary libraries.
USAGE

our $command = $ENV{SBCL} || "sbcl";
our $CMDLINE="${command} --no-userinit ";
our $SEPARATOR="--";
our $LOAD="--load";
my $help = 0;
my $verbose = 0;
$ENV{"CL_SOURCE_REGISTRY"}=$FindBin::RealBin . ":" unless $ENV{"CL_SOURCE_REGISTRY"};
GetOptions ( "abcl" => \&lisp_handler,
             "ccl" => \&lisp_handler,
             "cmucl" => \&lisp_handler,
             "allegro" => \&lisp_handler,
             "allegromodern" => \&lisp_handler,
             "sbcl" => \&lisp_handler,
             "clisp" => \&lisp_handler,
             "help" => \$help,
             "usage" => \$help,
             "verbose" => \&set_verbose,
             "quicklisp" => \$quicklisp
             );
$ENV{"QUICKLISP"} = $quicklisp;

if ($help) {
  print $usage;
  exit 0;
}

# unless ( $TESTS ) {
#     set_all_tests();
# }

# {
#   my $command =  "$CMDLINE $EVAL \"(require :asdf)\" $EVAL \"(asdf:load-system :xmls)\" $EVAL \"$FORM\" $SEPARATOR $TESTS";
#   print "$command\n" if $verbose;
#   my $code = system $command;
#   if ($code != 0) {
#     print "XMLS parsing tests failed.\n";
#     exit $code
#   } else {
#     if ($verbose) {
#     }
#   }
# }

{
print STDERR "Running ASDF tests.\n";
my $cmd = "$CMDLINE $LOAD $FindBin::RealBin/run-tests.lisp";
print STDERR "Command for 5AM tests is:\n\t$cmd\n";
my $code = system $cmd;
print STDERR "ASDF test output code is: $code\n";
if ($code) {
  $code = $code >> 8;
  print STDERR "Exiting script with code $code\n";
  # this is going wrong...
  exit $code;
}
print STDERR "Done running ASDF tests.\n";
exit 0;
}

# subroutines from here on down...

sub set_verbose {
    $FORM="(progn (setf xmls::*test-verbose* t)(xmls::test))";
    $verbose = 1;
}

# our @all_tests;
# sub set_all_tests {
#     File::Find::find({wanted => \&wanted}, "$FindBin::RealBin/tests/");
#     if ($verbose) {
#       print STDERR "Test list is:\n";
#       foreach my $test (@all_tests) {
#         print STDERR "\t$test\n";
#       }
#     }
#     $TESTS = join(" ", @all_tests);
# }

# sub wanted {
#     /^.*\.xml\z/s
#     && push @all_tests, $File::Find::name;
# }

sub usage {
    print $usage;
}

sub lisp_handler {
    my $lisp = shift;
    if ( $lisp eq "abcl" ) {
           $command=$ENV{ABCL} || "abcl";
           $CMDLINE="${command} --noinit --noinform"; # --eval \'(require :asdf)\' --load xmls.asd --eval \'(asdf:load-system :xmls)\' ";
       } elsif ( $lisp eq "ccl" ) {
           $command=$ENV{CCL} || "ccl";
           $CMDLINE="${command} --no-init --quiet"; # --eval \'(require :asdf)\' --load xmls.asd --eval '(asdf:load-system :xmls)' ";
           $SEPARATOR="--";
       } elsif ( $lisp eq "cmucl" ) {
           $command=$ENV{CMUCL} || "lisp";
           $EVAL="-eval"; $LOAD="-load";
           $CMDLINE="${command} -noinit " #-eval \'(require :asdf)\' -load xmls.asd -eval \'(asdf:load-system :xmls)\' ";
       } elsif ($lisp eq "allegro") {
           $command=$ENV{ALLEGRO} || "alisp";
           $EVAL = "-e"; $LOAD="-L";
           $CMDLINE="${command} -q"; # -e \'(require :asdf)\' -L xmls.asd -e \'(asdf:load-system :xmls)\' ";
           $SEPARATOR="--";
       } elsif ($lisp eq "allegromodern") {
           $command=$ENV{ALLEGROMODERN} || "mlisp";
           $EVAL = "-e";
           $LOAD = "-L";
           $CMDLINE="${command} -q "; #-e \'(require :asdf)\' -L xmls.asd -e \'(asdf:load-system :xmls)\' ";
           $SEPARATOR="--";
       } elsif ($lisp eq "sbcl") {
           # the default...
       } elsif ($lisp eq "clisp") {
           $command=$ENV{CLISP} || "clisp";
           $EVAL = "-x";
           $LOAD = "-i";
           $CMDLINE="${command} -norc -ansi"; # -x \'(require :asdf)\' -i xmls.asd -x \'(asdf:load-system :xmls)\' ";
           $SEPARATOR="--";
       }
}