summaryrefslogtreecommitdiff
path: root/test-cli/test
diff options
context:
space:
mode:
Diffstat (limited to 'test-cli/test')
-rw-r--r--test-cli/test/flashers/__init__.py0
-rw-r--r--test-cli/test/flashers/flasheeprom.py56
-rw-r--r--test-cli/test/flashers/flashmemory.py12
-rw-r--r--test-cli/test/tasks/generatedmesg.py2
4 files changed, 1 insertions, 69 deletions
diff --git a/test-cli/test/flashers/__init__.py b/test-cli/test/flashers/__init__.py
deleted file mode 100644
index e69de29..0000000
--- a/test-cli/test/flashers/__init__.py
+++ /dev/null
diff --git a/test-cli/test/flashers/flasheeprom.py b/test-cli/test/flashers/flasheeprom.py
deleted file mode 100644
index 71c1bdd..0000000
--- a/test-cli/test/flashers/flasheeprom.py
+++ /dev/null
@@ -1,56 +0,0 @@
-import os
-import binascii
-from test.helpers.globalVariables import globalVar
-
-
-def _generate_data_bytes(boarduuid, mac0, mac1):
- data = bytearray()
- data += (2029785358).to_bytes(4, 'big') # magicid --> 0x78FC110E
- data += bytearray([0, 0, 0, 0]) # crc32 = 0
- data += bytearray(boarduuid + "\0",
- 'ascii') # uuid --> 'c0846c8a-5fa5-11ea-8576-f8b156ac62d7' and \0 at the end
- data += binascii.unhexlify(mac0.replace(':', '')) # mac0 --> 'f8:b1:56:ac:62:d7'
- if mac1 is not None:
- data += binascii.unhexlify(mac1.replace(':', '')) # mac1 --> 'f8:b1:56:ac:62:d7'
- else:
- data += bytearray([0, 0, 0, 0, 0, 0]) # mac1 --> 0:0:0:0:0:0
- # calculate crc
- crc = (binascii.crc32(data, 0)).to_bytes(4, 'big')
- data[4:8] = crc
- return data
-
-
-def _generate_output_data(data_rx):
- boarduuid = data_rx[8:44].decode('ascii') # no 8:45 porque el \0 final hace que no funcione postgresql
- mac0 = binascii.hexlify(data_rx[45:51]).decode('ascii')
- mac1 = binascii.hexlify(data_rx[51:57]).decode('ascii')
- smac0 = ':'.join(mac0[i:i + 2] for i in range(0, len(mac0), 2))
- smac1 = ':'.join(mac1[i:i + 2] for i in range(0, len(mac1), 2))
- eepromdata = "UUID " + boarduuid + " , MAC0 " + smac0 + " , MAC1 " + smac1
-
- return eepromdata
-
-
-# returns exitcode and data saved into eeprom
-def flash_eeprom(eeprompath, boarduuid, mac0, mac1=None):
- print("Start programming Eeprom...")
- # check if eeprompath is correct
- if os.path.isfile(eeprompath):
- # create u-boot data struct
- data = _generate_data_bytes(boarduuid, mac0, mac1)
- # write into eeprom and read back
- f = open(eeprompath, "r+b")
- f.write(data)
- f.seek(0)
- data_rx = f.read(57)
- for i in range(57):
- if data_rx[i] != data[i]:
- print("Error while programming eeprom memory.")
- return 1, None
- print("Eeprom programmed succesfully.")
- # generated eeprom read data
- eepromdata = _generate_output_data(data_rx)
- return 0, eepromdata
- else:
- print("Eeprom memory not found.")
- return 1, None
diff --git a/test-cli/test/flashers/flashmemory.py b/test-cli/test/flashers/flashmemory.py
deleted file mode 100644
index 3be56d7..0000000
--- a/test-cli/test/flashers/flashmemory.py
+++ /dev/null
@@ -1,12 +0,0 @@
-import sh
-
-
-def flash_memory(imagepath):
- print("Start programming Nand memory...")
- p = sh.bash("/usr/bin/igep-flash", "--skip-nandtest", "--image", imagepath)
- if p.exit_code != 0:
- print("Flasher: Could not complete flashing task.")
- return 1
- else:
- print("Flasher: NAND memory flashed succesfully.")
- return 0
diff --git a/test-cli/test/tasks/generatedmesg.py b/test-cli/test/tasks/generatedmesg.py
index f0a3418..aa9d9ce 100644
--- a/test-cli/test/tasks/generatedmesg.py
+++ b/test-cli/test/tasks/generatedmesg.py
@@ -3,7 +3,7 @@ import sh
def generate_dmesg(tidctl, pgObj):
print("Start getting DMESG...")
- p = sh.dmesg()
+ p = sh.dmesg("--color=never")
if p.exit_code != 0:
print("DMESG: Unknown error.")
return 1