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