diff options
author | Andrew J. Schorr <aschorr@telemetry-investments.com> | 2012-06-10 21:03:48 -0400 |
---|---|---|
committer | Andrew J. Schorr <aschorr@telemetry-investments.com> | 2012-06-10 21:03:48 -0400 |
commit | 7891af5ec56ff4ed99435433c135079a9e24e037 (patch) | |
tree | 994abc90c1152c80dba150a3efe9859466e603b5 /test | |
parent | 18e7a6250a5daa170729a2adbc6b9d71f75f2bb5 (diff) | |
download | egawk-7891af5ec56ff4ed99435433c135079a9e24e037.tar.gz egawk-7891af5ec56ff4ed99435433c135079a9e24e037.tar.bz2 egawk-7891af5ec56ff4ed99435433c135079a9e24e037.zip |
Add time extension providing gettimeofday and sleep.
Diffstat (limited to 'test')
-rw-r--r-- | test/ChangeLog | 6 | ||||
-rw-r--r-- | test/Makefile.am | 4 | ||||
-rw-r--r-- | test/Makefile.in | 9 | ||||
-rw-r--r-- | test/Maketests | 5 | ||||
-rw-r--r-- | test/time.awk | 12 | ||||
-rw-r--r-- | test/time.ok | 3 |
6 files changed, 37 insertions, 2 deletions
diff --git a/test/ChangeLog b/test/ChangeLog index c4ac50de..72a7c9ff 100644 --- a/test/ChangeLog +++ b/test/ChangeLog @@ -1,3 +1,9 @@ +2012-06-10 Andrew J. Schorr <aschorr@telemetry-investments.com> + + * Makefile.am (EXTRA_DIST): Add new files time.awk and time.ok. + (SHLIB_TESTS): Add time. + * time.awk, time.ok: New files. + 2012-05-29 Arnold D. Robbins <arnold@skeeve.com> * Makefile.am (clean): Add readfile.ok to list of files to removed. diff --git a/test/Makefile.am b/test/Makefile.am index 348d4df2..6c65ae3c 100644 --- a/test/Makefile.am +++ b/test/Makefile.am @@ -757,6 +757,8 @@ EXTRA_DIST = \ synerr1.ok \ synerr2.awk \ synerr2.ok \ + time.awk \ + time.ok \ tradanch.awk \ tradanch.in \ tradanch.ok \ @@ -882,7 +884,7 @@ LOCALE_CHARSET_TESTS = \ asort asorti fmttest fnarydel fnparydl lc_num1 mbfw1 \ mbprintf1 mbprintf2 mbprintf3 rebt8b2 rtlenmb sort1 sprintfc -SHLIB_TESTS = ordchr ordchr2 fork fork2 readfile filefuncs +SHLIB_TESTS = ordchr ordchr2 fork fork2 readfile filefuncs time # List of the tests which should be run with --lint option: NEED_LINT = \ diff --git a/test/Makefile.in b/test/Makefile.in index 0afe5e05..2ec90244 100644 --- a/test/Makefile.in +++ b/test/Makefile.in @@ -969,6 +969,8 @@ EXTRA_DIST = \ synerr1.ok \ synerr2.awk \ synerr2.ok \ + time.awk \ + time.ok \ tradanch.awk \ tradanch.in \ tradanch.ok \ @@ -1090,7 +1092,7 @@ LOCALE_CHARSET_TESTS = \ asort asorti fmttest fnarydel fnparydl lc_num1 mbfw1 \ mbprintf1 mbprintf2 mbprintf3 rebt8b2 rtlenmb sort1 sprintfc -SHLIB_TESTS = ordchr ordchr2 fork fork2 readfile filefuncs +SHLIB_TESTS = ordchr ordchr2 fork fork2 readfile filefuncs time # List of the tests which should be run with --lint option: NEED_LINT = \ @@ -3179,6 +3181,11 @@ filefuncs: @AWKPATH=$(srcdir) $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ @-$(CMP) $(srcdir)/$@.ok _$@ && rm -f _$@ +time: + @echo $@ + @AWKPATH=$(srcdir) $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ + @-$(CMP) $(srcdir)/$@.ok _$@ && rm -f _$@ + # end of file Maketests # Targets generated for other tests: diff --git a/test/Maketests b/test/Maketests index 6856b870..64cd8e71 100644 --- a/test/Maketests +++ b/test/Maketests @@ -1219,4 +1219,9 @@ filefuncs: @AWKPATH=$(srcdir) $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ @-$(CMP) $(srcdir)/$@.ok _$@ && rm -f _$@ +time: + @echo $@ + @AWKPATH=$(srcdir) $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ + @-$(CMP) $(srcdir)/$@.ok _$@ && rm -f _$@ + # end of file Maketests diff --git a/test/time.awk b/test/time.awk new file mode 100644 index 00000000..eeabc7bb --- /dev/null +++ b/test/time.awk @@ -0,0 +1,12 @@ +@load "time" + +BEGIN { + delta = 1.3 + printf "gettimeofday - systime = %d\n", (t0 = gettimeofday())-systime() + printf "sleep(%s) = %s\n",delta,sleep(delta) + printf "gettimeofday - systime = %d\n", (t1 = gettimeofday())-systime() + slept = t1-t0 + if ((slept < 0.9*delta) || (slept > 1.3*delta)) + printf "Warning: tried to sleep %.2f secs, but slept for %.2f secs\n", + delta,slept +} diff --git a/test/time.ok b/test/time.ok new file mode 100644 index 00000000..46606bfe --- /dev/null +++ b/test/time.ok @@ -0,0 +1,3 @@ +gettimeofday - systime = 0 +sleep(1.3) = 0 +gettimeofday - systime = 0 |