Skip to contentSkip to conversation

cr_tests: Add eventfd01 test based on LTP test

RFC PATCH In review Matt Helsley 3 participants 4 messages Oct 26, 2009 – Oct 27, 2009 3 messages not in the archive

lore
Share & tools
lore
#0 lore raw

RFC PATCH 1/1 cr_tests: Add eventfd01 test based on LTP test

Add checkpoint spots to the LTP test. Notably different from the epoll test library, these labels to not incorporate error handling code. Rather the test and branch are explicit and rely on LTP tst_* functions. As such it requires libltp.a to link. Do this with:

make LTPROOT=/path/to/ltp/install

[RFC] Due to weirdness/bugs in test results after adapting testcase

	to c/r.
---
 eventfd/Makefile    |   22 ++
 eventfd/eventfd01.c |  892 +++++++++++++++++++++++++++++++++++++++++++++++++++
 eventfd/libeptest.c |   39 +++
 eventfd/libeptest.h |   73 +++++
 eventfd/run.sh      |  140 ++++++++
 5 files changed, 1166 insertions(+), 0 deletions(-)
 create mode 100644 eventfd/Makefile
 create mode 100644 eventfd/eventfd01.c
 create mode 100644 eventfd/libeptest.c
 create mode 100644 eventfd/libeptest.h
 create mode 100755 eventfd/run.sh
eventfd/Makefile new file +22 -0
new file mode 100644
index 0000000..c37909a
@@ -0,0 +1,22 @@
+LTPROOT ?= ../ltp
+
+LIBS := ../libcrtest/libcrtest.a ./libeptest.a $(LTPROOT)/lib/libltp.a
+CFLAGS := -Wall $(ARCHOPTS) -I../ -I../libcrtest -I$(LTPROOT)/include
+
+PROGS=eventfd01
+
+.PHONY: all clean
+
+all: $(PROGS)
+
+../libcrtest/libcrtest.a: ../libcrtest/libcrtest.h ../libcrtest/common.c
+	$(MAKE) -C ../libcrtest libcrtest.a
+
+libeptest.a: libeptest.o libeptest.h
+	ar cr libeptest.a libeptest.o
+
+$(PROGS): %: %.c $(LIBS)
+	gcc -Wall $(CFLAGS) -o $@ $< $(LIBS)
+
+clean:
+	rm -f *.o libeptest.a log.* checkpoint-* $(PROGS)
eventfd/eventfd01.c new file +892 -0

892 lines not on this page · raw message

eventfd/libeptest.c new file +39 -0
new file mode 100644
index 0000000..88e5a9c
@@ -0,0 +1,39 @@
+#include <errno.h>
+
+#include "libeptest.h"
+
+FILE *logfp = NULL;
+
+void print_labels(FILE *pout)
+{
+	int i;
+
+	if (num_labels > 0)
+		fprintf(pout, "\tNUM\tLABEL\n");
+	for (i = 0; i < num_labels; i++)
+		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;
eventfd/libeptest.h new file +73 -0

73 lines not on this page · raw message

eventfd/run.sh new file +140 -0

140 lines not on this page · raw message

Signature · 1 line
1.5.6.3
#2 lore raw
In reply to a message not in the archive
Quoted 8 lines · Matt Helsley

Add checkpoint spots to the LTP test. Notably different from the epoll test library, these labels to not incorporate error handling code. Rather the test and branch are explicit and rely on LTP tst_* functions. As such it requires libltp.a to link. Do this with:

make LTPROOT=/path/to/ltp/install

Since it doesn't automatically run I just went ahead and applied it. I'll get aroudn to testing when eventfd hits Oren's tree I guess :)

thanks,
-serge

#4 lore raw
In reply to a message not in the archive
Quoted 6 lines · Serge E. Hallyn
Quoted 5 lines · Matt Helsley

Add checkpoint spots to the LTP test. Notably different from the epoll test library, these labels to not incorporate error handling code. Rather the test and branch are explicit and rely on LTP tst_* functions. As such it requires libltp.a to link. Do this with:

Quoted 7 lines
Quoted 3 lines

make LTPROOT=/path/to/ltp/install

Since it doesn't automatically run I just went ahead and applied it. I'll get aroudn to testing when eventfd hits Oren's tree I guess :)

It's there since yesterday.
I guess not much sleep for you tonight :)

Oren.

#6 lore raw
In reply to a message not in the archive
Quoted 13 lines · Oren Laadan
Quoted 10 lines · Serge E. Hallyn
Quoted 8 lines · Matt Helsley

Add checkpoint spots to the LTP test. Notably different from the epoll test library, these labels to not incorporate error handling code. Rather the test and branch are explicit and rely on LTP tst_* functions. As such it requires libltp.a to link. Do this with:

make LTPROOT=/path/to/ltp/install

Quoted 8 lines
Quoted 3 lines

Since it doesn't automatically run I just went ahead and applied it. I'll get aroudn to testing when eventfd hits Oren's tree I guess :)

It's there since yesterday.
I guess not much sleep for you tonight :)

Oren.

Huh, so it is - for some reason i thought you were going to wait until ckpt-v19 opened up. I guess that means I have to go test :)

-serge