Change check for TIMEOUT to empty string test.

* Set vle_vse test timeout to 500
* Set default timeout to 20

Change-Id: I4e25183f093ac9211874ac0c179b298221631324
diff --git a/cmake/vec_cc_test.cmake b/cmake/vec_cc_test.cmake
index 8857373..1d8b996 100644
--- a/cmake/vec_cc_test.cmake
+++ b/cmake/vec_cc_test.cmake
@@ -26,17 +26,19 @@
     ${_RULE_LINKOPTS}
 )
 
-if(NOT DEFINED ${_RULE_TIMEOUT})
-  set(_RULE_TIMEOUT 20)
+if("${_RULE_TIMEOUT}" STREQUAL "")
+  set(_TIMEOUT 20)
+else()
+  set(_TIMEOUT ${_RULE_TIMEOUT})
 endif()
 
 find_program(QEMU_RV32 qemu-system-riscv32 HINTS $ENV{OUT}/host/qemu REQUIRED)
 find_program(RENODE_EXE Renode.exe HINTS $ENV{OUT}/host/renode REQUIRED)
 add_test(NAME "qemu_${_RULE_NAME}"
-         COMMAND test_runner.py qemu $<TARGET_FILE:${_RULE_NAME}.elf> --qemu-path ${QEMU_RV32})
+         COMMAND test_runner.py qemu $<TARGET_FILE:${_RULE_NAME}.elf> --qemu-path ${QEMU_RV32} --timeout=${_TIMEOUT})
 add_test(NAME "renode_${_RULE_NAME}"
          COMMAND test_runner.py renode $<TARGET_FILE:${_RULE_NAME}.elf> --renode-path ${RENODE_EXE})
-set_tests_properties("renode_${_RULE_NAME}" PROPERTIES TIMEOUT ${_RULE_TIMEOUT})
-set_tests_properties("qemu_${_RULE_NAME}" PROPERTIES TIMEOUT ${_RULE_TIMEOUT})
+set_tests_properties("renode_${_RULE_NAME}" PROPERTIES TIMEOUT ${_TIMEOUT})
+set_tests_properties("qemu_${_RULE_NAME}" PROPERTIES TIMEOUT ${_TIMEOUT})
 
 endfunction()
diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt
index b46da54..afbd117 100644
--- a/tests/CMakeLists.txt
+++ b/tests/CMakeLists.txt
@@ -36,5 +36,6 @@
   LINKOPTS
    -T${LINKER_SCRIPT}
    -Xlinker --defsym=__itcm_length__=256K
-  TIMEOUT 30
+  TIMEOUT
+    500
 )
diff --git a/tests/test_runner.py b/tests/test_runner.py
index 9a3a257..eed5371 100755
--- a/tests/test_runner.py
+++ b/tests/test_runner.py
@@ -21,7 +21,8 @@
                     help="Path to renode simulator")
 parser.add_argument('--qemu-path',
                     help="Path to qemu simulator")
-
+parser.add_argument('--timeout', type=int,
+                    help="Timeout for test", default=1000)
 
 class Simulation: # pylint: disable=too-few-public-methods
     """ Base class for simulation """
@@ -30,7 +31,7 @@
         self.buffer = io.StringIO()
         self.child = None
 
-    def run(self, timeout=120):
+    def run(self, timeout=1000):
         """ Run the simulation command and quit the simulation."""
         self.child = pexpect.spawn(self.simulator_cmd, encoding='utf-8')
         self.child.logfile = self.buffer
@@ -111,7 +112,7 @@
 
     simulator_class = Simulators[args.simulator]
     simulator = simulator_class(simulator_path, args.elf)
-    output = simulator.run()
+    output = simulator.run(timeout=args.timeout)
     print(output)
     if "FAILED" in output:
         sys.exit(1)