* [LTP] [PATCH v2 1/2] lib/test.sh: Remove temporary directory only if we know the location
@ 2017-07-18 14:24 Petr Vorel
2017-07-18 14:25 ` [LTP] [PATCH v2 2/2] doc: Cleanup typo Petr Vorel
2017-07-19 15:30 ` [LTP] [PATCH v2 1/2] lib/test.sh: Remove temporary directory only if we know the location Cyril Hrubis
0 siblings, 2 replies; 5+ messages in thread
From: Petr Vorel @ 2017-07-18 14:24 UTC (permalink / raw)
To: ltp
This is a problem when a test TCONF before calling tst_tmpdir, but has
tst_rmdir in cleanup function (e.g. dhcp_lib.sh when failing on
tst_check_cmds).
Now it has the same behaviour as deleting $TST_TMPDIR in tst_do_exit
in tst_test.sh.
Signed-off-by: Petr Vorel <pvorel@suse.cz>
---
Ping old commit:
Changes v1->v2: just commit message.
---
testcases/lib/test.sh | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/testcases/lib/test.sh b/testcases/lib/test.sh
index 642f7eacf..d16444efa 100644
--- a/testcases/lib/test.sh
+++ b/testcases/lib/test.sh
@@ -132,8 +132,10 @@ tst_tmpdir()
tst_rmdir()
{
- cd "$LTPROOT"
- rm -r "$TST_TMPDIR"
+ if [ -n "$TST_TMPDIR" ]; then
+ cd "$LTPROOT"
+ rm -r "$TST_TMPDIR"
+ fi
}
#
--
2.13.2
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [LTP] [PATCH v2 2/2] doc: Cleanup typo
2017-07-18 14:24 [LTP] [PATCH v2 1/2] lib/test.sh: Remove temporary directory only if we know the location Petr Vorel
@ 2017-07-18 14:25 ` Petr Vorel
2017-07-19 15:21 ` Cyril Hrubis
2017-07-19 15:30 ` [LTP] [PATCH v2 1/2] lib/test.sh: Remove temporary directory only if we know the location Cyril Hrubis
1 sibling, 1 reply; 5+ messages in thread
From: Petr Vorel @ 2017-07-18 14:25 UTC (permalink / raw)
To: ltp
From: Petr Vorel <petr.vorel@gmail.com>
Signed-off-by: Petr Vorel <pvorel@suse.cz>
---
Just to prevent copy & paste error for people reading our wiki.
---
doc/test-writing-guidelines.txt | 2 +-
lib/tst_resource.c | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/doc/test-writing-guidelines.txt b/doc/test-writing-guidelines.txt
index 479c24e8c..ed6322b02 100644
--- a/doc/test-writing-guidelines.txt
+++ b/doc/test-writing-guidelines.txt
@@ -215,7 +215,7 @@ The path is constructed according to these rules:
1. if '$LTPROOT' is set, return '$LTPROOT/testcases/data/$TCID'
2. else if 'tst_tmpdir()' was called return '$STARTWD/datafiles'
- (where '$STARTWD' is initial working directory as recorded by 'tst_tmdir()')
+ (where '$STARTWD' is initial working directory as recorded by 'tst_tmpdir()')
3. else return '$CWD/datafiles'
See 'testcases/commands/file/' for example.
diff --git a/lib/tst_resource.c b/lib/tst_resource.c
index 78450df53..0b9b381f1 100644
--- a/lib/tst_resource.c
+++ b/lib/tst_resource.c
@@ -46,7 +46,7 @@ static void tst_dataroot_init(void)
int ret;
/* 1. if LTPROOT is set, use $LTPROOT/testcases/data/$TCID
- * 2. else if startwd is set by tst_tmdir(), use $STARWD/datafiles
+ * 2. else if startwd is set by tst_tmpdir(), use $STARWD/datafiles
* 3. else use $CWD/datafiles */
if (ltproot) {
ret = snprintf(dataroot, PATH_MAX, "%s/testcases/data/%s",
--
2.13.2
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [LTP] [PATCH v2 2/2] doc: Cleanup typo
2017-07-18 14:25 ` [LTP] [PATCH v2 2/2] doc: Cleanup typo Petr Vorel
@ 2017-07-19 15:21 ` Cyril Hrubis
0 siblings, 0 replies; 5+ messages in thread
From: Cyril Hrubis @ 2017-07-19 15:21 UTC (permalink / raw)
To: ltp
Hi!
Pushed, thanks.
--
Cyril Hrubis
chrubis@suse.cz
^ permalink raw reply [flat|nested] 5+ messages in thread
* [LTP] [PATCH v2 1/2] lib/test.sh: Remove temporary directory only if we know the location
2017-07-18 14:24 [LTP] [PATCH v2 1/2] lib/test.sh: Remove temporary directory only if we know the location Petr Vorel
2017-07-18 14:25 ` [LTP] [PATCH v2 2/2] doc: Cleanup typo Petr Vorel
@ 2017-07-19 15:30 ` Cyril Hrubis
2017-07-24 7:00 ` Petr Vorel
1 sibling, 1 reply; 5+ messages in thread
From: Cyril Hrubis @ 2017-07-19 15:30 UTC (permalink / raw)
To: ltp
Hi!
> This is a problem when a test TCONF before calling tst_tmpdir, but has
> tst_rmdir in cleanup function (e.g. dhcp_lib.sh when failing on
> tst_check_cmds).
I was wondering if we should produce at least TINFO message that
something is probably wrong with the cleanup function, but nobody would
read that unless we used TWARN.
So I guess that the patch is OK as it is, pushed, thanks.
--
Cyril Hrubis
chrubis@suse.cz
^ permalink raw reply [flat|nested] 5+ messages in thread
* [LTP] [PATCH v2 1/2] lib/test.sh: Remove temporary directory only if we know the location
2017-07-19 15:30 ` [LTP] [PATCH v2 1/2] lib/test.sh: Remove temporary directory only if we know the location Cyril Hrubis
@ 2017-07-24 7:00 ` Petr Vorel
0 siblings, 0 replies; 5+ messages in thread
From: Petr Vorel @ 2017-07-24 7:00 UTC (permalink / raw)
To: ltp
Hi Cyril,
> Hi!
> > This is a problem when a test TCONF before calling tst_tmpdir, but has
> > tst_rmdir in cleanup function (e.g. dhcp_lib.sh when failing on
> > tst_check_cmds).
> I was wondering if we should produce at least TINFO message that
> something is probably wrong with the cleanup function, but nobody would
> read that unless we used TWARN.
Actually I think it's a good idea to put TWARN. That would indeed help to us to catch
errors in scripts.
> So I guess that the patch is OK as it is, pushed, thanks.
Thanks!
Kind regards,
Petr
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2017-07-24 7:00 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-07-18 14:24 [LTP] [PATCH v2 1/2] lib/test.sh: Remove temporary directory only if we know the location Petr Vorel
2017-07-18 14:25 ` [LTP] [PATCH v2 2/2] doc: Cleanup typo Petr Vorel
2017-07-19 15:21 ` Cyril Hrubis
2017-07-19 15:30 ` [LTP] [PATCH v2 1/2] lib/test.sh: Remove temporary directory only if we know the location Cyril Hrubis
2017-07-24 7:00 ` Petr Vorel
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.