sw:vec: Make test runner script point to the source

Don't need to make a copy at the build directory to run the test. It
should be pointed to the source.

Change-Id: I97e70a999f998a099af04bf4514d487d7e284677
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 5f2c4bb..5fb669e 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -22,10 +22,7 @@
 
 set(LINKER_SCRIPT "${CMAKE_CURRENT_SOURCE_DIR}/springbok/matcha.ld" CACHE PATH "Linker script for springbok")
 
-set(TEST_RUNNER_SRC ${CMAKE_CURRENT_SOURCE_DIR}/scripts/test_runner.py)
-
-file(COPY ${TEST_RUNNER_SRC}
-     DESTINATION ${CMAKE_CURRENT_BINARY_DIR})
+set(TEST_RUNNER "${CMAKE_CURRENT_SOURCE_DIR}/scripts/test_runner.py" CACHE PATH "Test runner script path")
 
 include(vec_cc_binary)
 include(vec_cc_test)
diff --git a/cmake/vec_cc_test.cmake b/cmake/vec_cc_test.cmake
index 83e03b2..8320d3a 100644
--- a/cmake/vec_cc_test.cmake
+++ b/cmake/vec_cc_test.cmake
@@ -33,29 +33,30 @@
   set(_TIMEOUT ${_RULE_TIMEOUT})
 endif()
 
-find_file(TEST_RUNNER test_runner.py HINTS ${CMAKE_BINARY_DIR})
-find_program(QEMU_RV32 qemu-system-riscv32 HINTS $ENV{OUT}/host/qemu)
-if(QEMU_RV32 AND TEST_RUNNER)
-  add_test(
-    NAME
-      "qemu_${_RULE_NAME}"
-    COMMAND
-      ${TEST_RUNNER} qemu $<TARGET_FILE:${_RULE_NAME}.elf> --qemu-path ${QEMU_RV32} --timeout=${_TIMEOUT}
-  )
-  set_tests_properties("qemu_${_RULE_NAME}" PROPERTIES TIMEOUT ${_TIMEOUT})
-else()
-  message(WARNING "qemu-system-riscv32 doesn't exist. Make sure you build qemu first and start a clean build to enable the qemu test")
-endif()
-find_program(RENODE_EXE Renode.exe HINTS $ENV{OUT}/host/renode)
-if(RENODE_EXE AND TEST_RUNNER)
-  add_test(
-    NAME
-      "renode_${_RULE_NAME}"
-    COMMAND
-      ${TEST_RUNNER} renode $<TARGET_FILE:${_RULE_NAME}.elf> --renode-path ${RENODE_EXE}
-  )
-  set_tests_properties("renode_${_RULE_NAME}" PROPERTIES TIMEOUT ${_TIMEOUT})
-else()
-  message(WARNING "Renode.exe doesn't exist. Make sure you build renode first and start a clean build to enable the renode test")
-endif()
+if(DEFINED TEST_RUNNER)
+  find_program(QEMU_RV32 qemu-system-riscv32 HINTS $ENV{OUT}/host/qemu)
+  if(QEMU_RV32)
+    add_test(
+      NAME
+        "qemu_${_RULE_NAME}"
+      COMMAND
+        ${TEST_RUNNER} qemu $<TARGET_FILE:${_RULE_NAME}.elf> --qemu-path ${QEMU_RV32} --timeout=${_TIMEOUT}
+    )
+    set_tests_properties("qemu_${_RULE_NAME}" PROPERTIES TIMEOUT ${_TIMEOUT})
+  else()
+    message(WARNING "qemu-system-riscv32 doesn't exist. Make sure you build qemu first and start a clean build to enable the qemu test")
+  endif()
+  find_program(RENODE_EXE Renode.exe HINTS $ENV{OUT}/host/renode)
+  if(RENODE_EXE)
+    add_test(
+      NAME
+        "renode_${_RULE_NAME}"
+      COMMAND
+        ${TEST_RUNNER} renode $<TARGET_FILE:${_RULE_NAME}.elf> --renode-path ${RENODE_EXE}
+    )
+    set_tests_properties("renode_${_RULE_NAME}" PROPERTIES TIMEOUT ${_TIMEOUT})
+  else()
+    message(WARNING "Renode.exe doesn't exist. Make sure you build renode first and start a clean build to enable the renode test")
+  endif()
+endif(DEFINED TEST_RUNNER)
 endfunction()