]> git.mdlowis.com Git - proto/gir.git/commitdiff
Setup unit test framework
authorMike D. Lowis <mike.lowis@gentex.com>
Thu, 24 Sep 2015 14:03:22 +0000 (10:03 -0400)
committerMike D. Lowis <mike.lowis@gentex.com>
Thu, 24 Sep 2015 14:03:22 +0000 (10:03 -0400)
.gitmodules
build.rb
modules/atf [new submodule]
source/gir.c
tests/main.c [new file with mode: 0644]

index 3806bc394f8a81a611723f272ca9e7915b1735a0..48ebd4b01f8b65c4db5a2de579bb68a771573880 100644 (file)
@@ -1,3 +1,6 @@
 [submodule "modules/build-system"]
     path = modules/build-system
     url = https://github.com/mikedlowis/build-system.git
+[submodule "modules/atf"]
+       path = modules/atf
+       url = https://github.com/mikedlowis/atf.git
index 8c026f1f4e4b644a33320ccf13d7e06b5a2dde15..698cd795f7978fe0d8bf8b862c76e7ade5bde6b6 100755 (executable)
--- a/build.rb
+++ b/build.rb
@@ -7,22 +7,26 @@ require './modules/build-system/setup'
 # Define the default compiler environment
 main_env = BuildEnv.new do |env|
   env["CFLAGS"]  += ['-O3', '-Wall', '-Wextra', '--std=c99', '--pedantic']
-  env["CPPPATH"] += Dir['modules/libc/source/**/']
+  env["CPPPATH"] += Dir['modules/atf/source/**/']
 end
 
+sources = Dir['source/**/*.c'] - ['source/main.c']
+test_sources = Dir['tests/**/*.c'] + ['modules/atf/source/atf.c']
+
 #------------------------------------------------------------------------------
 # Release Build Targets
 #------------------------------------------------------------------------------
-# Build third party libraries
-#main_env.Library('build/lib/libc.a',   FileList['modules/libc/source/**/*.c'])
-runtime_libs = []#['build/lib/libc.a']
+# Build the language library
+main_env.Library('libgir.a', sources)
 
-# Build the parser
-main_env.Program('gir',  FileList['source/*.c'] + runtime_libs)
+# Build the interpreter
+main_env.Program('gir',  ['source/main.c', 'libgir.a'])
 
 #------------------------------------------------------------------------------
 # Test Build Targets
 #------------------------------------------------------------------------------
 if Opts[:profile].include? "test"
   # Do nothing for now
+    main_env.Program('test_gir', test_sources + ['libgir.a'])
+    main_env.Command('Unit Tests', 'test_gir', "CMD" => ['./test_gir'])
 end
diff --git a/modules/atf b/modules/atf
new file mode 160000 (submodule)
index 0000000..1105e4a
--- /dev/null
@@ -0,0 +1 @@
+Subproject commit 1105e4a88bbda546991da0314ba6060f9f624dba
index d47d3c14514f78b807d62dad445c07384fe071c9..52f97fe16a396d27f3129cd0545352252c2bb481 100644 (file)
@@ -21,6 +21,8 @@ Obj* Map;
 Obj* Set;
 Obj* Block;
 
+hamt_t InternPool;
+
 /* Private API Declarations
  *****************************************************************************/
 
@@ -29,6 +31,7 @@ Obj* Block;
 void gir_init(void* stack_btm)
 {
     (void)stack_btm;
+//    hamt_init(&InternPool);
 }
 
 void gir_deinit(void)
diff --git a/tests/main.c b/tests/main.c
new file mode 100644 (file)
index 0000000..9b608b3
--- /dev/null
@@ -0,0 +1,9 @@
+#include "atf.h"
+
+int main(int argc, char** argv)
+{
+    (void)argc;
+    (void)argv;
+    //RUN_EXTERN_TEST_SUITE(Opts);
+    return PRINT_TEST_RESULTS();
+}