This is the mail archive of the
libstdc++@sourceware.cygnus.com
mailing list for the libstdc++ project.
unGNUifying mkcheck
- To: libstdc++ at sourceware dot cygnus dot com
- Subject: unGNUifying mkcheck
- From: Phil Edwards <pedwards at jaj dot com>
- Date: Wed, 10 Nov 1999 18:31:43 -0500
Even though we're a ways from timing tests and tuning, there is code in the
testsuite script to do that checking; unfortunately it breaks on non-Linux
boxes. Anyone not interested in that script can stop reading. :-)
In the testsuite results I just posted, I mentioned that 'date +%s' will not
work on Suns[*], because %s is unique to GNU date as far as I can determine.
How about if we build a tiny program to print that time_t value as part of
the script, and call it instead? The patch below does that, and the program
itself is appended (I couldn't get it to show up as a diff against an empty
file via cvs).
This patch fixes one other not-quite-a-problem: bash isn't installed on some
of our platforms (yeah, I know it's heresy :-) so the script only runs on
two-thirds of our machines. A couple simple changes to arithmetic evaluation
syntax makes it a ksh script, which is shipped on just about everything.
Phil
[*] Or recent IRIX and dUnix/Tru64; I stopped testing after that.
1999-11-10 Phil Edwards <pedwards@jaj.com>
* mkcheck: kshified, use timestamping utility...
* testsuite/now.c: ...which is here.
Index: mkcheck
===================================================================
RCS file: /cvs/libstdc++/libstdc++/mkcheck,v
retrieving revision 1.10
diff -u -3 -r1.10 mkcheck
--- mkcheck 1999/07/29 04:22:45 1.10
+++ mkcheck 1999/11/10 22:43:55
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/bin/ksh
# 1999-07-19 bkoz
# Script to do automated testing and data collection for
@@ -113,6 +113,14 @@
rm -rf "$TEST_DIR/*exe"
rm -rf "$TEST_DIR/core" "$TEST_DIR/*core"
+# Build simple timestamping utility
+# (Choice of "now.exe" name might cause confusion with actual .exe tests...?)
+if test ! -f $TEST_DIR/now.exe; then
+ echo "making $TEST_DIR/now.exe"
+ gcc -o $TEST_DIR/now.exe $SRC_DIR/testsuite/now.c
+ strip $TEST_DIR/now.exe
+fi
+
# Copy over the data files for filebufs in read-only mode
cp $SRC_DIR/testsuite/27_io/*.txt $TEST_DIR
@@ -124,7 +132,7 @@
echo "p == pass/fail execution test" >> $RESULTS_FILE
echo "ctime == time to compile and link" >> $RESULTS_FILE
-echo "ctime == time for executable to run" >> $RESULTS_FILE
+echo "etime == time for executable to run" >> $RESULTS_FILE
echo "text == size of the executable text section" >> $RESULTS_FILE
echo "data == size of the executable data section" >> $RESULTS_FILE
echo "total == size of the executable" >> $RESULTS_FILE
@@ -154,12 +162,12 @@
SH_NAME="`echo $PRE_NAME | sed 's/cc$/sh-exe/'`"
CNAME="$SRC_DIR/testsuite/$NAME"
- COMP_TIME_START="$(date +%s)"
+ COMP_TIME_START="$($TEST_DIR/now.exe)"
g++ $CXX_FLAG $ST_FLAG $INC_PATH $LIB_PATH $CNAME -o $ST_NAME 2>> $LOG_FILE
- COMP_TIME_END="$(date +%s)"
+ COMP_TIME_END="$($TEST_DIR/now.exe)"
if [ $COMP_TIME_START -lt $COMP_TIME_END ]; then
- C_TIME=$[ $COMP_TIME_END - $COMP_TIME_START ]
+ C_TIME=$(( $COMP_TIME_END - $COMP_TIME_START ))
else
C_TIME="0"
fi
===================================================================
/* Prints the current time_t to stdout. Equivalent to the nonstandard
* %s format option to GNU date(1).
*/
#include <sys/types.h>
#include <stdio.h>
#include <time.h>
int main ()
{
printf ("%lu\n", time(NULL));
exit(0);
}
===================================================================