* [LTP] [PATCH 1/2 v2] checkpoints: introduce TST_CHECKPOINT_CREATE
@ 2014-10-06 14:55 Jan Stancek
2014-10-06 14:55 ` [LTP] [PATCH 2/2 v2] checkpoints: fix usage in children started via exec Jan Stancek
2014-10-07 0:43 ` [LTP] [PATCH 1/2 v2] checkpoints: introduce TST_CHECKPOINT_CREATE Wanlong Gao
0 siblings, 2 replies; 6+ messages in thread
From: Jan Stancek @ 2014-10-06 14:55 UTC (permalink / raw)
To: ltp-list
Rename tst_checkpoint_init to tst_checkpoint_create.
Add tst_checkpoint_init, which only initializes checkpoint struct.
Update existing testcases to use TST_CHECKPOINT_CREATE.
Signed-off-by: Jan Stancek <jstancek@redhat.com>
---
include/tst_checkpoint.h | 10 ++++++++--
lib/tests/tst_checkpoint_child.c | 2 +-
lib/tests/tst_checkpoint_child_exits.c | 2 +-
lib/tests/tst_checkpoint_no_child.c | 2 +-
lib/tests/tst_checkpoint_parent.c | 2 +-
lib/tests/tst_checkpoint_parent_exits.c | 2 +-
lib/tst_checkpoint.c | 20 ++++++++++++++------
.../kernel/containers/mountns/mountns_helper.h | 4 ++--
testcases/kernel/syscalls/creat/creat07.c | 2 +-
testcases/kernel/syscalls/flock/flock03.c | 2 +-
testcases/kernel/syscalls/setpgid/setpgid03.c | 2 +-
testcases/kernel/syscalls/waitid/waitid02.c | 2 +-
12 files changed, 33 insertions(+), 19 deletions(-)
diff --git a/include/tst_checkpoint.h b/include/tst_checkpoint.h
index 4d04c0e..6ea3366 100644
--- a/include/tst_checkpoint.h
+++ b/include/tst_checkpoint.h
@@ -51,10 +51,16 @@ struct tst_checkpoint {
* Checkpoint initializaton, must be done first.
*/
#define TST_CHECKPOINT_INIT(self) \
- tst_checkpoint_init(__FILE__, __LINE__, self)
+ tst_checkpoint_init(__FILE__, __LINE__, self)
void tst_checkpoint_init(const char *file, const int lineno,
- struct tst_checkpoint *self);
+ struct tst_checkpoint *self);
+
+#define TST_CHECKPOINT_CREATE(self) \
+ tst_checkpoint_create(__FILE__, __LINE__, self)
+
+void tst_checkpoint_create(const char *file, const int lineno,
+ struct tst_checkpoint *self);
/*
* Wait called from parent. In case parent waits for child.
diff --git a/lib/tests/tst_checkpoint_child.c b/lib/tests/tst_checkpoint_child.c
index 9ce93f5..a13a9a2 100644
--- a/lib/tests/tst_checkpoint_child.c
+++ b/lib/tests/tst_checkpoint_child.c
@@ -35,7 +35,7 @@ int main(void)
tst_tmpdir();
- TST_CHECKPOINT_INIT(&checkpoint);
+ TST_CHECKPOINT_CREATE(&checkpoint);
pid = fork();
diff --git a/lib/tests/tst_checkpoint_child_exits.c b/lib/tests/tst_checkpoint_child_exits.c
index 3488ba2..d2e3f74 100644
--- a/lib/tests/tst_checkpoint_child_exits.c
+++ b/lib/tests/tst_checkpoint_child_exits.c
@@ -35,7 +35,7 @@ int main(void)
tst_tmpdir();
- TST_CHECKPOINT_INIT(&checkpoint);
+ TST_CHECKPOINT_CREATE(&checkpoint);
pid = fork();
diff --git a/lib/tests/tst_checkpoint_no_child.c b/lib/tests/tst_checkpoint_no_child.c
index fcf2745..2e72198 100644
--- a/lib/tests/tst_checkpoint_no_child.c
+++ b/lib/tests/tst_checkpoint_no_child.c
@@ -39,7 +39,7 @@ int main(void)
tst_tmpdir();
- TST_CHECKPOINT_INIT(&checkpoint);
+ TST_CHECKPOINT_CREATE(&checkpoint);
TST_CHECKPOINT_SIGNAL_CHILD(cleanup, &checkpoint);
fprintf(stderr, "Parent: checkpoint reached\n");
diff --git a/lib/tests/tst_checkpoint_parent.c b/lib/tests/tst_checkpoint_parent.c
index a2ae621..a42b37a 100644
--- a/lib/tests/tst_checkpoint_parent.c
+++ b/lib/tests/tst_checkpoint_parent.c
@@ -35,7 +35,7 @@ int main(void)
tst_tmpdir();
- TST_CHECKPOINT_INIT(&checkpoint);
+ TST_CHECKPOINT_CREATE(&checkpoint);
pid = fork();
diff --git a/lib/tests/tst_checkpoint_parent_exits.c b/lib/tests/tst_checkpoint_parent_exits.c
index 59c5356..3056c2c 100644
--- a/lib/tests/tst_checkpoint_parent_exits.c
+++ b/lib/tests/tst_checkpoint_parent_exits.c
@@ -35,7 +35,7 @@ int main(void)
tst_tmpdir();
- TST_CHECKPOINT_INIT(&checkpoint);
+ TST_CHECKPOINT_CREATE(&checkpoint);
pid = fork();
diff --git a/lib/tst_checkpoint.c b/lib/tst_checkpoint.c
index 7391a28..ebc379e 100644
--- a/lib/tst_checkpoint.c
+++ b/lib/tst_checkpoint.c
@@ -74,12 +74,6 @@ void tst_checkpoint_init(const char *file, const int lineno,
static unsigned int fifo_counter = 0;
int rval;
- if (!tst_tmpdir_created()) {
- tst_brkm(TBROK, NULL, "Checkpoint could be used only in test "
- "temporary directory at %s:%d",
- file, lineno);
- }
-
/* default values */
rval = snprintf(self->file, TST_FIFO_LEN, "tst_checkopoint_fifo_%u",
fifo_counter++);
@@ -90,6 +84,20 @@ void tst_checkpoint_init(const char *file, const int lineno,
}
self->retval = 1;
self->timeout = 5000;
+}
+
+void tst_checkpoint_create(const char *file, const int lineno,
+ struct tst_checkpoint *self)
+
+{
+
+ if (!tst_tmpdir_created()) {
+ tst_brkm(TBROK, NULL, "Checkpoint could be used only in test "
+ "temporary directory at %s:%d",
+ file, lineno);
+ }
+
+ tst_checkpoint_init(file, lineno, self);
if (mkfifo(self->file, 0666)) {
tst_brkm(TBROK | TERRNO, NULL,
diff --git a/testcases/kernel/containers/mountns/mountns_helper.h b/testcases/kernel/containers/mountns/mountns_helper.h
index cb9c16d..d4a6a91 100644
--- a/testcases/kernel/containers/mountns/mountns_helper.h
+++ b/testcases/kernel/containers/mountns/mountns_helper.h
@@ -57,8 +57,8 @@ static void setup(void)
tst_require_root(NULL);
check_newns();
tst_tmpdir();
- TST_CHECKPOINT_INIT(&checkpoint1);
- TST_CHECKPOINT_INIT(&checkpoint2);
+ TST_CHECKPOINT_CREATE(&checkpoint1);
+ TST_CHECKPOINT_CREATE(&checkpoint2);
SAFE_MKDIR(cleanup, DIRA, 0777);
SAFE_MKDIR(cleanup, DIRB, 0777);
SAFE_TOUCH(cleanup, DIRA"/A", 0, NULL);
diff --git a/testcases/kernel/syscalls/creat/creat07.c b/testcases/kernel/syscalls/creat/creat07.c
index a9f5253..4b8958f 100644
--- a/testcases/kernel/syscalls/creat/creat07.c
+++ b/testcases/kernel/syscalls/creat/creat07.c
@@ -108,7 +108,7 @@ static void setup(char *app)
TST_RESOURCE_COPY(cleanup, TEST_APP, NULL);
- TST_CHECKPOINT_INIT(&checkpoint);
+ TST_CHECKPOINT_CREATE(&checkpoint);
TEST_PAUSE;
}
diff --git a/testcases/kernel/syscalls/flock/flock03.c b/testcases/kernel/syscalls/flock/flock03.c
index b2734b5..446dc84 100644
--- a/testcases/kernel/syscalls/flock/flock03.c
+++ b/testcases/kernel/syscalls/flock/flock03.c
@@ -186,7 +186,7 @@ static void setup(void)
tst_tmpdir();
- TST_CHECKPOINT_INIT(&checkpoint);
+ TST_CHECKPOINT_CREATE(&checkpoint);
fd = creat(FILE_NAME, 0666);
if (fd < 0) {
diff --git a/testcases/kernel/syscalls/setpgid/setpgid03.c b/testcases/kernel/syscalls/setpgid/setpgid03.c
index a107c50..c1b9951 100644
--- a/testcases/kernel/syscalls/setpgid/setpgid03.c
+++ b/testcases/kernel/syscalls/setpgid/setpgid03.c
@@ -155,7 +155,7 @@ static void setup(void)
tst_tmpdir();
- TST_CHECKPOINT_INIT(&checkpoint);
+ TST_CHECKPOINT_CREATE(&checkpoint);
checkpoint.timeout = 10000;
umask(0);
diff --git a/testcases/kernel/syscalls/waitid/waitid02.c b/testcases/kernel/syscalls/waitid/waitid02.c
index 6259fa3..d497b6b 100644
--- a/testcases/kernel/syscalls/waitid/waitid02.c
+++ b/testcases/kernel/syscalls/waitid/waitid02.c
@@ -240,7 +240,7 @@ static void setup(void)
{
TEST_PAUSE;
tst_tmpdir();
- TST_CHECKPOINT_INIT(&checkpoint);
+ TST_CHECKPOINT_CREATE(&checkpoint);
}
static void cleanup(void)
--
1.7.1
------------------------------------------------------------------------------
Slashdot TV. Videos for Nerds. Stuff that Matters.
http://pubads.g.doubleclick.net/gampad/clk?id=160591471&iu=/4140/ostg.clktrk
_______________________________________________
Ltp-list mailing list
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list
^ permalink raw reply related [flat|nested] 6+ messages in thread* [LTP] [PATCH 2/2 v2] checkpoints: fix usage in children started via exec
2014-10-06 14:55 [LTP] [PATCH 1/2 v2] checkpoints: introduce TST_CHECKPOINT_CREATE Jan Stancek
@ 2014-10-06 14:55 ` Jan Stancek
2014-10-07 0:45 ` Wanlong Gao
2014-10-07 11:50 ` Cyril Hrubis
2014-10-07 0:43 ` [LTP] [PATCH 1/2 v2] checkpoints: introduce TST_CHECKPOINT_CREATE Wanlong Gao
1 sibling, 2 replies; 6+ messages in thread
From: Jan Stancek @ 2014-10-06 14:55 UTC (permalink / raw)
To: ltp-list
creat07 and setpgid03 are currently failing in following way:
CHILD: Failed to open fifo '': No such file or directory at creat07_child.c:31
creat07 1 TBROK : tst_checkpoint.c:126: Checkpoint timeouted after 5000 msecs at creat07.c:78
creat07 2 TBROK : tst_checkpoint.c:126: Remaining cases broken
These testcases start children via exec, so only initialize
checkpoint struct, FIFO has been already created by parent.
Signed-off-by: Jan Stancek <jstancek@redhat.com>
---
testcases/kernel/syscalls/creat/creat07_child.c | 8 ++++++--
.../kernel/syscalls/setpgid/setpgid03_child.c | 8 +++++++-
2 files changed, 13 insertions(+), 3 deletions(-)
diff --git a/testcases/kernel/syscalls/creat/creat07_child.c b/testcases/kernel/syscalls/creat/creat07_child.c
index f3e6aa0..1641601 100644
--- a/testcases/kernel/syscalls/creat/creat07_child.c
+++ b/testcases/kernel/syscalls/creat/creat07_child.c
@@ -24,10 +24,14 @@
char *TCID = "creat07_child";
-static struct tst_checkpoint checkpoint = {.timeout = 5, .retval = 1};
-
int main(void)
{
+ struct tst_checkpoint checkpoint;
+
+ /* we are already in tmpdir, so only initialize checkpoint,
+ * fifo has been created by parent already. */
+ TST_CHECKPOINT_INIT(&checkpoint);
+
TST_CHECKPOINT_SIGNAL_PARENT(&checkpoint);
for (;;) {
diff --git a/testcases/kernel/syscalls/setpgid/setpgid03_child.c b/testcases/kernel/syscalls/setpgid/setpgid03_child.c
index c4cf892..c9ea87f 100644
--- a/testcases/kernel/syscalls/setpgid/setpgid03_child.c
+++ b/testcases/kernel/syscalls/setpgid/setpgid03_child.c
@@ -20,10 +20,16 @@
char *TCID = "setpgid03_child";
-static struct tst_checkpoint checkpoint = { .timeout = 10000, .retval = 1};
int main(void)
{
+ struct tst_checkpoint checkpoint;
+
+ /* we are already in tmpdir, so only initialize checkpoint,
+ * fifo has been created by parent already. */
+ TST_CHECKPOINT_INIT(&checkpoint);
+ checkpoint.timeout = 10000;
+
TST_CHECKPOINT_SIGNAL_PARENT(&checkpoint);
TST_CHECKPOINT_CHILD_WAIT(&checkpoint);
--
1.7.1
------------------------------------------------------------------------------
Slashdot TV. Videos for Nerds. Stuff that Matters.
http://pubads.g.doubleclick.net/gampad/clk?id=160591471&iu=/4140/ostg.clktrk
_______________________________________________
Ltp-list mailing list
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list
^ permalink raw reply related [flat|nested] 6+ messages in thread* Re: [LTP] [PATCH 2/2 v2] checkpoints: fix usage in children started via exec
2014-10-06 14:55 ` [LTP] [PATCH 2/2 v2] checkpoints: fix usage in children started via exec Jan Stancek
@ 2014-10-07 0:45 ` Wanlong Gao
2014-10-07 11:50 ` Cyril Hrubis
1 sibling, 0 replies; 6+ messages in thread
From: Wanlong Gao @ 2014-10-07 0:45 UTC (permalink / raw)
To: ltp-list
On 10/06/2014 10:55 PM, Jan Stancek wrote:
> creat07 and setpgid03 are currently failing in following way:
> CHILD: Failed to open fifo '': No such file or directory at creat07_child.c:31
> creat07 1 TBROK : tst_checkpoint.c:126: Checkpoint timeouted after 5000 msecs at creat07.c:78
> creat07 2 TBROK : tst_checkpoint.c:126: Remaining cases broken
>
> These testcases start children via exec, so only initialize
> checkpoint struct, FIFO has been already created by parent.
>
> Signed-off-by: Jan Stancek <jstancek@redhat.com>
Tested-by: Wanlong Gao <gaowanlong@cn.fujitsu.com>
> ---
> testcases/kernel/syscalls/creat/creat07_child.c | 8 ++++++--
> .../kernel/syscalls/setpgid/setpgid03_child.c | 8 +++++++-
> 2 files changed, 13 insertions(+), 3 deletions(-)
>
> diff --git a/testcases/kernel/syscalls/creat/creat07_child.c b/testcases/kernel/syscalls/creat/creat07_child.c
> index f3e6aa0..1641601 100644
> --- a/testcases/kernel/syscalls/creat/creat07_child.c
> +++ b/testcases/kernel/syscalls/creat/creat07_child.c
> @@ -24,10 +24,14 @@
>
> char *TCID = "creat07_child";
>
> -static struct tst_checkpoint checkpoint = {.timeout = 5, .retval = 1};
> -
> int main(void)
> {
> + struct tst_checkpoint checkpoint;
> +
> + /* we are already in tmpdir, so only initialize checkpoint,
> + * fifo has been created by parent already. */
> + TST_CHECKPOINT_INIT(&checkpoint);
> +
> TST_CHECKPOINT_SIGNAL_PARENT(&checkpoint);
>
> for (;;) {
> diff --git a/testcases/kernel/syscalls/setpgid/setpgid03_child.c b/testcases/kernel/syscalls/setpgid/setpgid03_child.c
> index c4cf892..c9ea87f 100644
> --- a/testcases/kernel/syscalls/setpgid/setpgid03_child.c
> +++ b/testcases/kernel/syscalls/setpgid/setpgid03_child.c
> @@ -20,10 +20,16 @@
>
> char *TCID = "setpgid03_child";
>
> -static struct tst_checkpoint checkpoint = { .timeout = 10000, .retval = 1};
>
> int main(void)
> {
> + struct tst_checkpoint checkpoint;
> +
> + /* we are already in tmpdir, so only initialize checkpoint,
> + * fifo has been created by parent already. */
> + TST_CHECKPOINT_INIT(&checkpoint);
> + checkpoint.timeout = 10000;
> +
> TST_CHECKPOINT_SIGNAL_PARENT(&checkpoint);
> TST_CHECKPOINT_CHILD_WAIT(&checkpoint);
>
>
------------------------------------------------------------------------------
Meet PCI DSS 3.0 Compliance Requirements with EventLog Analyzer
Achieve PCI DSS 3.0 Compliant Status with Out-of-the-box PCI DSS Reports
Are you Audit-Ready for PCI DSS 3.0 Compliance? Download White paper
Comply to PCI DSS 3.0 Requirement 10 and 11.5 with EventLog Analyzer
http://pubads.g.doubleclick.net/gampad/clk?id=154622311&iu=/4140/ostg.clktrk
_______________________________________________
Ltp-list mailing list
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list
^ permalink raw reply [flat|nested] 6+ messages in thread* Re: [LTP] [PATCH 2/2 v2] checkpoints: fix usage in children started via exec
2014-10-06 14:55 ` [LTP] [PATCH 2/2 v2] checkpoints: fix usage in children started via exec Jan Stancek
2014-10-07 0:45 ` Wanlong Gao
@ 2014-10-07 11:50 ` Cyril Hrubis
[not found] ` <588690077.5122647.1412683247596.JavaMail.zimbra@redhat.com>
1 sibling, 1 reply; 6+ messages in thread
From: Cyril Hrubis @ 2014-10-07 11:50 UTC (permalink / raw)
To: Jan Stancek; +Cc: ltp-list
Hi!
> creat07 and setpgid03 are currently failing in following way:
> CHILD: Failed to open fifo '': No such file or directory at creat07_child.c:31
> creat07 1 TBROK : tst_checkpoint.c:126: Checkpoint timeouted after 5000 msecs at creat07.c:78
> creat07 2 TBROK : tst_checkpoint.c:126: Remaining cases broken
>
> These testcases start children via exec, so only initialize
> checkpoint struct, FIFO has been already created by parent.
Both looks good, acked.
What about test writing guidelines, will you update it, or should I do
that?
--
Cyril Hrubis
chrubis@suse.cz
------------------------------------------------------------------------------
Meet PCI DSS 3.0 Compliance Requirements with EventLog Analyzer
Achieve PCI DSS 3.0 Compliant Status with Out-of-the-box PCI DSS Reports
Are you Audit-Ready for PCI DSS 3.0 Compliance? Download White paper
Comply to PCI DSS 3.0 Requirement 10 and 11.5 with EventLog Analyzer
http://pubads.g.doubleclick.net/gampad/clk?id=154622311&iu=/4140/ostg.clktrk
_______________________________________________
Ltp-list mailing list
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [LTP] [PATCH 1/2 v2] checkpoints: introduce TST_CHECKPOINT_CREATE
2014-10-06 14:55 [LTP] [PATCH 1/2 v2] checkpoints: introduce TST_CHECKPOINT_CREATE Jan Stancek
2014-10-06 14:55 ` [LTP] [PATCH 2/2 v2] checkpoints: fix usage in children started via exec Jan Stancek
@ 2014-10-07 0:43 ` Wanlong Gao
1 sibling, 0 replies; 6+ messages in thread
From: Wanlong Gao @ 2014-10-07 0:43 UTC (permalink / raw)
To: ltp-list
On 10/06/2014 10:55 PM, Jan Stancek wrote:
> Rename tst_checkpoint_init to tst_checkpoint_create.
> Add tst_checkpoint_init, which only initializes checkpoint struct.
> Update existing testcases to use TST_CHECKPOINT_CREATE.
>
> Signed-off-by: Jan Stancek <jstancek@redhat.com>
Acked-by: Wanlong Gao <gaowanlong@cn.fujitsu.com>
> ---
> include/tst_checkpoint.h | 10 ++++++++--
> lib/tests/tst_checkpoint_child.c | 2 +-
> lib/tests/tst_checkpoint_child_exits.c | 2 +-
> lib/tests/tst_checkpoint_no_child.c | 2 +-
> lib/tests/tst_checkpoint_parent.c | 2 +-
> lib/tests/tst_checkpoint_parent_exits.c | 2 +-
> lib/tst_checkpoint.c | 20 ++++++++++++++------
> .../kernel/containers/mountns/mountns_helper.h | 4 ++--
> testcases/kernel/syscalls/creat/creat07.c | 2 +-
> testcases/kernel/syscalls/flock/flock03.c | 2 +-
> testcases/kernel/syscalls/setpgid/setpgid03.c | 2 +-
> testcases/kernel/syscalls/waitid/waitid02.c | 2 +-
> 12 files changed, 33 insertions(+), 19 deletions(-)
>
> diff --git a/include/tst_checkpoint.h b/include/tst_checkpoint.h
> index 4d04c0e..6ea3366 100644
> --- a/include/tst_checkpoint.h
> +++ b/include/tst_checkpoint.h
> @@ -51,10 +51,16 @@ struct tst_checkpoint {
> * Checkpoint initializaton, must be done first.
> */
> #define TST_CHECKPOINT_INIT(self) \
> - tst_checkpoint_init(__FILE__, __LINE__, self)
> + tst_checkpoint_init(__FILE__, __LINE__, self)
>
> void tst_checkpoint_init(const char *file, const int lineno,
> - struct tst_checkpoint *self);
> + struct tst_checkpoint *self);
> +
> +#define TST_CHECKPOINT_CREATE(self) \
> + tst_checkpoint_create(__FILE__, __LINE__, self)
> +
> +void tst_checkpoint_create(const char *file, const int lineno,
> + struct tst_checkpoint *self);
>
> /*
> * Wait called from parent. In case parent waits for child.
> diff --git a/lib/tests/tst_checkpoint_child.c b/lib/tests/tst_checkpoint_child.c
> index 9ce93f5..a13a9a2 100644
> --- a/lib/tests/tst_checkpoint_child.c
> +++ b/lib/tests/tst_checkpoint_child.c
> @@ -35,7 +35,7 @@ int main(void)
>
> tst_tmpdir();
>
> - TST_CHECKPOINT_INIT(&checkpoint);
> + TST_CHECKPOINT_CREATE(&checkpoint);
>
> pid = fork();
>
> diff --git a/lib/tests/tst_checkpoint_child_exits.c b/lib/tests/tst_checkpoint_child_exits.c
> index 3488ba2..d2e3f74 100644
> --- a/lib/tests/tst_checkpoint_child_exits.c
> +++ b/lib/tests/tst_checkpoint_child_exits.c
> @@ -35,7 +35,7 @@ int main(void)
>
> tst_tmpdir();
>
> - TST_CHECKPOINT_INIT(&checkpoint);
> + TST_CHECKPOINT_CREATE(&checkpoint);
>
> pid = fork();
>
> diff --git a/lib/tests/tst_checkpoint_no_child.c b/lib/tests/tst_checkpoint_no_child.c
> index fcf2745..2e72198 100644
> --- a/lib/tests/tst_checkpoint_no_child.c
> +++ b/lib/tests/tst_checkpoint_no_child.c
> @@ -39,7 +39,7 @@ int main(void)
>
> tst_tmpdir();
>
> - TST_CHECKPOINT_INIT(&checkpoint);
> + TST_CHECKPOINT_CREATE(&checkpoint);
> TST_CHECKPOINT_SIGNAL_CHILD(cleanup, &checkpoint);
> fprintf(stderr, "Parent: checkpoint reached\n");
>
> diff --git a/lib/tests/tst_checkpoint_parent.c b/lib/tests/tst_checkpoint_parent.c
> index a2ae621..a42b37a 100644
> --- a/lib/tests/tst_checkpoint_parent.c
> +++ b/lib/tests/tst_checkpoint_parent.c
> @@ -35,7 +35,7 @@ int main(void)
>
> tst_tmpdir();
>
> - TST_CHECKPOINT_INIT(&checkpoint);
> + TST_CHECKPOINT_CREATE(&checkpoint);
>
> pid = fork();
>
> diff --git a/lib/tests/tst_checkpoint_parent_exits.c b/lib/tests/tst_checkpoint_parent_exits.c
> index 59c5356..3056c2c 100644
> --- a/lib/tests/tst_checkpoint_parent_exits.c
> +++ b/lib/tests/tst_checkpoint_parent_exits.c
> @@ -35,7 +35,7 @@ int main(void)
>
> tst_tmpdir();
>
> - TST_CHECKPOINT_INIT(&checkpoint);
> + TST_CHECKPOINT_CREATE(&checkpoint);
>
> pid = fork();
>
> diff --git a/lib/tst_checkpoint.c b/lib/tst_checkpoint.c
> index 7391a28..ebc379e 100644
> --- a/lib/tst_checkpoint.c
> +++ b/lib/tst_checkpoint.c
> @@ -74,12 +74,6 @@ void tst_checkpoint_init(const char *file, const int lineno,
> static unsigned int fifo_counter = 0;
> int rval;
>
> - if (!tst_tmpdir_created()) {
> - tst_brkm(TBROK, NULL, "Checkpoint could be used only in test "
> - "temporary directory at %s:%d",
> - file, lineno);
> - }
> -
> /* default values */
> rval = snprintf(self->file, TST_FIFO_LEN, "tst_checkopoint_fifo_%u",
> fifo_counter++);
> @@ -90,6 +84,20 @@ void tst_checkpoint_init(const char *file, const int lineno,
> }
> self->retval = 1;
> self->timeout = 5000;
> +}
> +
> +void tst_checkpoint_create(const char *file, const int lineno,
> + struct tst_checkpoint *self)
> +
> +{
> +
> + if (!tst_tmpdir_created()) {
> + tst_brkm(TBROK, NULL, "Checkpoint could be used only in test "
> + "temporary directory at %s:%d",
> + file, lineno);
> + }
> +
> + tst_checkpoint_init(file, lineno, self);
>
> if (mkfifo(self->file, 0666)) {
> tst_brkm(TBROK | TERRNO, NULL,
> diff --git a/testcases/kernel/containers/mountns/mountns_helper.h b/testcases/kernel/containers/mountns/mountns_helper.h
> index cb9c16d..d4a6a91 100644
> --- a/testcases/kernel/containers/mountns/mountns_helper.h
> +++ b/testcases/kernel/containers/mountns/mountns_helper.h
> @@ -57,8 +57,8 @@ static void setup(void)
> tst_require_root(NULL);
> check_newns();
> tst_tmpdir();
> - TST_CHECKPOINT_INIT(&checkpoint1);
> - TST_CHECKPOINT_INIT(&checkpoint2);
> + TST_CHECKPOINT_CREATE(&checkpoint1);
> + TST_CHECKPOINT_CREATE(&checkpoint2);
> SAFE_MKDIR(cleanup, DIRA, 0777);
> SAFE_MKDIR(cleanup, DIRB, 0777);
> SAFE_TOUCH(cleanup, DIRA"/A", 0, NULL);
> diff --git a/testcases/kernel/syscalls/creat/creat07.c b/testcases/kernel/syscalls/creat/creat07.c
> index a9f5253..4b8958f 100644
> --- a/testcases/kernel/syscalls/creat/creat07.c
> +++ b/testcases/kernel/syscalls/creat/creat07.c
> @@ -108,7 +108,7 @@ static void setup(char *app)
>
> TST_RESOURCE_COPY(cleanup, TEST_APP, NULL);
>
> - TST_CHECKPOINT_INIT(&checkpoint);
> + TST_CHECKPOINT_CREATE(&checkpoint);
>
> TEST_PAUSE;
> }
> diff --git a/testcases/kernel/syscalls/flock/flock03.c b/testcases/kernel/syscalls/flock/flock03.c
> index b2734b5..446dc84 100644
> --- a/testcases/kernel/syscalls/flock/flock03.c
> +++ b/testcases/kernel/syscalls/flock/flock03.c
> @@ -186,7 +186,7 @@ static void setup(void)
>
> tst_tmpdir();
>
> - TST_CHECKPOINT_INIT(&checkpoint);
> + TST_CHECKPOINT_CREATE(&checkpoint);
>
> fd = creat(FILE_NAME, 0666);
> if (fd < 0) {
> diff --git a/testcases/kernel/syscalls/setpgid/setpgid03.c b/testcases/kernel/syscalls/setpgid/setpgid03.c
> index a107c50..c1b9951 100644
> --- a/testcases/kernel/syscalls/setpgid/setpgid03.c
> +++ b/testcases/kernel/syscalls/setpgid/setpgid03.c
> @@ -155,7 +155,7 @@ static void setup(void)
>
> tst_tmpdir();
>
> - TST_CHECKPOINT_INIT(&checkpoint);
> + TST_CHECKPOINT_CREATE(&checkpoint);
> checkpoint.timeout = 10000;
>
> umask(0);
> diff --git a/testcases/kernel/syscalls/waitid/waitid02.c b/testcases/kernel/syscalls/waitid/waitid02.c
> index 6259fa3..d497b6b 100644
> --- a/testcases/kernel/syscalls/waitid/waitid02.c
> +++ b/testcases/kernel/syscalls/waitid/waitid02.c
> @@ -240,7 +240,7 @@ static void setup(void)
> {
> TEST_PAUSE;
> tst_tmpdir();
> - TST_CHECKPOINT_INIT(&checkpoint);
> + TST_CHECKPOINT_CREATE(&checkpoint);
> }
>
> static void cleanup(void)
>
------------------------------------------------------------------------------
Meet PCI DSS 3.0 Compliance Requirements with EventLog Analyzer
Achieve PCI DSS 3.0 Compliant Status with Out-of-the-box PCI DSS Reports
Are you Audit-Ready for PCI DSS 3.0 Compliance? Download White paper
Comply to PCI DSS 3.0 Requirement 10 and 11.5 with EventLog Analyzer
http://pubads.g.doubleclick.net/gampad/clk?id=154622311&iu=/4140/ostg.clktrk
_______________________________________________
Ltp-list mailing list
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2014-10-07 12:10 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-10-06 14:55 [LTP] [PATCH 1/2 v2] checkpoints: introduce TST_CHECKPOINT_CREATE Jan Stancek
2014-10-06 14:55 ` [LTP] [PATCH 2/2 v2] checkpoints: fix usage in children started via exec Jan Stancek
2014-10-07 0:45 ` Wanlong Gao
2014-10-07 11:50 ` Cyril Hrubis
[not found] ` <588690077.5122647.1412683247596.JavaMail.zimbra@redhat.com>
2014-10-07 12:10 ` Cyril Hrubis
2014-10-07 0:43 ` [LTP] [PATCH 1/2 v2] checkpoints: introduce TST_CHECKPOINT_CREATE Wanlong Gao
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox