From 215ac124453c2e74007faba6e4943e04fca243dd Mon Sep 17 00:00:00 2001 From: Simon Gerber Date: Thu, 4 May 2017 14:11:35 +0200 Subject: [PATCH] Add simple tftp client test Signed-off-by: Simon Gerber --- tools/harness/tests/tftp.py | 46 +++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 46 insertions(+), 0 deletions(-) create mode 100644 tools/harness/tests/tftp.py diff --git a/tools/harness/tests/tftp.py b/tools/harness/tests/tftp.py new file mode 100644 index 0000000..fbde7e5 --- /dev/null +++ b/tools/harness/tests/tftp.py @@ -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) -- 1.7.2.5