[Ocfs2-test-devel] [PATCH 46/59] multiple-runner: make testcase return right value
Eric Ren
zren at suse.com
Tue Sep 22 22:45:17 PDT 2015
Reviewed-by: Eric Ren <zren at suse.com>
Thanks,
Eric Ren
On Mon, Sep 14, 2015 at 10:44:32AM +0800, Junxiao Bi wrote:
> Some testcase are not returning the right value to
> represent its status, fix it. Also use ">>" to replace
> "tee -a" as the second one will overwrite the return
> value of the test.
>
> Signed-off-by: Junxiao Bi <junxiao.bi at oracle.com>
> ---
> programs/create_racer/run_create_racer.py | 10 +++++-----
> programs/flock_tests/run_flock_unit_test.py | 4 +++-
> programs/lvb_torture/run_lvb_torture.py | 2 +-
> programs/multi_node_mmap/run_multi_mmap.py | 10 +++++-----
> programs/quota_tests/run_quota_multi_tests.py | 4 +++-
> .../run_write_append_truncate.py | 10 +++++-----
> 6 files changed, 22 insertions(+), 18 deletions(-)
>
> diff --git a/programs/create_racer/run_create_racer.py b/programs/create_racer/run_create_racer.py
> index a1efe98..ed66522 100644
> --- a/programs/create_racer/run_create_racer.py
> +++ b/programs/create_racer/run_create_racer.py
> @@ -54,7 +54,7 @@ Usage = '\n %prog [-c|--count] \
> #
> # FUNCTIONS
> #
> -def Cleanup():
> +def Cleanup(ret):
> from os import access, F_OK
> for i in range(options.count):
> filename = options.path+'/create_racer:'+str(i).zfill(6)
> @@ -64,7 +64,7 @@ def Cleanup():
> 'filename (%s)' % filename,
> logfile, 0, '')
> os.system('rm -f %s' % filename)
> - sys.exit()
> + sys.exit(ret)
> #
> # MAIN
> #
> @@ -150,11 +150,11 @@ if DEBUGON:
> logfile, 0, '')
> #
> if options.cleanup:
> - Cleanup()
> + Cleanup(0)
> o2tf.OpenMPIInit(DEBUGON, options.nodelist, logfile, 'ssh')
> #
> ret = o2tf.openmpi_run(DEBUGON, procs,
> - str('%s -i %s %s 2>&1 | tee -a %s' % (cmd,
> + str('%s -i %s %s 2>&1 >> %s' % (cmd,
> options.count,
> options.path,
> options.logfile)),
> @@ -167,4 +167,4 @@ ret = o2tf.openmpi_run(DEBUGON, procs,
> if not ret:
> o2tf.printlog('run_create_racer: main - execution successful.',
> logfile, 0, '')
> -Cleanup()
> +Cleanup(ret)
> diff --git a/programs/flock_tests/run_flock_unit_test.py b/programs/flock_tests/run_flock_unit_test.py
> index 9fde207..b842f08 100644
> --- a/programs/flock_tests/run_flock_unit_test.py
> +++ b/programs/flock_tests/run_flock_unit_test.py
> @@ -148,7 +148,7 @@ if DEBUGON:
> o2tf.OpenMPIInit(DEBUGON, options.nodelist, logfile, 'ssh')
> #
> ret = o2tf.openmpi_run(DEBUGON, procs,
> - str('%s %s %s %s 2>&1 | tee -a %s' % (cmd,
> + str('%s %s %s %s 2>&1 >> %s' % (cmd,
> type_arg,
> file1_arg,
> file2_arg,
> @@ -162,3 +162,5 @@ ret = o2tf.openmpi_run(DEBUGON, procs,
> if not ret:
> o2tf.printlog('flock_unit_test: main - execution successful.',
> logfile, 0, '')
> +
> +sys.exit(ret)
> diff --git a/programs/lvb_torture/run_lvb_torture.py b/programs/lvb_torture/run_lvb_torture.py
> index b56b5d5..348a8c9 100755
> --- a/programs/lvb_torture/run_lvb_torture.py
> +++ b/programs/lvb_torture/run_lvb_torture.py
> @@ -158,7 +158,7 @@ if DEBUGON:
> o2tf.OpenMPIInit(DEBUGON, options.nodelist, logfile, 'ssh')
> #
> ret = o2tf.openmpi_run(DEBUGON, procs,
> - str('%s -d %s %s -i %s %s %s 2>&1 | tee -a %s' % (cmd,
> + str('%s -d %s %s -i %s %s %s 2>&1 >> %s' % (cmd,
> dlmfs,
> hbdev,
> count,
> diff --git a/programs/multi_node_mmap/run_multi_mmap.py b/programs/multi_node_mmap/run_multi_mmap.py
> index 23aac13..7de4b02 100644
> --- a/programs/multi_node_mmap/run_multi_mmap.py
> +++ b/programs/multi_node_mmap/run_multi_mmap.py
> @@ -60,7 +60,7 @@ Usage = """
> #
> # FUNCTIONS
> #
> -def Cleanup():
> +def Cleanup(ret):
> from os import access, F_OK
> filename = options.filename
> if access(filename,F_OK) == 1:
> @@ -68,7 +68,7 @@ def Cleanup():
> o2tf.printlog('multi_mmap: Removing filename (%s)'
> % filename, logfile, 0, '')
> os.system('rm -f %s' % filename)
> - sys.exit()
> + sys.exit(ret)
> #
> # MAIN
> #
> @@ -251,11 +251,11 @@ if DEBUGON:
> logfile, 0, '')
> #
> if options.cleanup:
> - Cleanup()
> + Cleanup(0)
> o2tf.OpenMPIInit(DEBUGON, options.nodelist, logfile, 'ssh')
> #
> ret = o2tf.openmpi_run(DEBUGON, procs,
> - str('%s %s %s %s %s %s %s %s %s %s 2>&1 | tee -a %s' % (cmd,
> + str('%s %s %s %s %s %s %s %s %s %s 2>&1 >> %s' % (cmd,
> truncate_arg,
> cache_arg,
> reader_arg,
> @@ -275,4 +275,4 @@ ret = o2tf.openmpi_run(DEBUGON, procs,
> if not ret:
> o2tf.printlog('run_multi_mmap: main - execution successful.',
> logfile, 0, '')
> -Cleanup()
> +Cleanup(ret)
> diff --git a/programs/quota_tests/run_quota_multi_tests.py b/programs/quota_tests/run_quota_multi_tests.py
> index e002b97..8a58b72 100755
> --- a/programs/quota_tests/run_quota_multi_tests.py
> +++ b/programs/quota_tests/run_quota_multi_tests.py
> @@ -159,7 +159,7 @@ if DEBUGON:
> o2tf.OpenMPIInit(DEBUGON, options.nodelist, logfile, 'rsh')
> #
> ret = o2tf.openmpi_run(DEBUGON, procs,
> - str('%s %s %s %s %s %s 2>&1 | tee -a %s' % (cmd,
> + str('%s %s %s %s %s %s 2>&1 >> %s' % (cmd,
> iter_arg,
> user_arg,
> group_arg,
> @@ -174,3 +174,5 @@ ret = o2tf.openmpi_run(DEBUGON, procs,
> if not ret:
> o2tf.printlog('quota_multi_test: main - execution successful.',
> logfile, 0, '')
> +
> +sys.exit(ret)
> diff --git a/programs/write_append_truncate/run_write_append_truncate.py b/programs/write_append_truncate/run_write_append_truncate.py
> index 60f3739..c2a6f42 100644
> --- a/programs/write_append_truncate/run_write_append_truncate.py
> +++ b/programs/write_append_truncate/run_write_append_truncate.py
> @@ -52,7 +52,7 @@ Usage = """
> #
> # FUNCTIONS
> #
> -def Cleanup():
> +def Cleanup(ret):
> from os import access, F_OK
> filename = options.filename
> if access(filename,F_OK) == 1:
> @@ -60,7 +60,7 @@ def Cleanup():
> o2tf.printlog('write_append_truncate: Removing filename (%s)'
> % filename, logfile, 0, '')
> os.system('rm -f %s' % filename)
> - sys.exit()
> + sys.exit(ret)
> #
> # MAIN
> #
> @@ -149,11 +149,11 @@ if DEBUGON:
> logfile, 0, '')
> #
> if options.cleanup:
> - Cleanup()
> + Cleanup(0)
> o2tf.OpenMPIInit(DEBUGON, options.nodelist, logfile, 'ssh')
> #
> ret = o2tf.openmpi_run(DEBUGON, procs,
> - str('%s %s %s 2>&1 | tee -a %s' % (cmd,
> + str('%s %s %s 2>&1 >> %s' % (cmd,
> filename,
> nloops,
> logfile)),
> @@ -166,4 +166,4 @@ ret = o2tf.openmpi_run(DEBUGON, procs,
> if not ret:
> o2tf.printlog('write_append_truncate: main - execution successful.',
> logfile, 0, '')
> -Cleanup()
> +Cleanup(ret)
> --
> 1.7.9.5
>
>
> _______________________________________________
> Ocfs2-test-devel mailing list
> Ocfs2-test-devel at oss.oracle.com
> https://oss.oracle.com/mailman/listinfo/ocfs2-test-devel
>
More information about the Ocfs2-test-devel
mailing list