Move malloc_wrappers.c to tests/common
authorPetteri Aimonen <jpa@git.mail.kapsi.fi>
Fri, 26 Dec 2014 15:08:17 +0000 (17:08 +0200)
committerPetteri Aimonen <jpa@git.mail.kapsi.fi>
Fri, 26 Dec 2014 15:08:17 +0000 (17:08 +0200)
tests/common/SConscript
tests/common/malloc_wrappers.c [moved from tests/fuzztest/malloc_wrappers.c with 100% similarity]
tests/common/malloc_wrappers.h [moved from tests/fuzztest/malloc_wrappers.h with 100% similarity]
tests/common/malloc_wrappers_syshdr.h [moved from tests/fuzztest/fuzz_syshdr.h with 100% similarity]
tests/fuzztest/SConscript
tests/fuzztest/fuzzstub.c
tests/fuzztest/fuzztest.c

index f1dee0e..4581bea 100644 (file)
@@ -15,3 +15,7 @@ strict.Append(CFLAGS = strict['CORECFLAGS'])
 strict.Object("pb_decode.o", "$NANOPB/pb_decode.c")
 strict.Object("pb_encode.o", "$NANOPB/pb_encode.c")
 strict.Object("pb_common.o", "$NANOPB/pb_common.c")
+
+mw = env.Object("malloc_wrappers.o", "malloc_wrappers.c")
+Depends(mw, ["malloc_wrappers_syshdr.h"])
+
index 6499714..346ccab 100644 (file)
@@ -5,8 +5,8 @@ Import("env")
 # We need our own pb_decode.o for the malloc support
 env = env.Clone()
 env.Append(CPPDEFINES = {'PB_ENABLE_MALLOC': 1,
-                         'PB_SYSTEM_HEADER': '\\"fuzz_syshdr.h\\"'})
-env.Append(CPPPATH = ".")
+                         'PB_SYSTEM_HEADER': '\\"malloc_wrappers_syshdr.h\\"'})
+env.Append(CPPPATH = [".", "$COMMON"])
 
 if 'SYSHDR' in env:
     env.Append(CPPDEFINES = {'PB_OLD_SYSHDR': env['SYSHDR']})
@@ -42,8 +42,7 @@ fuzz = env.Program(["fuzztest.c",
                     "pb_encode_with_malloc.o",
                     "pb_decode_with_malloc.o",
                     "pb_common_with_malloc.o",
-                    "malloc_wrappers.c"])
-Depends([p1, p2, fuzz], ["fuzz_syshdr.h", "malloc_wrappers.h"])
+                    "$COMMON/malloc_wrappers.o"])
 
 env.RunTest(fuzz)
 
@@ -53,6 +52,6 @@ fuzzstub = env.Program(["fuzzstub.c",
                     "pb_encode_with_malloc.o",
                     "pb_decode_with_malloc.o",
                     "pb_common_with_malloc.o",
-                    "malloc_wrappers.c"])
+                    "$COMMON/malloc_wrappers.o"])
 
 
index 5099841..ce14b9b 100644 (file)
@@ -10,7 +10,7 @@
 #include <string.h>
 #include <assert.h>
 #include <time.h>
-#include "malloc_wrappers.h"
+#include <malloc_wrappers.h>
 #include "alltypes_static.pb.h"
 #include "alltypes_pointer.pb.h"
 
index 996ed45..d370172 100644 (file)
@@ -9,7 +9,7 @@
 #include <string.h>
 #include <assert.h>
 #include <time.h>
-#include "malloc_wrappers.h"
+#include <malloc_wrappers.h>
 #include "alltypes_static.pb.h"
 #include "alltypes_pointer.pb.h"