+2006-08-19 Aaron Bockover <abockover@novell.com>
+
+ * test/driver.c: added -n mode to show only raw global run times,
+ which is useful for scripts (test-both --speed-compare)
+
+ * test/test-both: added --speed-compare mode
+
+ * test/README: updated with information on --speed-compare
+
2006-08-19 Aaron Bockover <abockover@novell.com>
* test/test.c: do not print times if -t is not passed
The 'test-both' script can be used to run both test-eglib and test-glib
with the same options back to back:
- $./test-both -tqi 100000 ptrarray
+ $ ./test-both -tqi 100000 ptrarray
EGlib Total Time: 1.1961s
GLib Total Time: 0.955957s
+test-both also has a nice --speed-compare mode that shows comparison
+information about EGlib vs GLib. It can run all tests or specific tests
+with a configurable number of iterations. --speed-compare mode always runs
+the drivers with -qtni
+
+The syntax for --speed-compare is:
+
+ ./test-both --speed-compare [ITERATIONS] [GROUPS...]
+
+ $ ./test-both --speed-compare Runs all tests with default iterations
+ $ ./test-both --speed-compare 500 Runs all tests with 500 iterations
+ $ ./test-both --speed-compare ptrarray Runs ptrarray test with default
+ iterations
+
+
printf(" -t, --time time the tests\n");
printf(" -i, --iterations number of times to run tests\n");
printf(" -q, --quiet do not print test results; "
- "time always prints\n\n");
+ "final time always prints\n");
+ printf(" -n print final time without labels, "
+ "nice for scripts\n\n");
printf("TESTGROUPS available:\n");
for(i = 0; test_groups[i].name != NULL; i++) {
gboolean report_time = FALSE;
gboolean quiet = FALSE;
gboolean global_failure = FALSE;
+ gboolean no_final_time_labels = FALSE;
static struct option long_options [] = {
{"help", no_argument, 0, 'h'},
{0, 0, 0, 0}
};
- while((c = getopt_long(argc, argv, "htqi:", long_options, NULL)) != -1) { switch(c) {
+ while((c = getopt_long(argc, argv, "htqni:", long_options, NULL)) != -1) { switch(c) {
case 'h':
print_help(argv[0]);
return 1;
case 'q':
quiet = TRUE;
break;
+ case 'n':
+ no_final_time_labels = TRUE;
+ break;
}
}
if(report_time) {
gdouble duration = get_timestamp() - time_start;
- printf("%s Total Time: %g\n", DRIVER_NAME, duration);
+ if(no_final_time_labels) {
+ printf("%g\n", duration);
+ } else {
+ printf("%s Total Time: %g\n", DRIVER_NAME, duration);
+ }
}
if(tests_to_run != NULL) {
#!/bin/sh
+if [ "x$1" = "x--speed-compare" ]; then
+ ITERATIONS=100000
+ if [ ! -z "$2" ]; then
+ case $2 in
+ *[0-9]*) ITERATIONS=$2; break;
+ esac
+ fi
+
+ OPTIONS="-qnti $ITERATIONS"
+
+ for arg in $@; do
+ if [ "x$arg" = "x--speed-compare" ]; then
+ continue;
+ elif [ "$arg" = "$ITERATIONS" ]; then
+ continue;
+ fi
+
+ OPTIONS="$OPTIONS $arg"
+ done
+
+ echo "Running tests with $OPTIONS..."
+
+ GLIB=`./test-glib $OPTIONS`
+ EGLIB=`./test-eglib $OPTIONS`
+
+ # this blows
+ FASTER_NAME=`echo "$GLIB GLib $EGLIB EGlib" | awk '{ if($1 < $3) print $2; else print $4 }'`
+ FASTER_SPEED=`echo "$GLIB $EGLIB" | awk '{ if($1 < $2) print $1; else print $2 }'`
+ SLOWER_NAME=`echo "$GLIB GLib $EGLIB EGlib" | awk '{ if($1 > $3) print $2; else print $4 }'`
+ SLOWER_SPEED=`echo "$GLIB $EGLIB" | awk '{ if($1 > $2) print $1; else print $2 }'`
+
+ FASTER_PERCENTAGE=`echo "$SLOWER_SPEED $FASTER_SPEED" | awk '{ print ($1 / $2) * 100 }'`
+
+ echo "$FASTER_NAME $FASTER_SPEED"
+ echo "$SLOWER_NAME $SLOWER_SPEED"
+ echo "------------------------------------------------"
+ echo "$FASTER_NAME is $FASTER_PERCENTAGE% faster than $SLOWER_NAME"
+
+ exit 0;
+fi
+
./test-eglib $@
./test-glib $@