2 # vim:ts=4:sw=4:expandtab
9 use Cwd qw(abs_path getcwd);
12 use TAP::Parser::Aggregator;
13 use File::Basename qw(basename);
15 my $i3cmd = "export DISPLAY=:0; exec " . abs_path("../i3") . " -V -d all --disable-signalhandler -c " . abs_path("../i3.config");
17 # 1: get a list of all testcases
18 my $curdir = getcwd();
19 my @testfiles = @ARGV;
21 # if no files were passed on command line, run all tests
22 if (@testfiles == 0) {
24 push @testfiles, "t/$_" while (<*.t>);
28 # 2: create an output directory for this test-run
29 my $outdir = "testsuite-";
30 $outdir .= DateTime->now->strftime("%Y-%m-%d-%H-%M-%S-");
31 $outdir .= `git describe --tags`;
33 mkdir($outdir) or die "Could not create $outdir";
34 unlink("latest") if -e "latest";
35 symlink("$outdir", "latest") or die "Could not symlink latest to $outdir";
38 my $harness = TAP::Harness->new({
42 my $aggregator = TAP::Parser::Aggregator->new();
44 for my $t (@testfiles) {
45 my $logpath = "$outdir/i3-log-for-" . basename($t);
46 my $cmd = "$i3cmd >$logpath 2>&1";
48 my $process = Proc::Background->new($cmd);
49 say "testing $t with logfile $logpath";
50 $harness->aggregate_tests($aggregator, [ $t ]);
51 kill(9, $process->pid) or die "could not kill i3";
56 $harness->summary($aggregator);