From 342187d6e7ce34d4fdf403952637659b93aa4bee Mon Sep 17 00:00:00 2001 From: Thierry Parmentelat Date: Thu, 15 Oct 2015 16:33:14 +0200 Subject: [PATCH] resurrecting a minimal test infra - starting with linux node and application --- Makefile | 26 ++++++++++----------- test/infra-setup.md | 36 +++++++++++++++++++++++++++++ test/resources/linux/application.py | 18 +++++++-------- test/resources/linux/node.py | 6 ++--- 4 files changed, 60 insertions(+), 26 deletions(-) create mode 100644 test/infra-setup.md diff --git a/Makefile b/Makefile index bafeed92..aa5cb1d2 100644 --- a/Makefile +++ b/Makefile @@ -1,21 +1,9 @@ SRCDIR = $(CURDIR)/src TESTDIR = $(CURDIR)/test TESTLIB = $(TESTDIR)/lib -BUILDDIR = $(CURDIR)/build +BUILDDIR = $(CURDIR)/build/lib DISTDIR = $(CURDIR)/dist -SUBBUILDDIR = $(shell python -c 'import distutils.util, sys; \ - print "lib.%s-%s" % (distutils.util.get_platform(), \ - sys.version[0:3])') -PYTHON25 := $(shell python -c 'import sys; v = sys.version_info; \ - print (1 if v[0] <= 2 and v[1] <= 5 else 0)') - -ifeq ($(PYTHON25),0) -BUILDDIR := $(BUILDDIR)/$(SUBBUILDDIR) -else -BUILDDIR := $(BUILDDIR)/lib -endif - PYPATH = $(BUILDDIR):$(TESTLIB):$(PYTHONPATH) COVERAGE = $(or $(shell which coverage), $(shell which python-coverage), \ coverage) @@ -33,9 +21,19 @@ test: all PYTHONPATH="$(PYPATH)" $$i -v || retval=$$?; \ done; exit $$retval +ifeq ($(file),) +test-one: + echo Run $(make) $@ file=test/some/path +else test-one: all echo $(file) $(case) PYTHONPATH="$(PYPATH)" $(file) $(case) +endif + +test-app: + $(MAKE) test-one file=test/resources/linux/application.py case=$(case) +test-node: + $(MAKE) test-one file=test/resources/linux/node.py case=$(case) coverage: all rm -f .coverage @@ -48,7 +46,7 @@ coverage: all rm -f .coverage clean: - rm -f `find -name \*.pyc` .coverage *.pcap + rm -f $$(find . -name '*.pyc') .coverage *.pcap rm -rf "$(BUILDDIR)" distclean: clean diff --git a/test/infra-setup.md b/test/infra-setup.md new file mode 100644 index 00000000..3b5a6dda --- /dev/null +++ b/test/infra-setup.md @@ -0,0 +1,36 @@ +# Test infra setup + +As a first attempt to resurrect even if partially some automated tests for nepi, I have + +* focused on the unit tests about + +* created 2 VMs (in stupeflip) +* named `fedora` (f22) and `ubuntu` (vivid) + +# fedora + + create-vm.sh -f f22 fedora + lce fedora + adduser inria_nepi + yum -y install wget rsync + chmod 4755 /bin/ping + cat > /etc/sudoers.d/inria_nepi << EOF + inria_nepi ALL=(ALL) NOPASSWD: ALL + EOF + +# ubuntu + +Essentially identical, except + +* based on vivid (this is 1 week before wily..) +* `adduser -m inria_nepi` otherwise no homedir is created +* no need to mess with `ping` +* `wget` was already there; did install `rsync` although I have no immediate need for it + +# results + +with all this in place, and with official release 3.2.8 I am getting, referring to `make` targets + +* `test-node` : 19 tests passed in 194s +* `test-app` : 15 tests passed in 170s + \ No newline at end of file diff --git a/test/resources/linux/application.py b/test/resources/linux/application.py index 4bda4f9d..f98c1c69 100755 --- a/test/resources/linux/application.py +++ b/test/resources/linux/application.py @@ -31,13 +31,13 @@ import unittest class LinuxApplicationTestCase(unittest.TestCase): def setUp(self): - self.fedora_host = "nepi2.pl.sophia.inria.fr" + self.fedora_host = "fedora.pl.sophia.inria.fr" self.fedora_user = "inria_nepi" - self.ubuntu_host = "roseval.pl.sophia.inria.fr" + self.ubuntu_host = "ubuntu.pl.sophia.inria.fr" self.ubuntu_user = "inria_nepi" - self.target = "nepi5.pl.sophia.inria.fr" + self.target = "nepi.pl.sophia.inria.fr" @skipIfNotAlive def t_stdout(self, host, user): @@ -238,8 +238,8 @@ main (void) ec.set(node, "cleanExperiment", True) ec.set(node, "cleanProcesses", True) - sources = "http://yans.pl.sophia.inria.fr/code/nef/archive/tip.tar.gz;" \ - "http://yans.pl.sophia.inria.fr/code/nef/raw-file/8ace577d4079/src/nef/images/menu/connect.png" + sources = "http://mirror.onelab.eu/third-party/nepi-tip.tgz;" \ + "http://mirror.onelab.eu/third-party/nepi-connect.png" app = ec.register_resource("linux::Application") ec.set(app, "sources", sources) @@ -261,12 +261,12 @@ main (void) self.assertTrue(exitcode.strip() == "0") out = ec.trace(app, "deploy_stdout") - self.assertTrue(out.find("tip.tar.gz") > -1) - self.assertTrue(out.find("connect.png") > -1) + self.assertTrue(out.find("nepi-tip.tgz") > -1) + self.assertTrue(out.find("nepi-connect.png") > -1) stdout = ec.trace(app, "stdout") - self.assertTrue(stdout.find("tip.tar.gz") > -1) - self.assertTrue(stdout.find("connect.png") > -1) + self.assertTrue(stdout.find("nepi-tip.tgz") > -1) + self.assertTrue(stdout.find("nepi-connect.png") > -1) ec.shutdown() diff --git a/test/resources/linux/node.py b/test/resources/linux/node.py index 11b66bb5..02a27331 100755 --- a/test/resources/linux/node.py +++ b/test/resources/linux/node.py @@ -31,13 +31,13 @@ import unittest class LinuxNodeTestCase(unittest.TestCase): def setUp(self): - self.fedora_host = "nepi2.pl.sophia.inria.fr" + self.fedora_host = "fedora.pl.sophia.inria.fr" self.fedora_user = "inria_nepi" - self.ubuntu_host = "roseval.pl.sophia.inria.fr" + self.ubuntu_host = "ubuntu.pl.sophia.inria.fr" self.ubuntu_user = "inria_nepi" - self.target = "nepi5.pl.sophia.inria.fr" + self.target = "nepi.pl.sophia.inria.fr" @skipIfNotAlive def t_execute(self, host, user): -- 2.43.0