[llvm-commits] CVS: reopt/test/TTFTestHarness.pl

Brian Gaeke gaeke at cs.uiuc.edu
Fri Jul 9 01:15:01 PDT 2004


Changes in directory reopt/test:

TTFTestHarness.pl added (r1.1)

---
Log message:

So that I don't inadvertently blow this away, I'm checking it in.


---
Diffs of the changes:  (+80 -0)

Index: reopt/test/TTFTestHarness.pl
diff -c /dev/null reopt/test/TTFTestHarness.pl:1.1
*** /dev/null	Fri Jul  9 01:14:42 2004
--- reopt/test/TTFTestHarness.pl	Fri Jul  9 01:14:32 2004
***************
*** 0 ****
--- 1,80 ----
+ #!/usr/bin/perl
+ 
+ $TTFTEST = "../Debug/ttftest";
+ die "can't find ttftest" unless -x $TTFTEST;
+ 
+ sub assembleBytecode {
+   my ($input, $output) = @_;
+   if (system ("llvm-as -f -o=$output $input $SQUELCH") == 0) {
+     if (-f $output) {
+       return 1; # ok
+     }
+   }
+   return 0; # fail
+ }
+ 
+ sub runTest {
+   my ($trace, $bytecode) = @_;
+   print "    $trace...";
+   my $rc = system ("$TTFTEST -trace=$trace -bc=$bytecode $SQUELCH");
+   if ($rc == 0) {
+     print "ok\n";
+     return 0;
+   } else {
+     print "Fail\n";
+     return 1;
+   }
+ }
+ 
+ sub runTestsForModule {
+   my ($module) = @_;
+   my $base = $module;
+   if ($base =~ /\.ll$/) {
+     $base =~ s/\.ll$//;
+   } elsif ($base =~ /\.bc$/) {
+     $base =~ s/\.bc$//;
+   } else {
+     die "base is $base ?";
+   }
+   my $bytecode = "${base}.bc";
+   if (! -f $bytecode) {
+     assembleBytecode ($module, $bytecode);
+     if (! -f $bytecode) {
+       warn "Couldn't assemble $module\n";
+       return 1;
+     }
+   }
+   print "${module}...\n";
+   my $fail = 0;
+   foreach my $trace (<${base}*trace*.txt>) {
+     $fail += runTest ($trace, $bytecode);
+   }
+   print "$fail tests failed for $module\n";
+   if ($module =~ /\.ll$/) {
+     unlink ($bytecode);
+   }
+   print "\n";
+   return $fail;
+ }
+ 
+ $| = 1;
+ if ($ARGV[0] eq '-v') {
+   $VERBOSE = 1;
+   $SQUELCH = "";
+   shift @ARGV;
+ } else {
+   $VERBOSE = 0;
+   $SQUELCH = " > /dev/null 2>&1";
+ }
+ my @tests = @ARGV;
+ if ($#tests == -1) {
+   #@tests = <*.ll>;
+   @tests = <*.bc>;
+ }
+ my ($ntests, $fail) = (0, 0);
+ foreach my $test (@tests) {
+   $fail += runTestsForModule ($test);
+   $ntests++;
+ }
+ print "$fail tests failed out of $ntests modules total\n";
+ exit ($fail != 0);





More information about the llvm-commits mailing list