about summary refs log tree commit diff
path: root/math/gen-libm-test.pl
diff options
context:
space:
mode:
authorJakub Jelinek <jakub@redhat.com>2007-07-12 18:26:36 +0000
committerJakub Jelinek <jakub@redhat.com>2007-07-12 18:26:36 +0000
commit0ecb606cb6cf65de1d9fc8a919bceb4be476c602 (patch)
tree2ea1f8305970753e4a657acb2ccc15ca3eec8e2c /math/gen-libm-test.pl
parent7d58530341304d403a6626d7f7a1913165fe2f32 (diff)
downloadglibc-0ecb606cb6cf65de1d9fc8a919bceb4be476c602.tar.gz
glibc-0ecb606cb6cf65de1d9fc8a919bceb4be476c602.tar.xz
glibc-0ecb606cb6cf65de1d9fc8a919bceb4be476c602.zip
2.5-18.1
Diffstat (limited to 'math/gen-libm-test.pl')
-rwxr-xr-xmath/gen-libm-test.pl19
1 files changed, 11 insertions, 8 deletions
diff --git a/math/gen-libm-test.pl b/math/gen-libm-test.pl
index 26f819a884..0b0b8ca19f 100755
--- a/math/gen-libm-test.pl
+++ b/math/gen-libm-test.pl
@@ -1,5 +1,5 @@
 #!/usr/bin/perl -w
-# Copyright (C) 1999 Free Software Foundation, Inc.
+# Copyright (C) 1999, 2006 Free Software Foundation, Inc.
 # This file is part of the GNU C Library.
 # Contributed by Andreas Jaeger <aj@suse.de>, 1999.
 
@@ -234,7 +234,7 @@ sub special_functions {
 
 # Parse the arguments to TEST_x_y
 sub parse_args {
-  my ($file, $descr, $args) = @_;
+  my ($file, $descr, $fct, $args) = @_;
   my (@args, $str, $descr_args, $descr_res, @descr);
   my ($current_arg, $cline, $i);
   my ($pre, $post, @special);
@@ -248,7 +248,7 @@ sub parse_args {
 
   @args = split /,\s*/, $args;
 
-  $call = "$args[0] (";
+  $call = "$fct (";
 
   # Generate first the string that's shown to the user
   $current_arg = 1;
@@ -423,7 +423,7 @@ sub parse_args {
 sub generate_testfile {
   my ($input, $output) = @_;
   my ($lasttext);
-  my (@args, $i, $str);
+  my (@args, $i, $str, $thisfct);
 
   open INPUT, $input or die ("Can't open $input: $!");
   open OUTPUT, ">$output" or die ("Can't open $output: $!");
@@ -436,11 +436,12 @@ sub generate_testfile {
       my ($descr, $args);
       chop;
       ($descr, $args) = ($_ =~ /TEST_(\w+)\s*\((.*)\)/);
-      &parse_args (\*OUTPUT, $descr, $args);
+      &parse_args (\*OUTPUT, $descr, $thisfct, $args);
       next;
     }
     # START (function)
     if (/START/) {
+      ($thisfct) = ($_ =~ /START\s*\((.*)\)/);
       print OUTPUT "  init_max_error ();\n";
       next;
     }
@@ -557,9 +558,11 @@ sub parse_ulps {
 sub clean_up_number {
   my ($number) = @_;
 
-  # Remove trailing zeros
-  $number =~ s/0+$//;
-  $number =~ s/\.$//;
+  # Remove trailing zeros after the decimal point
+  if ($number =~ /\./) {
+    $number =~ s/0+$//;
+    $number =~ s/\.$//;
+  }
   return $number;
 }