2001-01-04 01:05:55 +00:00
|
|
|
#!/usr/bin/perl
|
|
|
|
|
|
|
|
# multibuild.pl
|
|
|
|
# Tests BusyBox-0.48 (at least) to see if each applet builds
|
|
|
|
# properly on its own. The most likely problems this will
|
|
|
|
# flush out are those involving preprocessor instructions in
|
|
|
|
# utility.c.
|
2001-02-01 22:43:49 +00:00
|
|
|
#
|
2004-03-15 08:29:22 +00:00
|
|
|
# TODO: some time it might be nice to list absolute and
|
2001-02-01 22:43:49 +00:00
|
|
|
# differential object sizes for each option...
|
|
|
|
#
|
2001-01-04 01:05:55 +00:00
|
|
|
|
|
|
|
$logfile = "multibuild.log";
|
|
|
|
|
2001-10-24 05:00:29 +00:00
|
|
|
# How to handle all the CONFIG_FEATURE_FOO lines
|
2001-02-01 22:43:49 +00:00
|
|
|
if ($ARGV[0] eq "-all" ) { shift(@ARGV); $choice="all"; }
|
|
|
|
if ($ARGV[0] eq "-none") { shift(@ARGV); $choice="none"; }
|
|
|
|
# neither means, leave that part of Config.h alone
|
|
|
|
|
2001-01-04 01:05:55 +00:00
|
|
|
# Support building from pristine source
|
2001-10-24 05:00:29 +00:00
|
|
|
$make_opt = "-f $ARGV[0]/Makefile CONFIG_SRC_DIR=$ARGV[0]" if ($ARGV[0] ne "");
|
2001-01-04 01:05:55 +00:00
|
|
|
|
|
|
|
# Move the config file to a safe place
|
|
|
|
-e "Config.h.orig" || 0==system("mv -f Config.h Config.h.orig") || die;
|
|
|
|
|
|
|
|
# Clear previous log file, if any
|
|
|
|
unlink($logfile);
|
|
|
|
|
|
|
|
# Parse the config file
|
|
|
|
open(C,"<Config.h.orig") || die;
|
|
|
|
while (<C>) {
|
|
|
|
if ($in_trailer) {
|
2001-02-01 22:43:49 +00:00
|
|
|
if (!$in_olympus) {
|
|
|
|
s/^\/\/#/#/ if ($choice eq "all" && !/USE_DEVPS_PATCH/);
|
|
|
|
s/^#/\/\/#/ if ($choice eq "none");
|
|
|
|
}
|
|
|
|
$in_olympus=1 if /End of Features List/;
|
2001-01-04 01:05:55 +00:00
|
|
|
$trailer .= $_;
|
|
|
|
} else {
|
|
|
|
$in_trailer=1 if /End of Applications List/;
|
2001-10-24 05:00:29 +00:00
|
|
|
if (/^\/*#define CONFIG_([A-Z0-9_]*)/) {
|
2001-01-04 01:05:55 +00:00
|
|
|
push @apps, $1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
close C;
|
|
|
|
|
|
|
|
# Do the real work ...
|
2001-02-01 22:43:49 +00:00
|
|
|
$failed_tests=0;
|
2001-01-04 01:05:55 +00:00
|
|
|
for $a (@apps) {
|
|
|
|
# print "Testing build of applet $a ...\n";
|
|
|
|
open (O, ">Config.h") || die;
|
2001-10-24 05:00:29 +00:00
|
|
|
print O "#define CONFIG_$a\n", $trailer;
|
2001-01-04 01:05:55 +00:00
|
|
|
close O;
|
|
|
|
system("echo -e '\n***\n$a\n***' >>$logfile");
|
2001-03-15 22:14:26 +00:00
|
|
|
# With a fast computer and 1-second resolution on file timestamps, this
|
|
|
|
# process pushes beyond the limits of what unix make can understand.
|
|
|
|
# That's why need to weed out obsolete files before restarting make.
|
|
|
|
$result{$a} = system("rm -f *.o applet_source_list; make $make_opt busybox >>$logfile 2>&1");
|
2001-02-01 22:43:49 +00:00
|
|
|
$flag = $result{$a} ? "FAILED!!!" : "ok";
|
|
|
|
printf("Applet %-20s: %s\n", $a, $flag);
|
|
|
|
$total_tests++;
|
|
|
|
$failed_tests++ if $flag eq "FAILED!!!";
|
|
|
|
# pause long enough to let user stop us with a ^C
|
2001-03-15 22:14:26 +00:00
|
|
|
select(undef, undef, undef, 0.03);
|
2001-01-04 01:05:55 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
# Clean up our mess
|
|
|
|
system("mv -f Config.h.orig Config.h");
|
|
|
|
|
2001-02-01 22:43:49 +00:00
|
|
|
print "$total_tests applets tested, $failed_tests failures\n";
|
2001-01-04 01:05:55 +00:00
|
|
|
print "See $logfile for details.\n";
|
|
|
|
|