5 from common import TestCommon
6 from barrelfish import BootModules
7 from results import PassFailResult
10 class TftpClientTest(TestCommon):
11 '''Barrelfish TFTP client test'''
14 _filename = "hello.txt"
15 _filecontents = "Hello world via TFTP!"
17 def setup_tftp_file(self, tftpdir):
18 with open(os.path.join(tftpdir, self._filename), 'w') as f:
19 for x in range(0, 1000):
20 f.write(self._filecontents)
23 def setup(self, build, machine, testdir):
24 super(TftpClientTest, self).setup(build, machine, testdir)
25 self.setup_tftp_file(machine.get_tftp_dir())
27 def get_modules(self, build, machine):
28 modules = super(TftpClientTest, self).get_modules(build, machine)
29 tftpdir = machine._operations.get_tftp_subdir()
30 modules.add_module("tests/tftpclient",
31 ['--server=tftp://10.110.4.4:69',
32 '--file=/%s/hello.txt' % tftpdir ])
33 modules.add_module("e1000n", ["auto"])
34 modules.add_module("NGD_mng", ["auto"])
35 modules.add_module("netd", ["auto"])
38 def is_finished(self, line):
39 if 'TFTP TEST DONE.' in line:
44 def get_finish_string(self):
45 return 'TFTP TEST DONE.'
47 def process_data(self, testdir, rawiter):
50 if self.get_finish_string() in line:
53 return PassFailResult(passed)