From afd413c3adb858115410ed8ce0712aa9c5eb42dd Mon Sep 17 00:00:00 2001
From: Sergey Lyubka <valenok@gmail.com>
Date: Sun, 29 Jan 2012 18:55:07 +0000
Subject: [PATCH] Renamed test_all_build_flags.pl to all_build_flags.pl

---
 test/all_build_flags.pl | 28 ++++++++++++++++++++++++++++
 1 file changed, 28 insertions(+)
 create mode 100644 test/all_build_flags.pl

diff --git a/test/all_build_flags.pl b/test/all_build_flags.pl
new file mode 100644
index 0000000..ee225f9
--- /dev/null
+++ b/test/all_build_flags.pl
@@ -0,0 +1,28 @@
+#!/usr/bin/env perl
+
+@flags = ("NO_POPEN", "NO_SSL", "NDEBUG", "DEBUG", "NO_CGI");
+my $num_flags = @flags;
+
+sub fail {
+	print "FAILED: @_\n";
+	exit 1;
+}
+
+my $platform = $ARGV[0] || "linux";
+
+for (my $i = 0; $i < 2 ** $num_flags; $i++) {
+	my $bitmask = sprintf("%*.*b", $num_flags, $num_flags, $i);
+	my @combination = ();
+	for (my $j = 0; $j < $num_flags; $j++) {
+		push @combination, $flags[$j] if substr($bitmask, $j, 1);
+	}
+	my $defines = join(" ", map { "-D$_" } @combination);
+	my $cmd = "CFLAGS=\"$defines\" make clean $platform >/dev/null";
+	system($cmd) == 0 or fail "build failed: $_";
+	print "Build succeeded, flags: [$defines]\n";
+	system("perl test/test.pl basic_tests >/dev/null") == 0
+		or fail "basic tests";
+	print "Basic tests: OK\n";
+}
+
+print "PASS: All builds passed!\n";
-- 
2.18.1