harness: tftp test: actually check that we got the file contents we expect release2017-05-05
authorSimon Gerber <simon.gerber@inf.ethz.ch>
Fri, 5 May 2017 07:50:37 +0000 (09:50 +0200)
committerSimon Gerber <simon.gerber@inf.ethz.ch>
Fri, 5 May 2017 09:02:44 +0000 (11:02 +0200)
Signed-off-by: Simon Gerber <simon.gerber@inf.ethz.ch>

tools/harness/tests/tftp.py
usr/tests/tftpclient/main.c

index 025cd43..dffda35 100644 (file)
@@ -16,8 +16,7 @@ class TftpClientTest(TestCommon):
 
     def setup_tftp_file(self, tftpdir):
         with open(os.path.join(tftpdir, self._filename), 'w') as f:
-            for x in range(0, 1000):
-                f.write(self._filecontents)
+            f.write(self._filecontents)
 
 
     def setup(self, build, machine, testdir):
@@ -35,19 +34,13 @@ class TftpClientTest(TestCommon):
         modules.add_module("netd", ["auto"])
         return modules
 
-    def is_finished(self, line):
-        if 'TFTP TEST DONE.' in line:
-            return True
-        else:
-            return False
-
     def get_finish_string(self):
         return 'TFTP TEST DONE.'
 
     def process_data(self, testdir, rawiter):
         passed = False
         for line in rawiter:
-            if self.get_finish_string() in line:
+            if self._filecontents in line:
                 passed = True
 
         return PassFailResult(passed)
index 5884a53..cdb557b 100644 (file)
@@ -77,6 +77,8 @@ int main(int argc, char *argv[])
 
     debug_printf("TFTP READFILE: %zu bytes\n", size);
 
+    debug_printf("TFTP FILE CONTENTS: %s\n", buffer);
+
     debug_printf("TFTP TEST DONE. \n");
 
     // prevent main exit since we do not have