Map the error code of CAGenerateToken() to OCStackResult.
[platform/upstream/iotivity.git] / tools / scons / RunTest.py
index 0d9f023..bd2d546 100644 (file)
@@ -43,16 +43,26 @@ def run_test(env, xml_file, test):
 
     test_cmd = os.path.join(build_dir, test)
 
-    if xml_file:
+    have_valgrind = False
+    if env.get('TARGET_OS') not in ['windows']:
+        have_valgrind = True
+
+    if xml_file and have_valgrind:
         # Environment variables to be made available during the
         # Valgrind run.
         valgrind_environment = ''
 
+        # GLib uses a custom memory allocation scheme that can
+        # sometimes confuse Valgrind.  Configure GLib to be Valgrind
+        # friendly.
+        valgrind_environment += 'G_DEBUG=gc-friendly G_SLICE=always-malloc'
+
         # Valgrind suppressions file.
         suppression_file = env.File('#tools/valgrind/iotivity.supp').srcnode().path
 
         # Set up to run the test under Valgrind.
         test_cmd = '%s valgrind --leak-check=full --suppressions=%s --xml=yes --xml-file=%s %s' % (valgrind_environment, suppression_file, xml_file, test_cmd)
-
-    ut = env.Command('ut', None, test_cmd)
-    env.AlwaysBuild('ut')
+    if env.get('TARGET_OS') in ['linux']:
+        env.Depends('ut' + test , os.path.join(build_dir, test))
+    ut = env.Command('ut' + test, None, test_cmd)
+    env.AlwaysBuild('ut' + test)