Skip to content

Commit

Permalink
Sometimes timestamps are duplicated... to be investigated...
Browse files Browse the repository at this point in the history
  • Loading branch information
Christian Ferrari committed Jun 6, 2016
1 parent 0deb65a commit c2cf5ce
Show file tree
Hide file tree
Showing 10 changed files with 141 additions and 28 deletions.
6 changes: 6 additions & 0 deletions ChangeLog
Original file line number Diff line number Diff line change
@@ -1,4 +1,10 @@
LOG:

- 1.3.3 (unique) timestamp resource
Implementation of timestamp resources:
_t_<format>[number] where format uses the same syntax used by format
(second parameter) of the strftime function

20160512 - 1.3.2 (Unique) sequence resource (API support)
Implementation of
flom_handle_unlock_rollback (C, PHP, Python API)
Expand Down
3 changes: 2 additions & 1 deletion README
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ This is a brief list of the available features:
3. numerical: pools of undifferentiated resources
4. set: sets of differentiated resources
5. sequence: arrays of transactional (or non transactional) sequences
6. timestamp: arrays of unique timestamp sequences

FLoM central documentation site is hosted by SourceForge Wiki:
https://sourceforge.net/p/flom/wiki/Home/
Expand Down Expand Up @@ -121,7 +122,7 @@ If you need some help (usage tricks, hints, etc...) please post a message in
the forum: http://sourceforge.net/p/flom/discussion/
If you think you have discovered a bug, please open an issue here:
https://github.com/tiian/flom/issues
If you avoided to send me an e-mail I would be happy: forum posts and tickets
If you avoid to send me an e-mail I will be happy: forum posts and tickets
can be seen by many people and I should not answer the same questions many
times.

Expand Down
7 changes: 5 additions & 2 deletions TODO
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
Road map:

check resource timestamp with parallel requests (2 or more clients): see how
queing works
Use case 19 (6/6) generates duplicates... :(
cat testsuite.dir/001/stdout | grep '^tmstmp'
cat testsuite.dir/001/stdout | grep '^tmstmp' | sort -u
cat testsuite.dir/001/stdout | grep '^tmstmp' | sort -u | wc -l

unique timestamps (no two equal timestamps supplied): use a date like expression
to describe the sequence; for example:
Expand All @@ -14,6 +16,7 @@ case tests for timestamp resources:
- format that does not change at least once per hour

document supported format specifiers: flom_resource_timestamp_init
create a wiki page for the different resources: syntax and brief usage


fix PHP for Ubuntu 16.04, see https://github.com/tiian/flom/issues/5
Expand Down
20 changes: 10 additions & 10 deletions configure
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#! /bin/sh
# Guess values for system-dependent variables and create Makefiles.
# Generated by GNU Autoconf 2.65 for FLoM 1.3.3-dev.
# Generated by GNU Autoconf 2.65 for FLoM 1.3.3-alpha.
#
# Report bugs to <tiian at users dot sourceforge dot net>.
#
Expand Down Expand Up @@ -701,8 +701,8 @@ MAKEFLAGS=
# Identity of this package.
PACKAGE_NAME='FLoM'
PACKAGE_TARNAME='flom'
PACKAGE_VERSION='1.3.3-dev'
PACKAGE_STRING='FLoM 1.3.3-dev'
PACKAGE_VERSION='1.3.3-alpha'
PACKAGE_STRING='FLoM 1.3.3-alpha'
PACKAGE_BUGREPORT='tiian at users dot sourceforge dot net'
PACKAGE_URL='http://sourceforge.net/projects/flom/'

Expand Down Expand Up @@ -1537,7 +1537,7 @@ if test "$ac_init_help" = "long"; then
# Omit some internal or obsolete options to make the list less imposing.
# This message is too long to be a string in the A/UX 3.1 sh.
cat <<_ACEOF
\`configure' configures FLoM 1.3.3-dev to adapt to many kinds of systems.
\`configure' configures FLoM 1.3.3-alpha to adapt to many kinds of systems.

Usage: $0 [OPTION]... [VAR=VALUE]...

Expand Down Expand Up @@ -1607,7 +1607,7 @@ fi

if test -n "$ac_init_help"; then
case $ac_init_help in
short | recursive ) echo "Configuration of FLoM 1.3.3-dev:";;
short | recursive ) echo "Configuration of FLoM 1.3.3-alpha:";;
esac
cat <<\_ACEOF

Expand Down Expand Up @@ -1733,7 +1733,7 @@ fi
test -n "$ac_init_help" && exit $ac_status
if $ac_init_version; then
cat <<\_ACEOF
FLoM configure 1.3.3-dev
FLoM configure 1.3.3-alpha
generated by GNU Autoconf 2.65

Copyright (C) 2009 Free Software Foundation, Inc.
Expand Down Expand Up @@ -2457,7 +2457,7 @@ cat >config.log <<_ACEOF
This file contains any messages produced by compilers while
running configure, to aid debugging if configure makes a mistake.

It was created by FLoM $as_me 1.3.3-dev, which was
It was created by FLoM $as_me 1.3.3-alpha, which was
generated by GNU Autoconf 2.65. Invocation command line was

$ $0 $@
Expand Down Expand Up @@ -3265,7 +3265,7 @@ fi

# Define the identity of the package.
PACKAGE='flom'
VERSION='1.3.3-dev'
VERSION='1.3.3-alpha'


cat >>confdefs.h <<_ACEOF
Expand Down Expand Up @@ -18572,7 +18572,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
# report actual input values of CONFIG_FILES etc. instead of their
# values after options handling.
ac_log="
This file was extended by FLoM $as_me 1.3.3-dev, which was
This file was extended by FLoM $as_me 1.3.3-alpha, which was
generated by GNU Autoconf 2.65. Invocation command line was

CONFIG_FILES = $CONFIG_FILES
Expand Down Expand Up @@ -18639,7 +18639,7 @@ _ACEOF
cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`"
ac_cs_version="\\
FLoM config.status 1.3.3-dev
FLoM config.status 1.3.3-alpha
configured by $0, generated by GNU Autoconf 2.65,
with options \\"\$ac_cs_config\\"

Expand Down
2 changes: 1 addition & 1 deletion configure.ac
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
AC_INIT([FLoM], [1.3.3-dev], [tiian at users dot sourceforge dot net], [], [http://sourceforge.net/projects/flom/])
AC_INIT([FLoM], [1.3.3-alpha], [tiian at users dot sourceforge dot net], [], [http://sourceforge.net/projects/flom/])
AM_INIT_AUTOMAKE([-Wall -Werror])

AC_PROG_LIBTOOL
Expand Down
11 changes: 4 additions & 7 deletions tests/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,9 @@ EXTRA_DIST = $(TESTSUITE) atlocal.in \
usecase-hier.at \
usecase-lt.at.in \
usecase-num.at.in \
usecase-seq.at.in \
usecase-seq.at \
usecase-set.at.in \
usecase-tms.at \
scripts/*.sh

api.at: api.at.in
Expand Down Expand Up @@ -108,11 +109,6 @@ usecase-num.at: usecase-num.at.in
-e 's|@_ES_RESOURCE_BUSY[@]|$(_ES_RESOURCE_BUSY)|g' \
$< >$@

usecase-seq.at: usecase-seq.at.in
sed \
-e 's|@_ES_RESOURCE_BUSY[@]|$(_ES_RESOURCE_BUSY)|g' \
$< >$@

usecase-set.at: usecase-set.at.in
sed \
-e 's|@_ES_RESOURCE_BUSY[@]|$(_ES_RESOURCE_BUSY)|g' \
Expand Down Expand Up @@ -157,7 +153,8 @@ $(TESTSUITE): $(srcdir)/package.m4 \
$(srcdir)/usecase-hier.at \
$(srcdir)/usecase-num.at \
$(srcdir)/usecase-seq.at \
$(srcdir)/usecase-set.at
$(srcdir)/usecase-set.at \
$(srcdir)/usecase-tms.at
$(AUTOTEST) -I '$(srcdir)' -o $@.tmp $@.at
mv $@.tmp $@

Expand Down
11 changes: 4 additions & 7 deletions tests/Makefile.in
Original file line number Diff line number Diff line change
Expand Up @@ -319,8 +319,9 @@ EXTRA_DIST = $(TESTSUITE) atlocal.in \
usecase-hier.at \
usecase-lt.at.in \
usecase-num.at.in \
usecase-seq.at.in \
usecase-seq.at \
usecase-set.at.in \
usecase-tms.at \
scripts/*.sh

TESTSUITE = $(srcdir)/testsuite
Expand Down Expand Up @@ -769,11 +770,6 @@ usecase-num.at: usecase-num.at.in
-e 's|@_ES_RESOURCE_BUSY[@]|$(_ES_RESOURCE_BUSY)|g' \
$< >$@

usecase-seq.at: usecase-seq.at.in
sed \
-e 's|@_ES_RESOURCE_BUSY[@]|$(_ES_RESOURCE_BUSY)|g' \
$< >$@

usecase-set.at: usecase-set.at.in
sed \
-e 's|@_ES_RESOURCE_BUSY[@]|$(_ES_RESOURCE_BUSY)|g' \
Expand Down Expand Up @@ -813,7 +809,8 @@ $(TESTSUITE): $(srcdir)/package.m4 \
$(srcdir)/usecase-hier.at \
$(srcdir)/usecase-num.at \
$(srcdir)/usecase-seq.at \
$(srcdir)/usecase-set.at
$(srcdir)/usecase-set.at \
$(srcdir)/usecase-tms.at
$(AUTOTEST) -I '$(srcdir)' -o $@.tmp $@.at
mv $@.tmp $@

Expand Down
1 change: 1 addition & 0 deletions tests/testsuite.at
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ AT_INIT
AT_COPYRIGHT([Copyright (c) 2013-2016, Christian Ferrari <tiian@users.sourceforge.net>])
AT_COLOR_TESTS

m4_include([usecase-tms.at])
m4_include([cmdopt.at])
m4_include([incompopt.at])
m4_include([debug-features.at])
Expand Down
File renamed without changes.
108 changes: 108 additions & 0 deletions tests/usecase-tms.at
Original file line number Diff line number Diff line change
@@ -0,0 +1,108 @@
AT_BANNER([Timestamp resources use case checks])

# unique timestamp, hundredth of a second
AT_SETUP([Use case 19 (6/6)])
AT_DATA([expout],
[[5
]])
AT_CHECK([pkill flom], [ignore], [ignore], [ignore])
AT_CHECK([flom_test_exec5.sh 1 0 1 0 "-i 1000 -r _t_tmstmp%S#ff[3]" >>stdout &], [0], [ignore], [ignore])
AT_CHECK([flom_test_exec5.sh 1 0 1 0 "-i 1000 -r _t_tmstmp%S#ff[3]" >>stdout &], [0], [ignore], [ignore])
AT_CHECK([flom_test_exec5.sh 1 0 1 0 "-i 1000 -r _t_tmstmp%S#ff[3]" >>stdout &], [0], [ignore], [ignore])
AT_CHECK([flom_test_exec5.sh 1 0 1 0 "-i 1000 -r _t_tmstmp%S#ff[3]" >>stdout &], [0], [ignore], [ignore])
# we must be sure, this flom command will be executed as the last one!
AT_CHECK([sleep 1], [0], [ignore], [ignore])
AT_CHECK([flom_test_exec5.sh 1 0 1 0 "-i 1000 -r _t_tmstmp%S#ff[3]" >>stdout], [0], [ignore], [ignore])
AT_CHECK([cat stdout | grep '^tmstmp' | sort -u | wc -l], [0], [expout], [ignore])
AT_CLEANUP

# Generate a basic timestamp: 1, 2, 3!
AT_SETUP([Use case 19 (1/6)])
AT_DATA([expout],
[[ 1 locking for 0 seconds
1 ending
2 locking for 0 seconds
2 ending
3 locking for 0 seconds
3 ending
]])
AT_CHECK([pkill flom], [ignore], [ignore], [ignore])
AT_CHECK([flom_test_exec4.sh 1 0 0 "-i 1000 -r _t_tmstmp%S#f[1]" >>stdout], [0], [ignore], [ignore])
AT_CHECK([flom_test_exec4.sh 2 0 0 "-i 1000 -r _t_tmstmp%S#f[1]" >>stdout], [0], [ignore], [ignore])
AT_CHECK([flom_test_exec4.sh 3 0 0 "-i 1000 -r _t_tmstmp%S#f[1]" >>stdout], [0], [ignore], [ignore])
AT_CHECK([cat stdout | grep -v '^tmstmp'], [0], [expout], [ignore])
AT_CLEANUP

# Lock on a timestamp
AT_SETUP([Use case 19 (2/6)])
AT_DATA([expout],
[[ 1 locking for 2 seconds
2 locking for 2 seconds
3 locking for 1 seconds
1 ending
4 locking for 0 seconds
2 ending
3 ending
4 ending
]])
AT_CHECK([pkill flom], [ignore], [ignore], [ignore])
AT_CHECK([flom_test_exec4.sh 1 0 2 "-i 1000 -r _t_tmstmp%S[[1]]" >>stdout &], [0], [ignore], [ignore])
AT_CHECK([flom_test_exec4.sh 2 1 2 "-i 1000 -r _t_tmstmp%S[[1]]" >>stdout &], [0], [ignore], [ignore])
AT_CHECK([flom_test_exec4.sh 3 2 1 "-i 1000 -r _t_tmstmp%S[[1]]" >>stdout &], [0], [ignore], [ignore])
AT_CHECK([flom_test_exec4.sh 4 3 0 "-i 1000 -r _t_tmstmp%S[[1]]" >>stdout], [0], [ignore], [ignore])
AT_CHECK([cat stdout | grep -v '^tmstmp'], [0], [expout], [ignore])
AT_CLEANUP

# Multiple timestamp
AT_SETUP([Use case 19 (3/6)])
AT_DATA([expout],
[[ 1 locking for 6 seconds
2 locking for 3 seconds
3 locking for 5 seconds
4 locking for 1 seconds
2 ending
4 ending
1 ending
3 ending
5 locking for 0 seconds
5 ending
]])
AT_CHECK([pkill flom], [ignore], [ignore], [ignore])
AT_CHECK([flom_test_exec5.sh 1 0 6 0 "-r _t_tmstmp%S#ff[3]" >>stdout &], [0], [ignore], [ignore])
AT_CHECK([flom_test_exec5.sh 2 1 3 1 "-r _t_tmstmp%S#ff[3]" >>stdout &], [0], [ignore], [ignore])
AT_CHECK([flom_test_exec5.sh 3 2 5 0 "-r _t_tmstmp%S#ff[3]" >>stdout &], [0], [ignore], [ignore])
AT_CHECK([flom_test_exec5.sh 4 3 1 0 "-r _t_tmstmp%S#ff[3]" >>stdout &], [0], [ignore], [ignore])
AT_CHECK([flom_test_exec5.sh 5 8 0 0 "-r _t_tmstmp%S#ff[3]" >>stdout], [0], [ignore], [ignore])
AT_CHECK([cat stdout | grep -v '^tmstmp'], [0], [expout], [ignore])
AT_CLEANUP

# unique timestamp, second
AT_SETUP([Use case 19 (4/6)])
AT_DATA([expout],
[[3
]])
AT_CHECK([pkill flom], [ignore], [ignore], [ignore])
AT_CHECK([flom_test_exec5.sh 1 0 1 0 "-i 1000 -r _t_tmstmp%S[[3]]" >>stdout &], [0], [ignore], [ignore])
AT_CHECK([flom_test_exec5.sh 1 0 1 0 "-i 1000 -r _t_tmstmp%S[[3]]" >>stdout &], [0], [ignore], [ignore])
# we must be sure, this flom command will be executed as the last one!
AT_CHECK([sleep 1], [0], [ignore], [ignore])
AT_CHECK([flom_test_exec5.sh 1 0 1 0 "-i 1000 -r _t_tmstmp%S[[3]]" >>stdout], [0], [ignore], [ignore])
AT_CHECK([cat stdout | grep '^tmstmp' | sort -u | wc -l], [0], [expout], [ignore])
AT_CLEANUP

# unique timestamp, tenth of a second
AT_SETUP([Use case 19 (5/6)])
AT_DATA([expout],
[[5
]])
AT_CHECK([pkill flom], [ignore], [ignore], [ignore])
AT_CHECK([flom_test_exec5.sh 1 0 1 0 "-i 1000 -r _t_tmstmp%S#f[3]" >>stdout &], [0], [ignore], [ignore])
AT_CHECK([flom_test_exec5.sh 1 0 1 0 "-i 1000 -r _t_tmstmp%S#f[3]" >>stdout &], [0], [ignore], [ignore])
AT_CHECK([flom_test_exec5.sh 1 0 1 0 "-i 1000 -r _t_tmstmp%S#f[3]" >>stdout &], [0], [ignore], [ignore])
AT_CHECK([flom_test_exec5.sh 1 0 1 0 "-i 1000 -r _t_tmstmp%S#f[3]" >>stdout &], [0], [ignore], [ignore])
# we must be sure, this flom command will be executed as the last one!
AT_CHECK([sleep 1], [0], [ignore], [ignore])
AT_CHECK([flom_test_exec5.sh 1 0 1 0 "-i 1000 -r _t_tmstmp%S#f[3]" >>stdout], [0], [ignore], [ignore])
AT_CHECK([cat stdout | grep '^tmstmp' | sort -u | wc -l], [0], [expout], [ignore])
AT_CLEANUP

0 comments on commit c2cf5ce

Please sign in to comment.