Mark Whitley | 1171c2f | 2001-01-04 01:05:55 +0000 | [diff] [blame^] | 1 | #!/usr/bin/perl |
| 2 | |
| 3 | # multibuild.pl |
| 4 | # Tests BusyBox-0.48 (at least) to see if each applet builds |
| 5 | # properly on its own. The most likely problems this will |
| 6 | # flush out are those involving preprocessor instructions in |
| 7 | # utility.c. |
| 8 | |
| 9 | $logfile = "multibuild.log"; |
| 10 | |
| 11 | # Support building from pristine source |
| 12 | $make_opt = "-f $ARGV[0]/Makefile BB_SRC_DIR=$ARGV[0]" if ($ARGV[0] ne ""); |
| 13 | |
| 14 | # Move the config file to a safe place |
| 15 | -e "Config.h.orig" || 0==system("mv -f Config.h Config.h.orig") || die; |
| 16 | |
| 17 | # Clear previous log file, if any |
| 18 | unlink($logfile); |
| 19 | |
| 20 | # Parse the config file |
| 21 | open(C,"<Config.h.orig") || die; |
| 22 | while (<C>) { |
| 23 | if ($in_trailer) { |
| 24 | $trailer .= $_; |
| 25 | } else { |
| 26 | $in_trailer=1 if /End of Applications List/; |
| 27 | if (/^\/*#define BB_([A-Z_]*)/) { |
| 28 | push @apps, $1; |
| 29 | } |
| 30 | } |
| 31 | } |
| 32 | close C; |
| 33 | |
| 34 | # Do the real work ... |
| 35 | for $a (@apps) { |
| 36 | # print "Testing build of applet $a ...\n"; |
| 37 | open (O, ">Config.h") || die; |
| 38 | print O "#define BB_$a\n", $trailer; |
| 39 | close O; |
| 40 | system("echo -e '\n***\n$a\n***' >>$logfile"); |
| 41 | # todo: figure out why the "rm -f *.o" is needed |
| 42 | $result{$a} = system("rm -f *.o; make $make_opt busybox >>$logfile 2>&1"); |
| 43 | $flag = $result{$a} ? "FAIL" : "OK"; |
| 44 | print "Applet $a: $flag\n"; |
| 45 | } |
| 46 | |
| 47 | # Clean up our mess |
| 48 | system("mv -f Config.h.orig Config.h"); |
| 49 | |
| 50 | print "See $logfile for details.\n"; |
| 51 | |