* [PATCH 2/8] cr_tests: factor out do_ckpt()
[not found] ` <0c9ea18c7ffeb8688b31d01ce5f39a5a8c8a431f.1268174893.git.matthltc-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org>
@ 2010-03-09 22:48 ` Matt Helsley
2010-03-09 22:48 ` [PATCH 3/8] cr_tests: eventfd: use labels.[ch|lds] from libcrtest Matt Helsley
` (6 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: Matt Helsley @ 2010-03-09 22:48 UTC (permalink / raw)
To: Serge E. Hallyn; +Cc: Linux Containers
do_ckpt() sets checkpoint-ready and waits for checkpoint-done.
Test scripts should set checkpoint-skip if tests should skip
the wait for checkpoint-done as if checkpointing were done.
This allows us to have tests with multiple checkpoints in them:
checkpoint 1
...
checkpoint 2
...
The test script can take checkpoints at each spot in turn,
saving the respective state for each. After each checkpoint
it resumes to the next until the program finishes.
Then the test script begins testing restart of each checkpoint.
This ensures that broken restarts don't prevent at least the
checkpoints from passing. It also cuts the number of times
the test program must start from scratch to 1.
However, because of the way it's designed, using all of these
features is not necessary.
To use them with any "labeled" tests, set the op_num to -1
(checkpoints at all labeled points).
Signed-off-by: Matt Helsley <matthltc-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org>
---
epoll/libeptest.c | 9 ---------
eventfd/libeptest.c | 20 --------------------
fs/libfstest.c | 9 ---------
fs/libfstest.h | 3 ---
libcrtest/common.c | 20 ++++++++++++++++++++
libcrtest/libcrtest.h | 2 ++
6 files changed, 22 insertions(+), 41 deletions(-)
diff --git a/epoll/libeptest.c b/epoll/libeptest.c
index 95b42f8..13d9ab3 100644
--- a/epoll/libeptest.c
+++ b/epoll/libeptest.c
@@ -43,12 +43,3 @@ const char * eflags(unsigned int events)
return buffer;
}
#undef peflag
-
-/* Signal ready for and await the checkpoint */
-void do_ckpt(void)
-{
- set_checkpoint_ready();
- while (!test_checkpoint_done())
- usleep(10000);
-
-}
diff --git a/eventfd/libeptest.c b/eventfd/libeptest.c
index 88e5a9c..073b596 100644
--- a/eventfd/libeptest.c
+++ b/eventfd/libeptest.c
@@ -14,26 +14,6 @@ void print_labels(FILE *pout)
fprintf(pout, "\t%d\t%s\n", i, labels(i));
}
-/* Signal ready for and await the checkpoint */
-void do_ckpt(void)
-{
- int rc;
-
- set_checkpoint_ready();
-
- rc = access("./checkpoint-skip", F_OK);
- if (rc == 0)
- return;
- else if (errno != ENOENT)
- exit(EXIT_FAILURE);
-
- while (!test_checkpoint_done())
- usleep(10000);
- if (unlink("./checkpoint-done") == -1) {
- /* perror("unlink(\"./checkpoint-done\")"); */
- }
-}
-
/* The spot (LABEL or label number) where we should test checkpoint/restart */
char const *ckpt_label;
int ckpt_op_num = 0;
diff --git a/fs/libfstest.c b/fs/libfstest.c
index 200dc23..fb94a52 100644
--- a/fs/libfstest.c
+++ b/fs/libfstest.c
@@ -1,12 +1,3 @@
#include "libfstest.h"
FILE *logfp = NULL;
-
-/* Signal ready for and await the checkpoint */
-void do_ckpt(void)
-{
- set_checkpoint_ready();
- while (!test_checkpoint_done())
- usleep(10000);
-
-}
diff --git a/fs/libfstest.h b/fs/libfstest.h
index 1ef3c5c..238846b 100644
--- a/fs/libfstest.h
+++ b/fs/libfstest.h
@@ -28,7 +28,4 @@ do { \
/* like perror() except to the log */
#define log_error(s) log("FAIL", "%s: %s\n", (s), strerror(errno))
-/* Signal ready for and await the checkpoint */
-void do_ckpt(void);
-
#define HELLO "Hello world!\n"
diff --git a/libcrtest/common.c b/libcrtest/common.c
index 87967fd..6cfc9a9 100644
--- a/libcrtest/common.c
+++ b/libcrtest/common.c
@@ -68,6 +68,26 @@ void set_checkpoint_ready()
close(fd);
}
+/* Signal ready for and await the checkpoint */
+void do_ckpt(void)
+{
+ int rc;
+
+ set_checkpoint_ready();
+
+ rc = access(CKPT_SKIP, F_OK);
+ if (rc == 0)
+ return;
+ else if (errno != ENOENT)
+ do_exit(1);
+
+ while (!test_checkpoint_done())
+ usleep(10000);
+ if (unlink(CKPT_DONE) == -1) {
+ /* perror("unlink(\"./checkpoint-done\")"); */
+ }
+}
+
void print_exit_status(int pid, int status)
{
fprintf(logfp, "Pid %d unexpected exit - ", pid);
diff --git a/libcrtest/libcrtest.h b/libcrtest/libcrtest.h
index d4e2974..7f8cfff 100644
--- a/libcrtest/libcrtest.h
+++ b/libcrtest/libcrtest.h
@@ -3,6 +3,7 @@
#define CKPT_READY "checkpoint-ready"
#define CKPT_DONE "checkpoint-done"
+#define CKPT_SKIP "checkpoint-skip"
#define TEST_DONE "test-done"
extern FILE *logfp;
@@ -18,6 +19,7 @@ extern void do_exit(int status);
extern int test_done(void);
extern int test_checkpoint_done();
extern void set_checkpoint_ready(void);
+extern void do_ckpt(void);
extern int do_wait(int num_children);
extern void copy_data(char *srcfile, char *destfile);
extern void print_exit_status(int pid, int status);
--
1.6.3.3
^ permalink raw reply related [flat|nested] 9+ messages in thread* [PATCH 3/8] cr_tests: eventfd: use labels.[ch|lds] from libcrtest
[not found] ` <0c9ea18c7ffeb8688b31d01ce5f39a5a8c8a431f.1268174893.git.matthltc-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org>
2010-03-09 22:48 ` [PATCH 2/8] cr_tests: factor out do_ckpt() Matt Helsley
@ 2010-03-09 22:48 ` Matt Helsley
2010-03-09 22:48 ` [PATCH 4/8] cr_tests: epoll: Cleanup libeptest.[oa] Matt Helsley
` (5 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: Matt Helsley @ 2010-03-09 22:48 UTC (permalink / raw)
To: Serge E. Hallyn; +Cc: Linux Containers
Signed-off-by: Matt Helsley <matthltc-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org>
---
eventfd/libeptest.h | 46 +---------------------------------------------
1 files changed, 1 insertions(+), 45 deletions(-)
diff --git a/eventfd/libeptest.h b/eventfd/libeptest.h
index b6629e8..3f1522e 100644
--- a/eventfd/libeptest.h
+++ b/eventfd/libeptest.h
@@ -6,6 +6,7 @@
#include <sys/epoll.h>
#include "libcrtest/libcrtest.h"
+#include "libcrtest/labels.h"
extern FILE *logfp;
@@ -26,48 +27,3 @@ do { \
/* like perror() except to the log */
#define log_error(s) log("FAIL", "%s: %s\n", (s), strerror(errno))
-
-/*
- * A LABEL is a point in the program we can goto where it's interesting to
- * checkpoint. These enable us to have a set of labels that can be specified
- * on the commandline.
- */
-extern const char __attribute__((__section__(".LABELs"))) *first_label;
-extern const char __attribute__((__section__(".LABELs"))) *last_label;
-
-#define num_labels ((&last_label - &first_label) - 1)
-
-static inline const char * labels(int i)
-{
- return (&first_label)[num_labels - i];
-}
-
-/* Print the labels that this program has to pout */
-void print_labels(FILE *pout);
-
-/* Signal ready for and await the checkpoint */
-void do_ckpt(void);
-
-/* The spot (LABEL or label number) where we should test checkpoint/restart */
-extern char const *ckpt_label;
-extern int ckpt_op_num;
-
-#define stringify(expr) #expr
-
-/* Label a spot in the code... */
-#define label(lbl, ret, action) \
-do { \
- static char __attribute__((__section__(".LABELs"))) *___ ##lbl## _l = stringify(lbl); \
- goto lbl ; \
-lbl: \
-\
- log("INFO", "label: %s: \"%s\"\n", \
- labels(op_num), stringify(action)); \
-\
- ret = action ; \
-\
- if ((ckpt_op_num == op_num) || (ckpt_op_num == -1) || \
- (strcmp(ckpt_label, ___ ##lbl## _l) == 0)) \
- do_ckpt(); \
- op_num++; \
-} while(0)
--
1.6.3.3
^ permalink raw reply related [flat|nested] 9+ messages in thread* [PATCH 4/8] cr_tests: epoll: Cleanup libeptest.[oa]
[not found] ` <0c9ea18c7ffeb8688b31d01ce5f39a5a8c8a431f.1268174893.git.matthltc-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org>
2010-03-09 22:48 ` [PATCH 2/8] cr_tests: factor out do_ckpt() Matt Helsley
2010-03-09 22:48 ` [PATCH 3/8] cr_tests: eventfd: use labels.[ch|lds] from libcrtest Matt Helsley
@ 2010-03-09 22:48 ` Matt Helsley
2010-03-09 22:48 ` [PATCH 5/8] cr_tests: simple: Fix stdio Matt Helsley
` (4 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: Matt Helsley @ 2010-03-09 22:48 UTC (permalink / raw)
To: Serge E. Hallyn; +Cc: Linux Containers
These weren't being cleaned up.
Signed-off-by: Matt Helsley <matthltc-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org>
---
epoll/module.mk | 2 ++
1 files changed, 2 insertions(+), 0 deletions(-)
diff --git a/epoll/module.mk b/epoll/module.mk
index 2e5d8c6..260e549 100644
--- a/epoll/module.mk
+++ b/epoll/module.mk
@@ -9,3 +9,5 @@ test_clean += $(local_dir)/cr_epoll*
$(local_progs): CPPFLAGS += -I .
$(local_progs): LDFLAGS += -Xlinker -dT -Xlinker libcrtest/labels.lds
$(local_progs): $(local_dir)/libeptest.o libcrtest/libcrtest.a
+
+extra_clean += $(local_dir)/libeptest.o $(local_dir)/libeptest.a
--
1.6.3.3
^ permalink raw reply related [flat|nested] 9+ messages in thread* [PATCH 5/8] cr_tests: simple: Fix stdio
[not found] ` <0c9ea18c7ffeb8688b31d01ce5f39a5a8c8a431f.1268174893.git.matthltc-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org>
` (2 preceding siblings ...)
2010-03-09 22:48 ` [PATCH 4/8] cr_tests: epoll: Cleanup libeptest.[oa] Matt Helsley
@ 2010-03-09 22:48 ` Matt Helsley
2010-03-09 22:48 ` [PATCH 6/8] cr_tests: simple: Make output more useful Matt Helsley
` (3 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: Matt Helsley @ 2010-03-09 22:48 UTC (permalink / raw)
To: Serge E. Hallyn; +Cc: Linux Containers
The perror() after calling checkpoint() is useless -- stderr is closed.
Fix it by using dup2() to redirect stderr to the specified file. Do
the same for stdout just in case we want to use printf later.
Signed-off-by: Matt Helsley <matthltc-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org>
---
simple/ckpt.c | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/simple/ckpt.c b/simple/ckpt.c
index 739eb0a..2f7d0bb 100644
--- a/simple/ckpt.c
+++ b/simple/ckpt.c
@@ -62,8 +62,8 @@ int main(int argc, char *argv[])
/* TODO these may no longer need to be closed? */
close(0);
- close(1);
- close(2);
+ dup2(fileno(file), 1);
+ dup2(fileno(file), 2);
fprintf(file, "hello, world!\n");
fflush(file);
--
1.6.3.3
^ permalink raw reply related [flat|nested] 9+ messages in thread* [PATCH 6/8] cr_tests: simple: Make output more useful
[not found] ` <0c9ea18c7ffeb8688b31d01ce5f39a5a8c8a431f.1268174893.git.matthltc-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org>
` (3 preceding siblings ...)
2010-03-09 22:48 ` [PATCH 5/8] cr_tests: simple: Fix stdio Matt Helsley
@ 2010-03-09 22:48 ` Matt Helsley
2010-03-09 22:48 ` [PATCH 7/8] cr_tests: Make rewrite-cr-header.sh define the header cpp guard Matt Helsley
` (2 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: Matt Helsley @ 2010-03-09 22:48 UTC (permalink / raw)
To: Serge E. Hallyn; +Cc: Linux Containers
I'd have thought seeing "hello, world!" was a sign the test passed. Make the
output indicative of the test results.
Signed-off-by: Matt Helsley <matthltc-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org>
---
simple/ckpt.c | 6 +++---
1 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/simple/ckpt.c b/simple/ckpt.c
index 2f7d0bb..4bbef81 100644
--- a/simple/ckpt.c
+++ b/simple/ckpt.c
@@ -65,17 +65,17 @@ int main(int argc, char *argv[])
dup2(fileno(file), 1);
dup2(fileno(file), 2);
- fprintf(file, "hello, world!\n");
+ fprintf(file, "Invoking checkpoint syscall... ");
fflush(file);
ret = syscall(__NR_checkpoint, pid, ckptfd, CHECKPOINT_SUBTREE, logfd);
if (ret < 0) {
+ fprintf(file, " FAILED.\n");
perror("checkpoint");
exit(2);
}
- fprintf(file, "world, hello!\n");
- fprintf(file, "ret = %d\n", ret);
+ fprintf(file, "PASSED.\nret = %d\n", ret);
fflush(file);
close(logfd);
--
1.6.3.3
^ permalink raw reply related [flat|nested] 9+ messages in thread* [PATCH 7/8] cr_tests: Make rewrite-cr-header.sh define the header cpp guard
[not found] ` <0c9ea18c7ffeb8688b31d01ce5f39a5a8c8a431f.1268174893.git.matthltc-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org>
` (4 preceding siblings ...)
2010-03-09 22:48 ` [PATCH 6/8] cr_tests: simple: Make output more useful Matt Helsley
@ 2010-03-09 22:48 ` Matt Helsley
2010-03-09 22:48 ` [PATCH 8/8] cr_tests: update cr.h Matt Helsley
2010-03-10 1:19 ` [PATCH 1/8] cr_tests: crcounter: Don't report bogus waits Serge E. Hallyn
7 siblings, 0 replies; 9+ messages in thread
From: Matt Helsley @ 2010-03-09 22:48 UTC (permalink / raw)
To: Serge E. Hallyn; +Cc: Linux Containers
Signed-off-by: Matt Helsley <matthltc-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org>
---
| 1 +
1 files changed, 1 insertions(+), 0 deletions(-)
--git a/rewrite-cr-header.sh b/rewrite-cr-header.sh
index 62ad5b5..21f699c 100755
--- a/rewrite-cr-header.sh
+++ b/rewrite-cr-header.sh
@@ -45,6 +45,7 @@ set -e
cat - <<-EOFOEOF
/* AUTOMATICALLY GENERATED by rewrite-cr-header.sh */
#ifndef _LINUX_CHECKPOINT_H_
+#define _LINUX_CHECKPOINT_H_
#include <asm/unistd.h>
EOFOEOF
--
1.6.3.3
^ permalink raw reply related [flat|nested] 9+ messages in thread* [PATCH 8/8] cr_tests: update cr.h
[not found] ` <0c9ea18c7ffeb8688b31d01ce5f39a5a8c8a431f.1268174893.git.matthltc-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org>
` (5 preceding siblings ...)
2010-03-09 22:48 ` [PATCH 7/8] cr_tests: Make rewrite-cr-header.sh define the header cpp guard Matt Helsley
@ 2010-03-09 22:48 ` Matt Helsley
2010-03-10 1:19 ` [PATCH 1/8] cr_tests: crcounter: Don't report bogus waits Serge E. Hallyn
7 siblings, 0 replies; 9+ messages in thread
From: Matt Helsley @ 2010-03-09 22:48 UTC (permalink / raw)
To: Serge E. Hallyn; +Cc: Linux Containers
cr.h is grossly out-of-date. Any build which relies on it is horribly broken
without this change.
Signed-off-by: Matt Helsley <matthltc-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org>
---
cr.h | 46 +++++++++++++++++++---------------------------
1 files changed, 19 insertions(+), 27 deletions(-)
diff --git a/cr.h b/cr.h
index b05dcd8..d5d0cf7 100644
--- a/cr.h
+++ b/cr.h
@@ -1,8 +1,7 @@
/* AUTOMATICALLY GENERATED by rewrite-cr-header.sh */
#ifndef _LINUX_CHECKPOINT_H_
-#include <asm/unistd.h>
-
#define _LINUX_CHECKPOINT_H_
+#include <asm/unistd.h>
/*
* Generic checkpoint-restart
*
@@ -13,7 +12,7 @@
* distribution for more details.
*/
-#define CHECKPOINT_VERSION 2
+#define CHECKPOINT_VERSION 5
/* checkpoint user flags */
#define CHECKPOINT_SUBTREE 0x1
@@ -22,24 +21,11 @@
#define RESTART_TASKSELF 0x1
#define RESTART_FROZEN 0x2
#define RESTART_GHOST 0x4
+#define RESTART_KEEP_LSM 0x8
+#define RESTART_CONN_RESET 0x10
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+/* misc user visible */
+#define CHECKPOINT_FD_NONE -1
@@ -71,10 +57,6 @@
/* parisc unsupported. */
#if __powerpc__
-#ifndef __NR_eclone
-#define __NR_eclone 323
-#endif
-
#ifndef __NR_checkpoint
#define __NR_checkpoint 324
#endif
@@ -93,6 +75,7 @@
#define __NR_restart 334
#endif
+/* score unsupported. */
/* sh unsupported. */
/* sh unsupported. */
/* sh unsupported. */
@@ -100,14 +83,23 @@
#elif __i386__
#ifndef __NR_checkpoint
-#define __NR_checkpoint 338
+#define __NR_checkpoint 339
#endif
#ifndef __NR_restart
-#define __NR_restart 339
+#define __NR_restart 340
+#endif
+
+#elif __x86_64__
+
+#ifndef __NR_checkpoint
+#define __NR_checkpoint 301
+#endif
+
+#ifndef __NR_restart
+#define __NR_restart 302
#endif
-/* x86_64 unsupported. */
/* x86_64 unsupported. */
/* xtensa unsupported. */
#endif /* arch-specific sections */
--
1.6.3.3
^ permalink raw reply related [flat|nested] 9+ messages in thread* Re: [PATCH 1/8] cr_tests: crcounter: Don't report bogus waits
[not found] ` <0c9ea18c7ffeb8688b31d01ce5f39a5a8c8a431f.1268174893.git.matthltc-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org>
` (6 preceding siblings ...)
2010-03-09 22:48 ` [PATCH 8/8] cr_tests: update cr.h Matt Helsley
@ 2010-03-10 1:19 ` Serge E. Hallyn
7 siblings, 0 replies; 9+ messages in thread
From: Serge E. Hallyn @ 2010-03-10 1:19 UTC (permalink / raw)
To: Matt Helsley; +Cc: Linux Containers
Quoting Matt Helsley (matthltc-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org):
> This outputs a bunch of garbage but according to the comments don't
> absolutely need this wait anyway. So redirect stderr for the bash
> wait to /dev/null.
>
> Signed-off-by: Matt Helsley <matthltc-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org>
All applied, thanks.
-serge
^ permalink raw reply [flat|nested] 9+ messages in thread