Add simple tftp client test
authorSimon Gerber <simon.gerber@inf.ethz.ch>
Thu, 4 May 2017 12:11:35 +0000 (14:11 +0200)
committerSimon Gerber <simon.gerber@inf.ethz.ch>
Thu, 4 May 2017 12:11:41 +0000 (14:11 +0200)
Signed-off-by: Simon Gerber <simon.gerber@inf.ethz.ch>

tools/harness/tests/tftp.py [new file with mode: 0644]

diff --git a/tools/harness/tests/tftp.py b/tools/harness/tests/tftp.py
new file mode 100644 (file)
index 0000000..fbde7e5
--- /dev/null
@@ -0,0 +1,46 @@
+
+
+import os
+import tests
+from common import TestCommon
+from barrelfish import BootModules
+from results import PassFailResult
+
+@tests.add_test
+class TftpClientTest(TestCommon):
+    '''Barrelfish TFTP client test'''
+    name = "tftpclient"
+
+    _filename = "hello.txt"
+    _filecontents = "Hello world via TFTP!"
+
+    def setup_tftp_file(self, tftpdir):
+        with open(os.path.join(tftpdir, self._filename), 'w') as f:
+            f.write(self._filecontents)
+
+
+    def setup(self, build, machine, testdir):
+        super(TftpClientTest, self).setup(build, machine, testdir)
+        self.setup_tftp_file(machine.get_tftp_dir())
+
+    def get_modules(self, build, machine):
+        modules = super(TftpClientTest, self).get_modules(build, machine)
+        tftpdir = machine._operations.get_tftp_subdir()
+        modules.add_module("tests/tftpclient",
+                ['--server=tftp://10.110.4.4:69',
+                 '--file=/%s/hello.txt' % tftpdir ])
+        modules.add_module("e1000n", ["auto"])
+        modules.add_module("NGD_mng", ["auto"])
+        modules.add_module("netd", ["auto"])
+        return modules
+
+    def get_finish_string(self):
+        return "TFTP TEST DONE."
+
+    def process_data(self, testdir, rawiter):
+        passed = False
+        for line in rawiter:
+            if self._filecontents in line:
+                passed = True
+
+        return PassFailResult(passed)