unit-test: fix and use CODE_SCAN_DIR

There are two different patterns for doing the equivalent of
    os.path.join(WORKSPACE, UNIT_TEST_PKG)

Convert them all to use the CODE_SCAN_DIR variable and set CODE_SCAN_DIR
using `os.path.join`.

Signed-off-by: Patrick Williams <patrick@stwcx.xyz>
Change-Id: I1f2386f105dae100176247c40092a93c35974422
diff --git a/scripts/unit-test.py b/scripts/unit-test.py
index 79ae521..a710d62 100755
--- a/scripts/unit-test.py
+++ b/scripts/unit-test.py
@@ -1158,7 +1158,7 @@
         def printline(*line):
             pass
 
-    CODE_SCAN_DIR = WORKSPACE + "/" + UNIT_TEST_PKG
+    CODE_SCAN_DIR = os.path.join(WORKSPACE, UNIT_TEST_PKG)
 
     # First validate code formatting if repo has style formatting files.
     # The format-code.sh checks for these files.
@@ -1166,7 +1166,7 @@
         check_call_cmd("./format-code.sh", CODE_SCAN_DIR)
 
     # Check if this repo has a supported make infrastructure
-    pkg = Package(UNIT_TEST_PKG, os.path.join(WORKSPACE, UNIT_TEST_PKG))
+    pkg = Package(UNIT_TEST_PKG, CODE_SCAN_DIR)
     if not pkg.build_system():
         print("No valid build system, exit")
         sys.exit(0)
@@ -1179,11 +1179,7 @@
 
     # Create dependency tree
     dep_tree = DepTree(UNIT_TEST_PKG)
-    build_dep_tree(UNIT_TEST_PKG,
-                   os.path.join(WORKSPACE, UNIT_TEST_PKG),
-                   dep_added,
-                   dep_tree,
-                   BRANCH)
+    build_dep_tree(UNIT_TEST_PKG, CODE_SCAN_DIR, dep_added, dep_tree, BRANCH)
 
     # Reorder Dependency Tree
     for pkg_name, regex_str in DEPENDENCIES_REGEX.items():
@@ -1207,9 +1203,8 @@
 
     # Run any custom CI scripts the repo has, of which there can be
     # multiple of and anywhere in the repository.
-    ci_scripts = find_file(['run-ci.sh', 'run-ci'],
-                           os.path.join(WORKSPACE, UNIT_TEST_PKG))
+    ci_scripts = find_file(['run-ci.sh', 'run-ci'], CODE_SCAN_DIR)
     if ci_scripts:
-        os.chdir(os.path.join(WORKSPACE, UNIT_TEST_PKG))
+        os.chdir(CODE_SCAN_DIR)
         for ci_script in ci_scripts:
             check_call_cmd(ci_script)