test_all_build_flags.pl 788 B

12345678910111213141516171819202122232425262728
  1. #!/usr/bin/env perl
  2. @flags = ("NO_SSI", "NO_SSL", "NDEBUG", "DEBUG", "NO_CGI");
  3. my $num_flags = @flags;
  4. sub fail {
  5. print "FAILED: @_\n";
  6. exit 1;
  7. }
  8. my $platform = $ARGV[0] || "linux";
  9. for (my $i = 0; $i < 2 ** $num_flags; $i++) {
  10. my $bitmask = sprintf("%*.*b", $num_flags, $num_flags, $i);
  11. my @combination = ();
  12. for (my $j = 0; $j < $num_flags; $j++) {
  13. push @combination, $flags[$j] if substr($bitmask, $j, 1);
  14. }
  15. my $defines = join(" ", map { "-D$_" } @combination);
  16. my $cmd = "CFLAGS=\"$defines\" make clean $platform >/dev/null";
  17. system($cmd) == 0 or fail "build failed: $_";
  18. print "Build succeeded, flags: [$defines]\n";
  19. system("perl test/test.pl basic_tests >/dev/null") == 0
  20. or fail "basic tests";
  21. print "Basic tests: OK\n";
  22. }
  23. print "PASS: All builds passed!\n";