X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=test%2Fresources%2Flinux%2Fapplication.py;h=1393f6a6383391ad8060c80f1d7e0d0b404ef649;hb=1df0acb80ba1c737280390c1277a4a751843eac4;hp=336ce2357c4e5287facbb8c5b3ff38a3ddc253d7;hpb=4896d77f40a611a22f9f1f8f2ae0e63e9008fee1;p=nepi.git diff --git a/test/resources/linux/application.py b/test/resources/linux/application.py old mode 100644 new mode 100755 index 336ce235..1393f6a6 --- a/test/resources/linux/application.py +++ b/test/resources/linux/application.py @@ -1,23 +1,24 @@ -""" - NEPI, a framework to manage network experiments - Copyright (C) 2013 INRIA - - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program. If not, see . +#!/usr/bin/env python +# +# NEPI, a framework to manage network experiments +# Copyright (C) 2013 INRIA +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . +# +# Author: Alina Quereilhac -""" -#!/usr/bin/env python from nepi.execution.ec import ExperimentController from nepi.execution.resource import ResourceState, ResourceAction from nepi.execution.trace import TraceAttr @@ -33,13 +34,13 @@ import unittest class LinuxApplicationTestCase(unittest.TestCase): def setUp(self): - self.fedora_host = 'nepi2.pl.sophia.inria.fr' - self.fedora_user = 'inria_nepi' + self.fedora_host = "nepi2.pl.sophia.inria.fr" + self.fedora_user = "inria_nepi" - self.ubuntu_host = 'roseval.pl.sophia.inria.fr' - self.ubuntu_user = 'alina' + self.ubuntu_host = "roseval.pl.sophia.inria.fr" + self.ubuntu_user = "alina" - self.target = 'nepi5.pl.sophia.inria.fr' + self.target = "nepi5.pl.sophia.inria.fr" @skipIfNotAlive def t_stdout(self, host, user): @@ -68,7 +69,7 @@ class LinuxApplicationTestCase(unittest.TestCase): self.assertTrue(ec.state(node) == ResourceState.STARTED) self.assertTrue(ec.state(app) == ResourceState.FINISHED) - stdout = ec.trace(app, 'stdout') + stdout = ec.trace(app, "stdout") self.assertTrue(stdout.strip() == "HOLA") ec.shutdown() @@ -101,16 +102,16 @@ class LinuxApplicationTestCase(unittest.TestCase): self.assertTrue(ec.state(node) == ResourceState.STARTED) self.assertTrue(ec.state(app) == ResourceState.FINISHED) - stdout = ec.trace(app, 'stdout') - size = ec.trace(app, 'stdout', attr = TraceAttr.SIZE) + stdout = ec.trace(app, "stdout") + size = ec.trace(app, "stdout", attr = TraceAttr.SIZE) self.assertEquals(len(stdout), size) - block = ec.trace(app, 'stdout', attr = TraceAttr.STREAM, block = 5, offset = 1) + block = ec.trace(app, "stdout", attr = TraceAttr.STREAM, block = 5, offset = 1) self.assertEquals(block, stdout[5:10]) - path = ec.trace(app, 'stdout', attr = TraceAttr.PATH) + path = ec.trace(app, "stdout", attr = TraceAttr.PATH) rm = ec.get_resource(app) - p = os.path.join(rm.app_home, 'stdout') + p = os.path.join(rm.app_home, "stdout") self.assertEquals(path, p) ec.shutdown() @@ -201,7 +202,7 @@ class LinuxApplicationTestCase(unittest.TestCase): self.assertTrue(ec.state(server) == ResourceState.FINISHED) self.assertTrue(ec.state(client) == ResourceState.FINISHED) - stdout = ec.trace(client, 'stdout') + stdout = ec.trace(client, "stdout") self.assertTrue(stdout.strip() == "HOLA") ec.shutdown() @@ -221,8 +222,8 @@ class LinuxApplicationTestCase(unittest.TestCase): ec.set(node, "cleanHome", True) ec.set(node, "cleanProcesses", True) - sources = "http://nepi.inria.fr/attachment/wiki/WikiStart/pybindgen-r794.tar.gz " \ - "http://nepi.inria.fr/attachment/wiki/WikiStart/nepi_integration_framework.pdf" + sources = "http://nepi.inria.fr/code/nef/archive/tip.tar.gz " \ + " http://nepi.inria.fr/code/nef/raw-file/8ace577d4079/src/nef/images/menu/connect.png" app = ec.register_resource("LinuxApplication") ec.set(app, "sources", sources) @@ -236,12 +237,12 @@ class LinuxApplicationTestCase(unittest.TestCase): self.assertTrue(ec.state(node) == ResourceState.STARTED) self.assertTrue(ec.state(app) == ResourceState.FINISHED) - err = ec.trace(app, 'http_sources_err') - self.assertTrue(err == "") + exitcode = ec.trace(app, "http_sources_exitcode") + self.assertTrue(exitcode.strip() == "0") - out = ec.trace(app, 'http_sources_out') - self.assertTrue(out.find("pybindgen-r794.tar.gz") > -1) - self.assertTrue(out.find("nepi_integration_framework.pdf") > -1) + out = ec.trace(app, "http_sources_stdout") + self.assertTrue(out.find("tip.tar.gz") > -1) + self.assertTrue(out.find("connect.png") > -1) ec.shutdown() @@ -276,8 +277,6 @@ class LinuxApplicationTestCase(unittest.TestCase): self.t_http_sources(self.ubuntu_host, self.ubuntu_user) - # TODO: test compilation, sources, dependencies, etc!!! - if __name__ == '__main__': unittest.main()