diff options
Diffstat (limited to 'test-cli/test')
-rw-r--r-- | test-cli/test/tests/qamper.py | 4 | ||||
-rw-r--r-- | test-cli/test/tests/qaudio.py | 10 | ||||
-rw-r--r-- | test-cli/test/tests/qdmesg.py | 13 | ||||
-rw-r--r-- | test-cli/test/tests/qethernet.py | 4 | ||||
-rw-r--r-- | test-cli/test/tests/qnand.py | 4 | ||||
-rw-r--r-- | test-cli/test/tests/qusb.py | 34 | ||||
-rw-r--r-- | test-cli/test/tests/qusbdual.py | 34 | ||||
-rw-r--r-- | test-cli/test/tests/qwifi.py | 6 |
8 files changed, 52 insertions, 57 deletions
diff --git a/test-cli/test/tests/qamper.py b/test-cli/test/tests/qamper.py index b4d57e3..58054c9 100644 --- a/test-cli/test/tests/qamper.py +++ b/test-cli/test/tests/qamper.py @@ -35,13 +35,13 @@ class Qamper(unittest.TestCase): # get current value (in Amperes) self.current = amp.getCurrent() # save result in a file - with open('/tmp/station/amper.txt', 'w') as outfile: + with open('/mnt/station_ramdisk/amper.txt', 'w') as outfile: n = outfile.write("Current: {} A".format(self.current)) outfile.close() self.__resultlist.append( { "description": "Amperimeter values", - "filepath": "/tmp/station/amper.txt", + "filepath": "/mnt/station_ramdisk/amper.txt", "mimetype": "text/plain" } ) diff --git a/test-cli/test/tests/qaudio.py b/test-cli/test/tests/qaudio.py index f7ae33c..bfbb051 100644 --- a/test-cli/test/tests/qaudio.py +++ b/test-cli/test/tests/qaudio.py @@ -2,7 +2,6 @@ import unittest import sh import wave import contextlib -import time def calc_audio_duration(fname): @@ -28,15 +27,15 @@ class Qaudio(unittest.TestCase): def execute(self): # analize audio file recordtime = calc_audio_duration("/var/lib/hwtest-files/dtmf-13579.wav") + 0.15 - # wait time before playing - time.sleep(1) + # previous play to estabilise audio lines + sh.aplay("/var/lib/hwtest-files/dtmf-13579.wav") # play and record p1 = sh.aplay("/var/lib/hwtest-files/dtmf-13579.wav", _bg=True) - p2 = sh.arecord("-r", 8000, "-d", recordtime, "/tmp/station/recorded.wav", _bg=True) + p2 = sh.arecord("-r", 8000, "-d", recordtime, "/mnt/station_ramdisk/recorded.wav", _bg=True) p1.wait() p2.wait() if p1.exit_code == 0 and p2.exit_code == 0: - p = sh.multimon("-t", "wav", "-a", "DTMF", "/tmp/station/recorded.wav", "-q") + p = sh.multimon("-t", "wav", "-a", "DTMF", "/mnt/station_ramdisk/recorded.wav", "-q") if p.exit_code == 0: lines = p.stdout.decode('ascii').splitlines() self.__dtmf_secuence_result = [] @@ -49,6 +48,7 @@ class Qaudio(unittest.TestCase): if a != b: self.fail("failed: sent and received DTMF sequence don't match.") else: + print(self.__dtmf_secuence_result) self.fail("failed: received DTMF sequence is shorter than expected.") else: self.fail("failed: unable to use multimon command.") diff --git a/test-cli/test/tests/qdmesg.py b/test-cli/test/tests/qdmesg.py index 8117deb..b35f1ff 100644 --- a/test-cli/test/tests/qdmesg.py +++ b/test-cli/test/tests/qdmesg.py @@ -17,19 +17,14 @@ class Qdmesg: print("running dmesg test") self.pgObj.run_test(self.params["testidctl"], self.params["testid"]) # delete previous file - if path.exists("/tmp/station/dmesg.txt"): - os.remove("/tmp/station/dmesg.txt") + if path.exists("/mnt/station_ramdisk/dmesg.txt"): + os.remove("/mnt/station_ramdisk/dmesg.txt") # generate file - p = sh.dmesg("--color=never", _out="/tmp/station/dmesg.txt") + p = sh.dmesg("--color=never", _out="/mnt/station_ramdisk/dmesg.txt") if p.exit_code == 0: - # save result - # with open('/tmp/station/dmesg.txt', 'w') as outfile: - # n = outfile.write(p.stdout.decode('ascii')) - # outfile.close() - # save dmesg result in DB self.pgObj.upload_result_file(self.params["testidctl"], self.params["testid"], "dmesg output", - "/tmp/station/dmesg.txt", "text/plain") + "/mnt/station_ramdisk/dmesg.txt", "text/plain") self.pgObj.finish_test(self.params["testidctl"], self.params["testid"], "TEST_COMPLETE", "") print("success dmesg test") else: diff --git a/test-cli/test/tests/qethernet.py b/test-cli/test/tests/qethernet.py index 3b2f197..d38de34 100644 --- a/test-cli/test/tests/qethernet.py +++ b/test-cli/test/tests/qethernet.py @@ -52,13 +52,13 @@ class Qethernet(unittest.TestCase): data = json.loads(p.stdout.decode('ascii')) self.__bwreal = float(data['end']['sum_received']['bits_per_second'])/1024/1024 # save result file - with open('/tmp/station/ethernet-iperf3.json', 'w') as outfile: + with open('/mnt/station_ramdisk/ethernet-iperf3.json', 'w') as outfile: json.dump(data, outfile, indent=4) outfile.close() self.__resultlist.append( { "description": "iperf3 output", - "filepath": "/tmp/station/ethernet-iperf3.json", + "filepath": "/mnt/station_ramdisk/ethernet-iperf3.json", "mimetype": "application/json" } ) diff --git a/test-cli/test/tests/qnand.py b/test-cli/test/tests/qnand.py index 8c78e2b..988ab60 100644 --- a/test-cli/test/tests/qnand.py +++ b/test-cli/test/tests/qnand.py @@ -22,13 +22,13 @@ class Qnand(unittest.TestCase): try: p = sh.nandtest("-m", self.__device) # save result - with open('/tmp/station/nand-nandtest.txt', 'w') as outfile: + with open('/mnt/station_ramdisk/nand-nandtest.txt', 'w') as outfile: n = outfile.write(p.stdout.decode('ascii')) outfile.close() self.__resultlist.append( { "description": "nandtest output", - "filepath": "/tmp/station/nand-nandtest.txt", + "filepath": "/mnt/station_ramdisk/nand-nandtest.txt", "mimetype": "text/plain" } ) diff --git a/test-cli/test/tests/qusb.py b/test-cli/test/tests/qusb.py index b5d152e..6302012 100644 --- a/test-cli/test/tests/qusb.py +++ b/test-cli/test/tests/qusb.py @@ -34,8 +34,8 @@ class Qusb(unittest.TestCase): # error = 1 means "no found" pass # mount the device - sh.mkdir("-p", "/tmp/station/pendrive") - p = sh.mount(device, "/tmp/station/pendrive") + sh.mkdir("-p", "/mnt/station_ramdisk/pendrive") + p = sh.mount(device, "/mnt/station_ramdisk/pendrive") if p.exit_code != 0: self.fail("failed: Unable to mount the USB memory device.") # execute test @@ -44,48 +44,48 @@ class Qusb(unittest.TestCase): try: p = sh.cp("/var/lib/hwtest-files/usbdatatest.bin", "/var/lib/hwtest-files/usbdatatest.bin.md5", - "/tmp/station/pendrive") + "/mnt/station_ramdisk/pendrive") except sh.ErrorReturnCode as e: try: - sh.umount("/tmp/station/pendrive") + sh.umount("/mnt/station_ramdisk/pendrive") except sh.ErrorReturnCode: pass - sh.rmdir("/tmp/station/pendrive") + sh.rmdir("/mnt/station_ramdisk/pendrive") self.fail("failed: Unable to copy files to the USB memory device.") # check if the device is still mounted - if not os.path.ismount("/tmp/station/pendrive"): - sh.rm("/tmp/station/pendrive/*") - sh.rmdir("/tmp/station/pendrive") + if not os.path.ismount("/mnt/station_ramdisk/pendrive"): + sh.rm("/mnt/station_ramdisk/pendrive/*") + sh.rmdir("/mnt/station_ramdisk/pendrive") self.fail("failed: USB device unmounted during/after copying files.") # check MD5 try: - p = sh.md5sum("/tmp/station/pendrive/usbdatatest.bin") + p = sh.md5sum("/mnt/station_ramdisk/pendrive/usbdatatest.bin") except sh.ErrorReturnCode as e: try: - sh.umount("/tmp/station/pendrive") + sh.umount("/mnt/station_ramdisk/pendrive") except sh.ErrorReturnCode: pass - sh.rmdir("/tmp/station/pendrive") + sh.rmdir("/mnt/station_ramdisk/pendrive") self.fail("failed: Unable to calculate MD5 of the copied file.") newmd5 = p.stdout.decode().split(" ")[0] - with open('/tmp/station/pendrive/usbdatatest.bin.md5', 'r') as outfile: + with open('/mnt/station_ramdisk/pendrive/usbdatatest.bin.md5', 'r') as outfile: oldmd5 = outfile.read().rstrip("\n") outfile.close() if newmd5 != oldmd5: try: - sh.umount("/tmp/station/pendrive") + sh.umount("/mnt/station_ramdisk/pendrive") except sh.ErrorReturnCode: pass - sh.rmdir("/tmp/station/pendrive") + sh.rmdir("/mnt/station_ramdisk/pendrive") self.fail("failed: MD5 check failed.") # delete copied files - sh.rm("-f", "/tmp/station/pendrive/usbdatatest.bin", "/tmp/station/pendrive/usbdatatest.bin.md5") + sh.rm("-f", "/mnt/station_ramdisk/pendrive/usbdatatest.bin", "/mnt/station_ramdisk/pendrive/usbdatatest.bin.md5") # Finish try: - sh.umount("/tmp/station/pendrive") + sh.umount("/mnt/station_ramdisk/pendrive") except sh.ErrorReturnCode: pass - sh.rmdir("/tmp/station/pendrive") + sh.rmdir("/mnt/station_ramdisk/pendrive") def getresults(self): return self.__resultlist diff --git a/test-cli/test/tests/qusbdual.py b/test-cli/test/tests/qusbdual.py index 842d514..054d7f4 100644 --- a/test-cli/test/tests/qusbdual.py +++ b/test-cli/test/tests/qusbdual.py @@ -32,45 +32,45 @@ class Qusbdual(unittest.TestCase): self.fail("failed: could not find any mass storage gadget") device = p.stdout.decode().split(" ")[0] # mount the mass storage gadget - sh.mkdir("-p", "/tmp/station/hdd_gadget") - p = sh.mount("-o", "ro", "/dev/" + device, "/tmp/station/hdd_gadget") + sh.mkdir("-p", "/mnt/station_ramdisk/hdd_gadget") + p = sh.mount("-o", "ro", "/dev/" + device, "/mnt/station_ramdisk/hdd_gadget") if p.exit_code != 0: self.fail("failed: Unable to mount the mass storage gadget.") # execute test for i in range(int(self.__repetitions)): # copy files try: - p = sh.cp("/tmp/station/hdd_gadget/usb-test.bin", "/tmp/station/hdd_gadget/usb-test.bin.md5", + p = sh.cp("/mnt/station_ramdisk/hdd_gadget/usb-test.bin", "/mnt/station_ramdisk/hdd_gadget/usb-test.bin.md5", "/tmp/stationnfs") except sh.ErrorReturnCode as e: - sh.umount("/tmp/station/hdd_gadget") - sh.rmdir("/tmp/station/hdd_gadget") + sh.umount("/mnt/station_ramdisk/hdd_gadget") + sh.rmdir("/mnt/station_ramdisk/hdd_gadget") self.fail("failed: Unable to copy files through USB.") # check if the device is still mounted - if not os.path.ismount("/tmp/station/hdd_gadget"): - sh.rm("/tmp/station/hdd_gadget/*") - sh.rmdir("/tmp/station/hdd_gadget") + if not os.path.ismount("/mnt/station_ramdisk/hdd_gadget"): + sh.rm("/mnt/station_ramdisk/hdd_gadget/*") + sh.rmdir("/mnt/station_ramdisk/hdd_gadget") self.fail("failed: USB device unmounted during/after copying files.") # Check md5 try: - p = sh.md5sum("/tmp/stationnfs/usb-test.bin") + p = sh.md5sum("/mnt/station_nfsdisk/usb-test.bin") except sh.ErrorReturnCode as e: - sh.umount("/tmp/station/hdd_gadget") - sh.rmdir("/tmp/station/hdd_gadget") + sh.umount("/mnt/station_ramdisk/hdd_gadget") + sh.rmdir("/mnt/station_ramdisk/hdd_gadget") self.fail("failed: Unable to calculate MD5 of the copied file.") newmd5 = p.stdout.decode().split(" ")[0] - with open('/tmp/station/hdd_gadget/usb-test.bin.md5', 'r') as outfile: + with open('/mnt/station_ramdisk/hdd_gadget/usb-test.bin.md5', 'r') as outfile: oldmd5 = outfile.read().rstrip("\n") outfile.close() if newmd5 != oldmd5: - sh.umount("/tmp/station/hdd_gadget") - sh.rmdir("/tmp/station/hdd_gadget") + sh.umount("/mnt/station_ramdisk/hdd_gadget") + sh.rmdir("/mnt/station_ramdisk/hdd_gadget") self.fail("failed: MD5 check failed.") # delete copied files - sh.rm("-f", "/tmp/stationnfs/usb-test.bin", "/tmp/stationnfs/usb-test.bin.md5") + sh.rm("-f", "/mnt/station_nfsdisk/usb-test.bin", "/mnt/station_nfsdisk/usb-test.bin.md5") # Finish - sh.umount("/tmp/station/hdd_gadget") - sh.rmdir("/tmp/station/hdd_gadget") + sh.umount("/mnt/station_ramdisk/hdd_gadget") + sh.rmdir("/mnt/station_ramdisk/hdd_gadget") def getresults(self): return self.__resultlist diff --git a/test-cli/test/tests/qwifi.py b/test-cli/test/tests/qwifi.py index eb1f0bf..4522057 100644 --- a/test-cli/test/tests/qwifi.py +++ b/test-cli/test/tests/qwifi.py @@ -51,7 +51,7 @@ class Qwifi(unittest.TestCase): # execute iperf command against the server try: p = sh.iperf3("-c", self.__serverip, "-n", self.__numbytestx, "-f", "m", "-p", self.__port, - "-J", _timeout=20) + "-J", _timeout=30) except sh.TimeoutException: self.fail("failed: iperf timeout reached") @@ -63,13 +63,13 @@ class Qwifi(unittest.TestCase): data = json.loads(p.stdout.decode('ascii')) self.__bwreal = float(data['end']['sum_received']['bits_per_second']) / 1024 / 1024 # save result file - with open('/tmp/station/wifi-iperf3.json', 'w') as outfile: + with open('/mnt/station_ramdisk/wifi-iperf3.json', 'w') as outfile: json.dump(data, outfile, indent=4) outfile.close() self.__resultlist.append( { "description": "iperf3 output", - "filepath": "/tmp/station/wifi-iperf3.json", + "filepath": "/mnt/station_ramdisk/wifi-iperf3.json", "mimetype": "application/json" } ) |