Modify wordcount so that timer information appears on standard error instead
of standard output. Rename the run-wordcount.bash script to run-wordcount.sh and simplify it so that it stands a better chance of running on non-GNU systems. FossilOrigin-Name: 586c11ed7cc6b8e2c7181231e37791c2fbc95272
This commit is contained in:
parent
d673cddad6
commit
7a909855f2
14
manifest
14
manifest
@ -1,5 +1,5 @@
|
||||
C Do\snot\sreuse\sfactored\sconstants\sthat\smight\shave\shad\stheir\sencodings\schanged.
|
||||
D 2013-11-21T21:23:31.703
|
||||
C Modify\swordcount\sso\sthat\stimer\sinformation\sappears\son\sstandard\serror\sinstead\nof\sstandard\soutput.\s\sRename\sthe\srun-wordcount.bash\sscript\sto\srun-wordcount.sh\nand\ssimplify\sit\sso\sthat\sit\sstands\sa\sbetter\schance\sof\srunning\son\snon-GNU\s\nsystems.
|
||||
D 2013-11-21T21:40:45.620
|
||||
F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f
|
||||
F Makefile.in 8a07bebafbfda0eb67728f4bd15a36201662d1a1
|
||||
F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23
|
||||
@ -758,7 +758,7 @@ F test/rollback.test e9504a009a202c3ed711da2e6879ff60c5a4669c
|
||||
F test/rowhash.test 0bc1d31415e4575d10cacf31e1a66b5cc0f8be81
|
||||
F test/rowid.test f777404492adb0e00868fd706a3721328fd3af48
|
||||
F test/rtree.test 0c8d9dd458d6824e59683c19ab2ffa9ef946f798
|
||||
F test/run-wordcount.bash 1c6a8b75738db8c53e5125be3d81ab63ef9eefd0
|
||||
F test/run-wordcount.sh 891e89c4c2d16e629cd45951d4ed899ad12afc09 w test/run-wordcount.bash
|
||||
F test/savepoint.test 6c53f76dffe5df0dd87646efe3e7aa159c36e07b
|
||||
F test/savepoint2.test 9b8543940572a2f01a18298c3135ad0c9f4f67d7
|
||||
F test/savepoint3.test e328085853b14898d78ceea00dfe7db18bb6a9ec
|
||||
@ -1089,7 +1089,7 @@ F test/without_rowid1.test aaa26da19d543cd8d3d2d0e686dfa255556c15c8
|
||||
F test/without_rowid2.test af260339f79d13cb220288b67cd287fbcf81ad99
|
||||
F test/without_rowid3.test eac3d5c8a1924725b58503a368f2cbd24fd6c8a0
|
||||
F test/without_rowid4.test 4e08bcbaee0399f35d58b5581881e7a6243d458a
|
||||
F test/wordcount.c a42341b7a01229782b9bd97ff2eeebae830adbea
|
||||
F test/wordcount.c 6ce4090a90cd4a34b7cf7f8969c033cedab72399
|
||||
F test/zeroblob.test caaecfb4f908f7bc086ed238668049f96774d688
|
||||
F test/zerodamage.test 209d7ed441f44cc5299e4ebffbef06fd5aabfefd
|
||||
F tool/build-all-msvc.bat 1bac6adc3fdb4d9204f21d17b14be25778370e48 x
|
||||
@ -1141,7 +1141,7 @@ F tool/vdbe-compress.tcl f12c884766bd14277f4fcedcae07078011717381
|
||||
F tool/warnings-clang.sh f6aa929dc20ef1f856af04a730772f59283631d4
|
||||
F tool/warnings.sh d1a6de74685f360ab718efda6265994b99bbea01
|
||||
F tool/win/sqlite.vsix 030f3eeaf2cb811a3692ab9c14d021a75ce41fff
|
||||
P 882622662dfadf49c65c7d80b7fd87533d079ce9
|
||||
R 919d251b93f214648dcb5abd041a55e3
|
||||
P 487f20366ce77f0c90865d10d5aaedd95af98694
|
||||
R 24abe371fb3b49f56b9cb321d5c8bf3d
|
||||
U drh
|
||||
Z 333bbe2ad90c7a14f3cc2f1f3886517e
|
||||
Z e03360c4606d03267f7f33fe62a05d71
|
||||
|
@ -1 +1 @@
|
||||
487f20366ce77f0c90865d10d5aaedd95af98694
|
||||
586c11ed7cc6b8e2c7181231e37791c2fbc95272
|
@ -1,66 +0,0 @@
|
||||
#!/bin/bash
|
||||
#
|
||||
# This script runs the wordcount program in different ways, comparing
|
||||
# the output from each.
|
||||
#
|
||||
|
||||
|
||||
# Run the wordcount command with argument supplied and with --summary.
|
||||
# Store the results in wc-out.txt and report the run-time.
|
||||
#
|
||||
function time_wordcount {
|
||||
/usr/bin/time --format='%e %C' ./wordcount --summary $* >wc-out.txt
|
||||
}
|
||||
|
||||
# Compare wc-out.txt against wc-baseline.txt and report any differences.
|
||||
#
|
||||
function compare_results {
|
||||
if cmp -s wc-out.txt wc-baseline.txt;
|
||||
then echo hi >/dev/null;
|
||||
else echo ERROR:;
|
||||
diff -u wc-baseline.txt wc-out.txt;
|
||||
fi
|
||||
}
|
||||
|
||||
# Select the source text to be analyzed.
|
||||
#
|
||||
if test "x$1" = "x";
|
||||
then echo "Usage: $0 FILENAME [ARGS...]"; exit 1;
|
||||
fi
|
||||
|
||||
# Do test runs
|
||||
#
|
||||
rm -f wcdb1.db
|
||||
time_wordcount wcdb1.db $* --insert
|
||||
mv wc-out.txt wc-baseline.txt
|
||||
rm -f wcdb2.db
|
||||
time_wordcount wcdb2.db $* --insert --without-rowid
|
||||
compare_results
|
||||
|
||||
rm -f wcdb1.db
|
||||
time_wordcount wcdb1.db $* --replace
|
||||
compare_results
|
||||
rm -f wcdb2.db
|
||||
time_wordcount wcdb2.db $* --replace --without-rowid
|
||||
compare_results
|
||||
|
||||
rm -f wcdb1.db
|
||||
time_wordcount wcdb1.db $* --select
|
||||
compare_results
|
||||
rm -f wcdb2.db
|
||||
time_wordcount wcdb2.db $* --select --without-rowid
|
||||
compare_results
|
||||
|
||||
time_wordcount wcdb1.db $* --query
|
||||
mv wc-out.txt wc-baseline.txt
|
||||
time_wordcount wcdb2.db $* --query --without-rowid
|
||||
compare_results
|
||||
|
||||
time_wordcount wcdb1.db $* --delete
|
||||
mv wc-out.txt wc-baseline.txt
|
||||
time_wordcount wcdb2.db $* --delete --without-rowid
|
||||
compare_results
|
||||
|
||||
# Clean up temporary files created.
|
||||
#
|
||||
rm -rf wcdb1.db wcdb2.db wc-out.txt wc-baseline.txt
|
78
test/run-wordcount.sh
Normal file
78
test/run-wordcount.sh
Normal file
@ -0,0 +1,78 @@
|
||||
#!/bin/sh
|
||||
#
|
||||
# This script runs the wordcount program in different ways, comparing
|
||||
# the output from each.
|
||||
#
|
||||
|
||||
# Select the source text to be analyzed.
|
||||
#
|
||||
if test "x$1" = "x";
|
||||
then echo "Usage: $0 FILENAME [ARGS...]"; exit 1;
|
||||
fi
|
||||
|
||||
# Do test runs
|
||||
#
|
||||
rm -f wcdb1.db
|
||||
./wordcount --timer --summary wcdb1.db $* --insert >wc-out.txt
|
||||
mv wc-out.txt wc-baseline.txt
|
||||
rm -f wcdb2.db
|
||||
./wordcount --timer --summary wcdb2.db $* --insert --without-rowid >wc-out.txt
|
||||
if cmp -s wc-out.txt wc-baseline.txt;
|
||||
then echo hi >/dev/null;
|
||||
else echo ERROR:;
|
||||
diff -u wc-baseline.txt wc-out.txt;
|
||||
fi
|
||||
|
||||
rm -f wcdb1.db
|
||||
./wordcount --timer --summary wcdb1.db $* --replace >wc-out.txt
|
||||
if cmp -s wc-out.txt wc-baseline.txt;
|
||||
then echo hi >/dev/null;
|
||||
else echo ERROR:;
|
||||
diff -u wc-baseline.txt wc-out.txt;
|
||||
fi
|
||||
rm -f wcdb2.db
|
||||
./wordcount --timer --summary wcdb2.db $* --replace --without-rowid >wc-out.txt
|
||||
if cmp -s wc-out.txt wc-baseline.txt;
|
||||
then echo hi >/dev/null;
|
||||
else echo ERROR:;
|
||||
diff -u wc-baseline.txt wc-out.txt;
|
||||
fi
|
||||
|
||||
rm -f wcdb1.db
|
||||
./wordcount --timer --summary wcdb1.db $* --select >wc-out.txt
|
||||
if cmp -s wc-out.txt wc-baseline.txt;
|
||||
then echo hi >/dev/null;
|
||||
else echo ERROR:;
|
||||
diff -u wc-baseline.txt wc-out.txt;
|
||||
fi
|
||||
|
||||
rm -f wcdb2.db
|
||||
./wordcount --timer --summary wcdb2.db $* --select --without-rowid >wc-out.txt
|
||||
if cmp -s wc-out.txt wc-baseline.txt;
|
||||
then echo hi >/dev/null;
|
||||
else echo ERROR:;
|
||||
diff -u wc-baseline.txt wc-out.txt;
|
||||
fi
|
||||
|
||||
./wordcount --timer --summary wcdb1.db $* --query >wc-out.txt
|
||||
mv wc-out.txt wc-baseline.txt
|
||||
./wordcount --timer --summary wcdb2.db $* --query --without-rowid >wc-out.txt
|
||||
if cmp -s wc-out.txt wc-baseline.txt;
|
||||
then echo hi >/dev/null;
|
||||
else echo ERROR:;
|
||||
diff -u wc-baseline.txt wc-out.txt;
|
||||
fi
|
||||
|
||||
./wordcount --timer --summary wcdb1.db $* --delete >wc-out.txt
|
||||
mv wc-out.txt wc-baseline.txt
|
||||
./wordcount --timer --summary wcdb2.db $* --delete --without-rowid >wc-out.txt
|
||||
if cmp -s wc-out.txt wc-baseline.txt;
|
||||
then echo hi >/dev/null;
|
||||
else echo ERROR:;
|
||||
diff -u wc-baseline.txt wc-out.txt;
|
||||
fi
|
||||
|
||||
|
||||
# Clean up temporary files created.
|
||||
#
|
||||
rm -rf wcdb1.db wcdb2.db wc-out.txt wc-baseline.txt
|
@ -473,9 +473,10 @@ int main(int argc, char **argv){
|
||||
|
||||
if( showTimer ){
|
||||
sqlite3_int64 elapseTime = realTime() - startTime;
|
||||
printf("/* %3d.%03d", (int)(elapseTime/1000), (int)(elapseTime%1000));
|
||||
for(i=0; i<argc; i++) if( i!=showTimer ) printf(" %s", argv[i]);
|
||||
printf(" */\n");
|
||||
fprintf(stderr, "%3d.%03d", (int)(elapseTime/1000),
|
||||
(int)(elapseTime%1000));
|
||||
for(i=0; i<argc; i++) if( i!=showTimer ) fprintf(stderr, " %s", argv[i]);
|
||||
fprintf(stderr, "\n");
|
||||
}
|
||||
|
||||
if( showSummary ){
|
||||
|
Loading…
Reference in New Issue
Block a user