: eclone-1: Test basic functionality
PATCH v2 1/6 : eclone-1: Test basic functionality
From: Sukadev Bhattiprolu <[email protected]>
Date: Sat, 30 Jan 2010 12:49:30 -0800
Subject: [PATCH 1/6] eclone-1: Test basic functionality
Verify that a child process gets the expected pid and arguments on stack when it is created with eclone() system call.
Changelog[v2]:
- Use libeclone.a from user-cr git tree so tests are portable across architectures.
- Fix a couple of nits identified by Serge Hallyn
--- Makefile | 2 +- eclone/Makefile | 21 +++++++++ eclone/eclone-1.c | 119 +++++++++++++++++++++++++++++++++++++++++++++++++ eclone/eclone-tests.h | 66 +++++++++++++++++++++++++++ 4 files changed, 207 insertions(+), 1 deletions(-) create mode 100644 eclone/Makefile create mode 100644 eclone/eclone-1.c create mode 100644 eclone/eclone-tests.h
Makefile +1 -1
@@ -1,5 +1,5 @@ SUBDIRS = libcrtest counterloop fileio simple userns ipc sleep \ - process-tree futex epoll taskfs + process-tree futex epoll taskfs eclone targets = ns_exec mysu
eclone/Makefile new file +21 -0
@@ -0,0 +1,21 @@ +# +# libeclone.a is built/installed from user-cr git-tree. Point USER_CR_DIR +# to the directory containing libeclone.a and genstack.h +# +USER_CR_DIR ?= ../../user-cr + +CFLAGS = -Wall -I $(USER_CR_DIR) + +LDFLAGS = + +LIB_ECLONE = $(USER_CR_DIR)/libeclone.a + +PROGS = eclone-1 + +all: $(PROGS) + +$(PROGS): %: %.c + $(CC) $(CFLAGS) -o $@ $< $(LIB_ECLONE) $(LDFLAGS) + +clean: + rm -f *.o $(PROGS)
eclone/eclone-1.c new file +119 -0
119 lines not on this page · raw message
eclone/eclone-tests.h new file +66 -0
66 lines not on this page · raw message
Signature · 1 line
1.6.6.1
A message that is not in the archive (sent off-list or not yet received): 20100209193331.GB30005-r/[email protected]
PATCH v2 2/6 : eclone-2: Ensure eclone() fails if selected pid is in use
From: Sukadev Bhattiprolu <[email protected]>
Date: Sat, 30 Jan 2010 12:51:23 -0800
Subject: [PATCH 2/6] eclone-2: Ensure eclone() fails if selected pid is in use
Ensure that eclone() system call fails with -EBUSY if selected pid is in use.
Changelog[v2]:
- Use libeclone.a from user-cr git tree so tests are portable across architectures.
- Fix a few nits identified by Serge Hallyn
--- eclone/Makefile | 2 +- eclone/eclone-2.c | 116 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 117 insertions(+), 1 deletions(-) create mode 100644 eclone/eclone-2.c
eclone/Makefile +1 -1
@@ -10,7 +10,7 @@ LDFLAGS = LIB_ECLONE = $(USER_CR_DIR)/libeclone.a -PROGS = eclone-1 +PROGS = eclone-1 eclone-2 all: $(PROGS)
eclone/eclone-2.c new file +116 -0
116 lines not on this page · raw message
Signature · 1 line
1.6.6.1
PATCH v2 3/6 : Verify eclone() fails if reserved fields are not 0.
In reply to a message not in the archiveFrom: Sukadev Bhattiprolu <[email protected]>
Date: Sat, 30 Jan 2010 12:53:04 -0800
Subject: [PATCH 3/6] eclone-3: Verify eclone() fails if reserved fields are not 0.
To ensure future extendability, we want the unused fields to be 0. Ensure eclone() fails if ->reserved0 field is non-0.
Changelog[v2]:
- Use libeclone.a from user-cr git tree so tests are portable across architectures.
- Fix some nits identified by Serge Hallyn
--- eclone/Makefile | 2 +- eclone/eclone-3.c | 116 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 117 insertions(+), 1 deletions(-) create mode 100644 eclone/eclone-3.c
eclone/Makefile +1 -1
@@ -10,7 +10,7 @@ LDFLAGS = LIB_ECLONE = $(USER_CR_DIR)/libeclone.a -PROGS = eclone-1 eclone-2 +PROGS = eclone-1 eclone-2 eclone-3 all: $(PROGS)
eclone/eclone-3.c new file +116 -0
116 lines not on this page · raw message
Signature · 1 line
1.6.6.1
PATCH v2 4/6 : Verify eclone() fails if clone_flags_high is non-zero
In reply to a message not in the archiveFrom: Sukadev Bhattiprolu <[email protected]>
Date: Mon, 1 Feb 2010 18:10:32 -0800
Subject: [PATCH 4/6] eclone-4: Verify eclone() fails if clone_flags_high is non-zero
To ensure future extendability, we want the unused fields to be 0. Ensure eclone() fails if ->clone_flags_high field is non-0.
Changelog[v2]:
- Use libeclone.a from user-cr git tree so tests are portable across architectures.
- Fix some nits identified by Serge Hallyn
--- eclone/Makefile | 2 +- eclone/eclone-4.c | 115 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 116 insertions(+), 1 deletions(-) create mode 100644 eclone/eclone-4.c
eclone/Makefile +1 -1
@@ -10,7 +10,7 @@ LDFLAGS = LIB_ECLONE = $(USER_CR_DIR)/libeclone.a -PROGS = eclone-1 eclone-2 eclone-3 +PROGS = eclone-1 eclone-2 eclone-3 eclone-4 all: $(PROGS)
eclone/eclone-4.c new file +115 -0
115 lines not on this page · raw message
Signature · 1 line
1.6.6.1
PATCH v2 5/6 : eclone-5: nr_pids must not exceed nesting level
In reply to a message not in the archiveFrom: Sukadev Bhattiprolu <[email protected]>
Date: Mon, 1 Feb 2010 18:13:51 -0800
Subject: [PATCH 5/6] eclone-5: nr_pids must not exceed nesting level
Verify that eclone() fails if nr_pids exceeds the current nesting level of pid namespaces. Also verify that eclone() succeeds in choosing a pid for a process in a descendant pid namespace.
Changelog[v2]:
- Use libeclone.a from user-cr git tree so tests are portable across architectures.
- Fix some nits identified by Serge Hallyn
--- eclone/Makefile | 2 +- eclone/eclone-5.c | 175 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 176 insertions(+), 1 deletions(-) create mode 100644 eclone/eclone-5.c
eclone/Makefile +1 -1
@@ -10,7 +10,7 @@ LDFLAGS = LIB_ECLONE = $(USER_CR_DIR)/libeclone.a -PROGS = eclone-1 eclone-2 eclone-3 eclone-4 +PROGS = eclone-1 eclone-2 eclone-3 eclone-4 eclone-5 all: $(PROGS)
eclone/eclone-5.c new file +175 -0
175 lines not on this page · raw message
Signature · 1 line
1.6.6.1
A message that is not in the archive (sent off-list or not yet received): 20100209193619.GD32274-r/[email protected]
Re: [PATCH 5/6][cr-test][v2]: eclone-5: nr_pids must not exceed nesting level
Quoted 8 lines · Sukadev Bhattiprolu
From: Sukadev Bhattiprolu <[email protected]>
Date: Mon, 1 Feb 2010 18:13:51 -0800
Subject: [PATCH 5/6] eclone-5:nr_pidsmust not exceed nesting levelVerify that
eclone()fails ifnr_pidsexceeds the current nesting level of pid namespaces. Also verify thateclone()succeeds in choosing a pid for a process in a descendant pid namespace.
This is a bit of a shame - it failed for me at first because I was running it inside a container. But there is no way for a task to know it's own nsdepth right?
So I went ahead and pushed these tests (plus a few changes).
thanks,
-serge
A message that is not in the archive (sent off-list or not yet received): 20100209211705.GA32631-r/[email protected]
Re: [PATCH 5/6][cr-test][v2]: eclone-5: nr_pids must not exceed nesting level
Serge E. Hallyn [serue-r/[email protected]] wrote:
| Quoting Sukadev Bhattiprolu ([email protected]): | > | > From: Sukadev Bhattiprolu <[email protected]> | > Date: Mon, 1 Feb 2010 18:13:51 -0800 | > Subject: [PATCH 5/6] eclone-5: nr_pids must not exceed nesting level | > | > Verify that eclone() fails if nr_pids exceeds the current nesting level | > of pid namespaces. Also verify that eclone() succeeds in choosing a pid | > for a process in a descendant pid namespace. | | This is a bit of a shame - it failed for me at first because I was | running it inside a container. But there is no way for a task to | know it's own nsdepth right?
Nope - or at least I don't know of any way.
We could modify the test to set nr_pids to a ridiculously large value just to test that eclone() fails when nr_pids exceeds nesting level.
|
| So I went ahead and pushed these tests (plus a few changes).
Thanks,
Sukadev
A message that is not in the archive (sent off-list or not yet received): 20100210012831.GA20795-r/[email protected]
Re: [PATCH 5/6][cr-test][v2]: eclone-5: nr_pids must not exceed nesting level
Quoted 15 lines · Sukadev Bhattiprolu
Serge E. Hallyn [serue-r/[email protected]] wrote:
| Quoting Sukadev Bhattiprolu ([email protected]): | > | > From: Sukadev Bhattiprolu <[email protected]> | > Date: Mon, 1 Feb 2010 18:13:51 -0800 | > Subject: [PATCH 5/6] eclone-5: nr_pids must not exceed nesting level | > | > Verify that eclone() fails if nr_pids exceeds the current nesting level | > of pid namespaces. Also verify that eclone() succeeds in choosing a pid | > for a process in a descendant pid namespace. | | This is a bit of a shame - it failed for me at first because I was | running it inside a container. But there is no way for a task to | know it's own nsdepth right?
Quoted 4 lines
Nope - or at least I don't know of any way.
We could modify the test to set
nr_pidsto a ridiculously large value just to test thateclone()fails whennr_pidsexceeds nesting level.
Yeah though it's nice to be able to test the boundary conditions.
I suppose it could take an optional nesting level argument - if not specified use 20. Then in documentation recommend that people run
eclone-5 2
from init_pid_ns. The motivation would be to have the automated testing not return false positives!
Quoted 5 lines
| So I went ahead and pushed these tests (plus a few changes).
Thanks,
Sukadev
PATCH v2 6/6 : eclone/runtests.sh: Wrapper script for eclone tests
In reply to a message not in the archiveFrom: Sukadev Bhattiprolu <[email protected]>
Date: Tue, 2 Feb 2010 11:21:07 -0800
Subject: [PATCH 6/6] eclone/runtests.sh: Wrapper script for eclone tests
A simple wrapper script to run all eclone tests in this directory.
--- eclone/runtests.sh | 23 +++++++++++++++++++++++ 1 files changed, 23 insertions(+), 0 deletions(-) create mode 100755 eclone/runtests.sh
eclone/runtests.sh new file +23 -0
@@ -0,0 +1,23 @@ +#!/bin/bash + +TEST_LOG=`mktemp -p . runtests-XXXXXXX`.log + +echo Logfile: $TEST_LOG + +> $TEST_LOG + +TESTS="eclone-1 eclone-2 eclone-3 eclone-4 eclone-5" +#TESTS="eclone-5" + +for t in $TESTS +do + echo "===== Test: $t" >> $TEST_LOG + ./$t >> $TEST_LOG 2>&1 + if [ $? -eq 0 ]; then + echo "Test '$t' PASSED" >> $TEST_LOG + else + echo "Test '$t' FAILED" >> $TEST_LOG + fi +done + +cat $TEST_LOG
Signature · 1 line
1.6.6.1