[PATCH] pci: maxreadreq: skip test if /sys/bus/pci/devices is not available

Colin King colin.king at canonical.com
Thu Apr 30 09:03:33 UTC 2015


From: Colin Ian King <colin.king at canonical.com>

Rather than exiting with an error we should skip this test if
/sys/bus/pci/devices does not exit, for example, on an ARM64 in a VM.

Signed-off-by: Colin Ian King <colin.king at canonical.com>
---
 src/pci/maxreadreq/maxreadreq.c | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/src/pci/maxreadreq/maxreadreq.c b/src/pci/maxreadreq/maxreadreq.c
index 93745a4..ea9db36 100644
--- a/src/pci/maxreadreq/maxreadreq.c
+++ b/src/pci/maxreadreq/maxreadreq.c
@@ -32,6 +32,16 @@
 #include <fcntl.h>
 #include <inttypes.h>
 
+static int maxreadreq_init(fwts_framework *fw)
+{
+	if (access(FWTS_PCI_DEV_PATH, R_OK) < 0) {
+		fwts_log_info(fw, "Could not access %s, skipping test",
+			FWTS_PCI_DEV_PATH);
+		return FWTS_SKIP;
+	}
+	return FWTS_OK;
+}
+
 /*
  * This test checks if MaxReadReq is set > 128 for non-internal stuff
  * A too low value hurts performance
@@ -141,6 +151,7 @@ static fwts_framework_minor_test maxreadreq_tests[] = {
 };
 
 static fwts_framework_ops maxreadreq_ops = {
+	.init        = maxreadreq_init,
 	.description = "Test firmware has set PCI Express MaxReadReq to a higher value on non-motherboard devices.",
 	.minor_tests = maxreadreq_tests
 };
-- 
2.1.4




More information about the fwts-devel mailing list