From fdcf3f258c22796b4cdf979ae2745471a3454956 Mon Sep 17 00:00:00 2001 From: Jean-Philippe NOEL Date: Tue, 11 Dec 2012 10:11:11 +0100 Subject: validation/validlib: modify the version returned by SPC300 plugs, refs #3127 --- validation/validlib/spc300.py | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) (limited to 'validation') diff --git a/validation/validlib/spc300.py b/validation/validlib/spc300.py index a884ade712..ad7e726e76 100644 --- a/validation/validlib/spc300.py +++ b/validation/validlib/spc300.py @@ -66,15 +66,15 @@ def get_model(key): """Gives the model corresponding to a power strip key""" return config["plugs"][key][3] -def get_version(key): +def get_version(key, interface_index = 0): """Gives the version corresponding to a power strip key""" - result = r_execute((key, 0), "cat /proc/net/plc/version\n") + result = r_execute((key, interface_index), "cat /proc/net/plc/version\n") return extract_version(result) def extract_version(string): pattern = "PLC Driver: (.*)\nPLC Firmware: (.*)" (driver, firmware) = re.search(pattern, string).groups() - return driver.strip("\r") + "/" + firmware.strip("\r") + return (driver.strip("\r"), firmware.strip("\r")) def r_ping(key_origin, key_destination): """Ping the plug identified by key_destination from the plug identified by @@ -261,11 +261,11 @@ if __name__ == "__main__": "# \n" "# exit\n") - assert "eoc-0.7.10/eoc-0.7.11" == extract_version("foo\n" - "PLC Driver: eoc-0.7.10\r\n" - "PLC Firmware: eoc-0.7.11\r\n" - "bar") - assert "eoc-0.7.10/eoc-0.7.11" == extract_version("foo\n" - "PLC Driver: eoc-0.7.10\n" - "PLC Firmware: eoc-0.7.11\n" - "bar") + assert ("eoc-0.7.10", "eoc-0.7.11") == extract_version("foo\n" + "PLC Driver: eoc-0.7.10\r\n" + "PLC Firmware: eoc-0.7.11\r\n" + "bar") + assert ("eoc-0.7.10", "eoc-0.7.11") == extract_version("foo\n" + "PLC Driver: eoc-0.7.10\n" + "PLC Firmware: eoc-0.7.11\n" + "bar") -- cgit v1.2.3