format-code: ensure default used if no other found
The default format-code.sh provided by this repo is installed in the
WORKSPACE dir (which is not searched). Use the default script if no
other one is provided by the repo under test.
Tested:
- Verified default was run when no other was present
- Verified the one in the repo under test was used when present
Signed-off-by: Andrew Geissler <geissonator@yahoo.com>
Change-Id: I064d72197aaccee50943221d595a8b5ab56dc917
diff --git a/scripts/unit-test.py b/scripts/unit-test.py
index 16ddd53..1306ddf 100755
--- a/scripts/unit-test.py
+++ b/scripts/unit-test.py
@@ -1165,6 +1165,11 @@
if FORMAT_CODE:
format_scripts = find_file(['format-code.sh', 'format-code'],
CODE_SCAN_DIR)
+
+ # use default format-code.sh if no other found
+ if not format_scripts:
+ format_scripts.append(os.path.join(WORKSPACE, "format-code.sh"))
+
for f in format_scripts:
check_call_cmd(f, CODE_SCAN_DIR)