From 24e40c6b70d9b4f7ebf1e02bace5794009b0c1b6 Mon Sep 17 00:00:00 2001 From: Daniil Baturin Date: Wed, 3 Jul 2019 03:11:27 +0700 Subject: Initial commit. --- README.md | 11 +++++++++++ bin/vyos-smoketest | 19 +++++++++++++++++++ scripts/test_module_load.py | 35 +++++++++++++++++++++++++++++++++++ 3 files changed, 65 insertions(+) create mode 100644 README.md create mode 100755 bin/vyos-smoketest create mode 100755 scripts/test_module_load.py diff --git a/README.md b/README.md new file mode 100644 index 000000000..d02557393 --- /dev/null +++ b/README.md @@ -0,0 +1,11 @@ +vyos-smoketest +============== + +This is a set of scripts and test data for sanity checking VyOS builds. + +The main entry point is /usr/bin/vyos-smoketest + +It will try to check for common things that break such as kernel modules not loading, +and print a test report. + +It also comes with a huge reference config that has almost every feature set. diff --git a/bin/vyos-smoketest b/bin/vyos-smoketest new file mode 100755 index 000000000..b8cc36879 --- /dev/null +++ b/bin/vyos-smoketest @@ -0,0 +1,19 @@ +#!/usr/bin/env python3 + +import os +import sys + +test_dir = '/usr/libexec/vyos/tests/smoke' + +tests = ['test_load_modules.py'] + +success = True + +for t in tests: + try: + os.system(os.path.join(test_dir, t)) + except Exception as e: + success = False + +if not success: + sys.exit(1) diff --git a/scripts/test_module_load.py b/scripts/test_module_load.py new file mode 100755 index 000000000..a4f3a62eb --- /dev/null +++ b/scripts/test_module_load.py @@ -0,0 +1,35 @@ +#!/usr/bin/env python3 + +import sys +import os + +MODULES_INTEL = "e1000 e1000e igb ixgb ixgbe ixgbevf i40e i40evf" +MODULES_ACCEL_PPP = "ipoe" +MODULES_MISC = "wireguard" + +modules = { + "intel": ["e1000", "e1000e", "igb", "ixgb", "ixgbe", "ixgbevf", "i40e", "i40evf"], + "accel_ppp": ["ipoe"], + "misc": ["wireguard"] +} + +if __name__ == '__main__': + success = True + + print("[load modules] Test execution started") + for msk in modules: + ms = modules[msk] + for m in ms: + # We want to uncover all modules that fail, + # not fail at the first one + try: + os.system("modprobe {0}".format(m)) + except Exception as e: + print("[load modules] Test [modprobe {0}] failed: {1}".format(module, e)) + success = False + + if not success: + print("Test [load modules] failed") + sys.exit(1) + else: + print("[load modules] Test succeeded") -- cgit v1.2.3