build: Add infrastructure for building automated tests.
[gps-watch.git] / SConscript.test
diff --git a/SConscript.test b/SConscript.test
new file mode 100644 (file)
index 0000000..28ddfd7
--- /dev/null
@@ -0,0 +1,29 @@
+Import('env')
+env = env.Clone()
+
+env.Append(RUSTCFLAGS = [
+    '-g',
+    '-C', 'opt-level=s',
+])
+
+SConscript('SConscript.libcommon.rs', exports='env', duplicate=0)
+
+test_source_files = [
+    'test/main.rs', # Must be listed first (see below).
+]
+
+test_env = env.Clone()
+
+test_env.Append(RUSTCFLAGS = [
+    '-L', '$LIBPATH',
+    '--test',
+])
+
+test = test_env.Rustc('gps-watch-test', test_source_files[0])
+
+for f in test_source_files:
+    Depends(test, f)
+
+Depends(test, 'libcommon.rlib')
+
+Default(test)