about summary refs log tree commit diff
path: root/scripts/bench.pl
diff options
context:
space:
mode:
authorTorvald Riegel <triegel@redhat.com>2013-10-08 14:04:10 +0300
committerTorvald Riegel <triegel@redhat.com>2013-10-10 14:45:30 +0300
commit40fefba1b5b05d05a3a4b48796a1006db90d8f74 (patch)
treef7bddfa085842455cbe6934dae95707a0a4e6e2e /scripts/bench.pl
parentdcc2dd3f46e6cd532527ed041103633f99efb611 (diff)
downloadglibc-40fefba1b5b05d05a3a4b48796a1006db90d8f74.tar.gz
glibc-40fefba1b5b05d05a3a4b48796a1006db90d8f74.tar.xz
glibc-40fefba1b5b05d05a3a4b48796a1006db90d8f74.zip
benchtests: Add include-sources directive.
This adds the "include-sources" directive to scripts/bench.pl.  This
allows for including source code (vs including headers, which might get
a different search path) after the inclusion of any headers.
Diffstat (limited to 'scripts/bench.pl')
-rwxr-xr-xscripts/bench.pl22
1 files changed, 18 insertions, 4 deletions
diff --git a/scripts/bench.pl b/scripts/bench.pl
index 5fe95d0c2f..492ab816ed 100755
--- a/scripts/bench.pl
+++ b/scripts/bench.pl
@@ -34,7 +34,8 @@ my $getret = "";
 my $variant = "";
 my @curvals;
 my %vals;
-my @include_files;
+my @include_headers;
+my @include_sources;
 my $incl;
 
 open INPUTS, "<$func-inputs" or die $!;
@@ -43,7 +44,7 @@ LINE:while (<INPUTS>) {
   chomp;
 
   # Directives.
-  if (/^## (\w+): (.*)/) {
+  if (/^## ([\w-]+): (.*)/) {
     # Function argument types.
     if ($1 eq "args") {
       @args = split(":", $2);
@@ -55,7 +56,11 @@ LINE:while (<INPUTS>) {
     }
 
     elsif ($1 eq "includes") {
-      @include_files = split (",", $2);
+      @include_headers = split (",", $2);
+    }
+
+    elsif ($1 eq "include-sources") {
+      @include_sources = split (",", $2);
     }
 
     # New variant.  This is the only directive allowed in the body of the
@@ -72,6 +77,10 @@ LINE:while (<INPUTS>) {
       undef @curvals;
       next LINE;
     }
+
+    else {
+      die "Unknown directive: ".$1;
+    }
   }
 
   # Skip over comments.
@@ -86,10 +95,15 @@ my $bench_func = "#define CALL_BENCH_FUNC(v, i) $func (";
 
 
 # Print the definitions and macros.
-foreach $incl (@include_files) {
+foreach $incl (@include_headers) {
   print "#include <" . $incl . ">\n";
 }
 
+# Print the source files.
+foreach $incl (@include_sources) {
+  print "#include \"" . $incl . "\"\n";
+}
+
 if (@args > 0) {
   # Save values in the last variant.
   $vals{$variant} = \@curvals;