From a57cdc84e2f38ea99fd464d8b5b6446c769cc545 Mon Sep 17 00:00:00 2001 From: Michael Stapelberg Date: Wed, 23 Jan 2019 08:56:40 +0100 Subject: Switch to autotools (#316) --- travis/run-tests.pl | 61 -------------------------------------------------- travis/run-tests.pl.in | 61 ++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 61 insertions(+), 61 deletions(-) delete mode 100755 travis/run-tests.pl create mode 100755 travis/run-tests.pl.in (limited to 'travis') diff --git a/travis/run-tests.pl b/travis/run-tests.pl deleted file mode 100755 index c335ff3..0000000 --- a/travis/run-tests.pl +++ /dev/null @@ -1,61 +0,0 @@ -#!/usr/bin/env perl - -use v5.10; -use strict; -use warnings; -use English; -use Term::ANSIColor qw(:constants); -use File::Basename; - -sub TestCase { - my ($dir) = @_; - - if ( -f "@_/setup.pl") { - system($EXECUTABLE_NAME, "@_/setup.pl", ($dir)); - } - - my $conf = "$dir/i3status.conf"; - my $testres = `./i3status --run-once -c $conf`; - my $exitcode = $?; - my $refres = ""; - - if ( -f "@_/expected_output.txt") { - $refres = `cat "@_/expected_output.txt"`; - } elsif ( -f "@_/expected_output.pl") { - $refres = `$EXECUTABLE_NAME @_/expected_output.pl`; - } - - if ( -f "@_/cleanup.pl") { - system($EXECUTABLE_NAME, "@_/cleanup.pl", ($dir)); - } - - if ( $exitcode != 0 ) { - say "Testing test case '", basename($dir), "'… ", BOLD, RED, "Crash!", RESET; - return 0; - } - - if ( "$testres" eq "$refres" ) { - say "Testing test case '", basename($dir), "'… ", BOLD, GREEN, "OK", RESET; - return 1; - } else { - say "Testing test case '", basename($dir), "'… ", BOLD, RED, "Failed!", RESET; - say "Expected: '$refres'"; - say "Got: '$testres'"; - return 0; - } -} - -my $testcases = 'testcases'; -my $testresults = 0; - -opendir(my $dir, $testcases) or die "Could not open directory $testcases: $!"; - -while (my $entry = readdir($dir)) { - next unless (-d "$testcases/$entry"); - next if ($entry =~ m/^\./); - if (not TestCase("$testcases/$entry") ) { - $testresults = 1; - } -} -closedir($dir); -exit $testresults; diff --git a/travis/run-tests.pl.in b/travis/run-tests.pl.in new file mode 100755 index 0000000..88727d9 --- /dev/null +++ b/travis/run-tests.pl.in @@ -0,0 +1,61 @@ +#!/usr/bin/env perl + +use v5.10; +use strict; +use warnings; +use English; +use Term::ANSIColor qw(:constants); +use File::Basename; + +sub TestCase { + my ($dir) = @_; + + if ( -f "@_/setup.pl") { + system($EXECUTABLE_NAME, "@_/setup.pl", ($dir)); + } + + my $conf = "$dir/i3status.conf"; + my $testres = `cd @abs_top_srcdir@ && LC_ALL=C @abs_top_builddir@/i3status --run-once -c $conf`; + my $exitcode = $?; + my $refres = ""; + + if ( -f "@_/expected_output.txt") { + $refres = `cat "@_/expected_output.txt"`; + } elsif ( -f "@_/expected_output.pl") { + $refres = `$EXECUTABLE_NAME @_/expected_output.pl`; + } + + if ( -f "@_/cleanup.pl") { + system($EXECUTABLE_NAME, "@_/cleanup.pl", ($dir)); + } + + if ( $exitcode != 0 ) { + say "Testing test case '", basename($dir), "'… ", BOLD, RED, "Crash!", RESET; + return 0; + } + + if ( "$testres" eq "$refres" ) { + say "Testing test case '", basename($dir), "'… ", BOLD, GREEN, "OK", RESET; + return 1; + } else { + say "Testing test case '", basename($dir), "'… ", BOLD, RED, "Failed!", RESET; + say "Expected: '$refres'"; + say "Got: '$testres'"; + return 0; + } +} + +my $testcases = '@abs_top_srcdir@/testcases'; +my $testresults = 0; + +opendir(my $dir, $testcases) or die "Could not open directory $testcases: $!"; + +while (my $entry = readdir($dir)) { + next unless (-d "$testcases/$entry"); + next if ($entry =~ m/^\./); + if (not TestCase("$testcases/$entry") ) { + $testresults = 1; + } +} +closedir($dir); +exit $testresults; -- cgit v1.2.3