commit
64fd6e1047
@ -22,4 +22,4 @@ addons:
|
|||||||
script:
|
script:
|
||||||
- make -j
|
- make -j
|
||||||
- clang-format-3.5 -i $(find . -name "*.[ch]" | tr '\n' ' ') && git diff --exit-code || (echo 'Code was not formatted using clang-format!'; false)
|
- clang-format-3.5 -i $(find . -name "*.[ch]" | tr '\n' ' ') && git diff --exit-code || (echo 'Code was not formatted using clang-format!'; false)
|
||||||
- ./travis/run-tests.pl
|
- make test
|
||||||
|
3
Makefile
3
Makefile
@ -99,6 +99,9 @@ i3status: ${OBJS}
|
|||||||
$(CC) $(LDFLAGS) -o $@ $^ $(LIBS)
|
$(CC) $(LDFLAGS) -o $@ $^ $(LIBS)
|
||||||
@echo " LD $@"
|
@echo " LD $@"
|
||||||
|
|
||||||
|
test: i3status
|
||||||
|
LC_ALL=C ./travis/run-tests.pl
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
rm -f *.o src/*.o
|
rm -f *.o src/*.o
|
||||||
|
|
||||||
|
@ -16,6 +16,7 @@ sub TestCase {
|
|||||||
|
|
||||||
my $conf = "$dir/i3status.conf";
|
my $conf = "$dir/i3status.conf";
|
||||||
my $testres = `./i3status --run-once -c $conf`;
|
my $testres = `./i3status --run-once -c $conf`;
|
||||||
|
my $exitcode = $?;
|
||||||
my $refres = "";
|
my $refres = "";
|
||||||
|
|
||||||
if ( -f "@_/expected_output.txt") {
|
if ( -f "@_/expected_output.txt") {
|
||||||
@ -28,24 +29,33 @@ sub TestCase {
|
|||||||
system($EXECUTABLE_NAME, "@_/cleanup.pl", ($dir));
|
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" ) {
|
if ( "$testres" eq "$refres" ) {
|
||||||
say "Testing test case '", basename($dir), "'… ", BOLD, GREEN, "OK", RESET;
|
say "Testing test case '", basename($dir), "'… ", BOLD, GREEN, "OK", RESET;
|
||||||
return 1;
|
return 1;
|
||||||
} else {
|
} else {
|
||||||
say "Testing test case '", basename($dir), "'… ", BOLD, RED, "Failed!", RESET;
|
say "Testing test case '", basename($dir), "'… ", BOLD, RED, "Failed!", RESET;
|
||||||
|
say "Expected: '$refres'";
|
||||||
|
say "Got: '$testres'";
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
my $testcases = 'testcases';
|
my $testcases = 'testcases';
|
||||||
my $testresults = 1;
|
my $testresults = 0;
|
||||||
|
|
||||||
opendir(my $dir, $testcases) or die "Could not open directory $testcases: $!";
|
opendir(my $dir, $testcases) or die "Could not open directory $testcases: $!";
|
||||||
|
|
||||||
while (my $entry = readdir($dir)) {
|
while (my $entry = readdir($dir)) {
|
||||||
next unless (-d "$testcases/$entry");
|
next unless (-d "$testcases/$entry");
|
||||||
next if ($entry =~ m/^\./);
|
next if ($entry =~ m/^\./);
|
||||||
$testresults = $testresults && TestCase("$testcases/$entry");
|
if (not TestCase("$testcases/$entry") ) {
|
||||||
|
$testresults = 1;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
closedir($dir);
|
closedir($dir);
|
||||||
exit 0;
|
exit $testresults;
|
||||||
|
Loading…
Reference in New Issue
Block a user