aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPeter Seebach <peter.seebach@windriver.com>2014-01-22 15:45:34 -0600
committerPeter Seebach <peter.seebach@windriver.com>2014-01-22 15:45:34 -0600
commitd2c02ae49366523e1d1c5ce0d2a32624a0eedfa1 (patch)
treef58377709d066477df6f7b54f70b1662eb746ee6
parente199ed80a0a67a2135d419e169ba378621dd55bd (diff)
downloadpseudo-d2c02ae49366523e1d1c5ce0d2a32624a0eedfa1.tar.gz
pseudo-d2c02ae49366523e1d1c5ce0d2a32624a0eedfa1.tar.bz2
pseudo-d2c02ae49366523e1d1c5ce0d2a32624a0eedfa1.zip
some minor tweaks to the performance test
-rw-r--r--ChangeLog.txt3
-rw-r--r--makedata.c4
-rwxr-xr-xperftest35
3 files changed, 29 insertions, 13 deletions
diff --git a/ChangeLog.txt b/ChangeLog.txt
index 87f3f9f..2256375 100644
--- a/ChangeLog.txt
+++ b/ChangeLog.txt
@@ -1,3 +1,6 @@
+2014-01-15:
+ * (seebs) performance test/test case updates.
+
2013-06-20:
* (seebs) refactor debugging code
* (seebs) start using 1.5.2 numbering
diff --git a/makedata.c b/makedata.c
index a3f9a86..d3f5ed9 100644
--- a/makedata.c
+++ b/makedata.c
@@ -9,10 +9,10 @@ main(void) {
char name[] = "dir_%d/dir_%d/%d%d.txt";
for (i = 0; i < 10; ++i) {
snprintf(name, sizeof(name), "dir_%d", i);
- mkdir(name);
+ mkdir(name, 0755);
for (j = 0; j < 40; ++j) {
snprintf(name, sizeof(name), "dir_%d/dir_%d", i, j);
- mkdir(name);
+ mkdir(name, 0755);
for (k = 0; k < 10; ++k) {
for (l = 0; l < 10; ++l) {
FILE *fp;
diff --git a/perftest b/perftest
index 55cb0cb..97dced1 100755
--- a/perftest
+++ b/perftest
@@ -1,5 +1,19 @@
#!/bin/sh
# do a quick performance test of pseudo
+opt_f=false
+flag_f=
+
+while getopts "f" o
+do
+ case $o in
+ f) opt_f=true
+ flag_f=-f
+ ;;
+ \?) die "Usage: perftest [-f] [directory]";;
+ esac;
+done
+shift `expr $OPTIND - 1`
+
die() {
printf "%s\n" "$*" >&2
exit 1
@@ -20,25 +34,24 @@ doit() (
[ -x bin/pseudo ] || die "You need a bin/pseudo to test."
case $# in
0) dir="perftest.d";;
-1) [ -d "$1" ] || die "Specify an existing directory to test in."
+1) [ -d "$1" ] || die "Specify an existing directory to test in. '%s' is not a directory." "$1"
dir="$1/perftest.d"
;;
*) die "Usage: perftest [directory]"
;;
esac
-case `id -u` in
-0) printf "%s\n" "Running test."
+if $opt_f || [ `id -u` = x0 ]; then
+ printf "Running test in %s.\n" "$dir"
doit
- printf "%s\n" "Done."
- ;;
-*) [ -d $dir ] && die "$dir directory already exists, delete it if you're done."
+ printf "Done.\n"
+else
+ [ -d $dir ] && die "Directory '$dir' already exists, delete it if you're done."
mkdir $dir
- mkdir $dir/new
+ mkdir -p $dir/new
cc -o $dir/makedata makedata.c
printf "%s\n" "Running performance test (total time at end)"
- time bin/pseudo ./perftest $1
+ time bin/pseudo ./perftest -f ${dir%perftest.d}
rm -rf $dir
- rm -f makedata
- ;;
-esac
+fi
+