aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/alltypes/SConscript4
-rw-r--r--tests/alltypes_callback/SConscript4
-rw-r--r--tests/alltypes_pointer/SConscript5
-rw-r--r--tests/backwards_compatibility/SConscript4
-rw-r--r--tests/basic_buffer/SConscript4
-rw-r--r--tests/basic_stream/SConscript4
-rw-r--r--tests/buffer_only/SConscript5
-rw-r--r--tests/callbacks/SConscript4
-rw-r--r--tests/common/SConscript2
-rw-r--r--tests/cxx_main_program/SConscript5
-rw-r--r--tests/decode_unittests/decode_unittests.c1
-rw-r--r--tests/encode_unittests/encode_unittests.c1
-rw-r--r--tests/extensions/SConscript4
-rw-r--r--tests/field_size_16/SConscript5
-rw-r--r--tests/field_size_32/SConscript5
-rw-r--r--tests/missing_fields/SConscript2
-rw-r--r--tests/no_errmsg/SConscript5
-rw-r--r--tests/package_name/SConscript2
-rw-r--r--tests/splint/SConscript3
19 files changed, 40 insertions, 29 deletions
diff --git a/tests/alltypes/SConscript b/tests/alltypes/SConscript
index 9c9072ba..6c6238c6 100644
--- a/tests/alltypes/SConscript
+++ b/tests/alltypes/SConscript
@@ -4,8 +4,8 @@
Import("env")
env.NanopbProto(["alltypes", "alltypes.options"])
-enc = env.Program(["encode_alltypes.c", "alltypes.pb.c", "$COMMON/pb_encode.o"])
-dec = env.Program(["decode_alltypes.c", "alltypes.pb.c", "$COMMON/pb_decode.o"])
+enc = env.Program(["encode_alltypes.c", "alltypes.pb.c", "$COMMON/pb_encode.o", "$COMMON/pb_common.o"])
+dec = env.Program(["decode_alltypes.c", "alltypes.pb.c", "$COMMON/pb_decode.o", "$COMMON/pb_common.o"])
# Test the round-trip from nanopb encoder to nanopb decoder
env.RunTest(enc)
diff --git a/tests/alltypes_callback/SConscript b/tests/alltypes_callback/SConscript
index 71b01600..a241f24e 100644
--- a/tests/alltypes_callback/SConscript
+++ b/tests/alltypes_callback/SConscript
@@ -6,8 +6,8 @@ c = Copy("$TARGET", "$SOURCE")
env.Command("alltypes.proto", "#alltypes/alltypes.proto", c)
env.NanopbProto(["alltypes", "alltypes.options"])
-enc = env.Program(["encode_alltypes_callback.c", "alltypes.pb.c", "$COMMON/pb_encode.o"])
-dec = env.Program(["decode_alltypes_callback.c", "alltypes.pb.c", "$COMMON/pb_decode.o"])
+enc = env.Program(["encode_alltypes_callback.c", "alltypes.pb.c", "$COMMON/pb_encode.o", "$COMMON/pb_common.o"])
+dec = env.Program(["decode_alltypes_callback.c", "alltypes.pb.c", "$COMMON/pb_decode.o", "$COMMON/pb_common.o"])
refdec = "$BUILD/alltypes/decode_alltypes$PROGSUFFIX"
diff --git a/tests/alltypes_pointer/SConscript b/tests/alltypes_pointer/SConscript
index e48d6aad..8fcf197e 100644
--- a/tests/alltypes_pointer/SConscript
+++ b/tests/alltypes_pointer/SConscript
@@ -18,13 +18,14 @@ strict = env.Clone()
strict.Append(CFLAGS = strict['CORECFLAGS'])
strict.Object("pb_decode_with_malloc.o", "$NANOPB/pb_decode.c")
strict.Object("pb_encode_with_malloc.o", "$NANOPB/pb_encode.c")
+strict.Object("pb_common_with_malloc.o", "$NANOPB/pb_common.c")
c = Copy("$TARGET", "$SOURCE")
env.Command("alltypes.proto", "#alltypes/alltypes.proto", c)
env.NanopbProto(["alltypes", "alltypes.options"])
-enc = env.Program(["encode_alltypes_pointer.c", "alltypes.pb.c", "pb_encode_with_malloc.o"])
-dec = env.Program(["decode_alltypes_pointer.c", "alltypes.pb.c", "pb_decode_with_malloc.o"])
+enc = env.Program(["encode_alltypes_pointer.c", "alltypes.pb.c", "pb_encode_with_malloc.o", "pb_common_with_malloc.o"])
+dec = env.Program(["decode_alltypes_pointer.c", "alltypes.pb.c", "pb_decode_with_malloc.o", "pb_common_with_malloc.o"])
# Encode and compare results to non-pointer alltypes test case
env.RunTest(enc)
diff --git a/tests/backwards_compatibility/SConscript b/tests/backwards_compatibility/SConscript
index 777ef402..81b03182 100644
--- a/tests/backwards_compatibility/SConscript
+++ b/tests/backwards_compatibility/SConscript
@@ -3,8 +3,8 @@
Import("env")
-enc = env.Program(["encode_legacy.c", "alltypes_legacy.c", "$COMMON/pb_encode.o"])
-dec = env.Program(["decode_legacy.c", "alltypes_legacy.c", "$COMMON/pb_decode.o"])
+enc = env.Program(["encode_legacy.c", "alltypes_legacy.c", "$COMMON/pb_encode.o", "$COMMON/pb_common.o"])
+dec = env.Program(["decode_legacy.c", "alltypes_legacy.c", "$COMMON/pb_decode.o", "$COMMON/pb_common.o"])
env.RunTest(enc)
env.RunTest([dec, "encode_legacy.output"])
diff --git a/tests/basic_buffer/SConscript b/tests/basic_buffer/SConscript
index 2546aaa3..acaf5ffa 100644
--- a/tests/basic_buffer/SConscript
+++ b/tests/basic_buffer/SConscript
@@ -2,8 +2,8 @@
Import("env")
-enc = env.Program(["encode_buffer.c", "$COMMON/person.pb.c", "$COMMON/pb_encode.o"])
-dec = env.Program(["decode_buffer.c", "$COMMON/person.pb.c", "$COMMON/pb_decode.o"])
+enc = env.Program(["encode_buffer.c", "$COMMON/person.pb.c", "$COMMON/pb_encode.o", "$COMMON/pb_common.o"])
+dec = env.Program(["decode_buffer.c", "$COMMON/person.pb.c", "$COMMON/pb_decode.o", "$COMMON/pb_common.o"])
env.RunTest(enc)
env.RunTest([dec, "encode_buffer.output"])
diff --git a/tests/basic_stream/SConscript b/tests/basic_stream/SConscript
index 46db8c43..7d668562 100644
--- a/tests/basic_stream/SConscript
+++ b/tests/basic_stream/SConscript
@@ -2,8 +2,8 @@
Import("env")
-enc = env.Program(["encode_stream.c", "$COMMON/person.pb.c", "$COMMON/pb_encode.o"])
-dec = env.Program(["decode_stream.c", "$COMMON/person.pb.c", "$COMMON/pb_decode.o"])
+enc = env.Program(["encode_stream.c", "$COMMON/person.pb.c", "$COMMON/pb_encode.o", "$COMMON/pb_common.o"])
+dec = env.Program(["decode_stream.c", "$COMMON/person.pb.c", "$COMMON/pb_decode.o", "$COMMON/pb_common.o"])
env.RunTest(enc)
env.RunTest([dec, "encode_stream.output"])
diff --git a/tests/buffer_only/SConscript b/tests/buffer_only/SConscript
index cddbb04f..55b747b0 100644
--- a/tests/buffer_only/SConscript
+++ b/tests/buffer_only/SConscript
@@ -18,10 +18,11 @@ strict = opts.Clone()
strict.Append(CFLAGS = strict['CORECFLAGS'])
strict.Object("pb_decode_bufonly.o", "$NANOPB/pb_decode.c")
strict.Object("pb_encode_bufonly.o", "$NANOPB/pb_encode.c")
+strict.Object("pb_common_bufonly.o", "$NANOPB/pb_common.c")
# Now build and run the test normally.
-enc = opts.Program(["encode_alltypes.c", "alltypes.pb.c", "pb_encode_bufonly.o"])
-dec = opts.Program(["decode_alltypes.c", "alltypes.pb.c", "pb_decode_bufonly.o"])
+enc = opts.Program(["encode_alltypes.c", "alltypes.pb.c", "pb_encode_bufonly.o", "pb_common_bufonly.o"])
+dec = opts.Program(["decode_alltypes.c", "alltypes.pb.c", "pb_decode_bufonly.o", "pb_common_bufonly.o"])
env.RunTest(enc)
env.RunTest([dec, "encode_alltypes.output"])
diff --git a/tests/callbacks/SConscript b/tests/callbacks/SConscript
index 9ec8a434..44521439 100644
--- a/tests/callbacks/SConscript
+++ b/tests/callbacks/SConscript
@@ -3,8 +3,8 @@
Import("env")
env.NanopbProto("callbacks")
-enc = env.Program(["encode_callbacks.c", "callbacks.pb.c", "$COMMON/pb_encode.o"])
-dec = env.Program(["decode_callbacks.c", "callbacks.pb.c", "$COMMON/pb_decode.o"])
+enc = env.Program(["encode_callbacks.c", "callbacks.pb.c", "$COMMON/pb_encode.o", "$COMMON/pb_common.o"])
+dec = env.Program(["decode_callbacks.c", "callbacks.pb.c", "$COMMON/pb_decode.o", "$COMMON/pb_common.o"])
env.RunTest(enc)
env.RunTest([dec, "encode_callbacks.output"])
diff --git a/tests/common/SConscript b/tests/common/SConscript
index 144f1490..f1dee0e2 100644
--- a/tests/common/SConscript
+++ b/tests/common/SConscript
@@ -14,4 +14,4 @@ strict = env.Clone()
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")
diff --git a/tests/cxx_main_program/SConscript b/tests/cxx_main_program/SConscript
index e78c6b35..edb88127 100644
--- a/tests/cxx_main_program/SConscript
+++ b/tests/cxx_main_program/SConscript
@@ -11,14 +11,15 @@ env.Append(CPPDEFINES = ['__STDC_LIMIT_MACROS'])
c = Copy("$TARGET", "$SOURCE")
env.Command("pb_encode.cxx", "#../pb_encode.c", c)
env.Command("pb_decode.cxx", "#../pb_decode.c", c)
+env.Command("pb_common.cxx", "#../pb_common.c", c)
env.Command("alltypes.pb.h", "$BUILD/alltypes/alltypes.pb.h", c)
env.Command("alltypes.pb.cxx", "$BUILD/alltypes/alltypes.pb.c", c)
env.Command("encode_alltypes.cxx", "$BUILD/alltypes/encode_alltypes.c", c)
env.Command("decode_alltypes.cxx", "$BUILD/alltypes/decode_alltypes.c", c)
# Now build and run the test normally.
-enc = env.Program(["encode_alltypes.cxx", "alltypes.pb.cxx", "pb_encode.cxx"])
-dec = env.Program(["decode_alltypes.cxx", "alltypes.pb.cxx", "pb_decode.cxx"])
+enc = env.Program(["encode_alltypes.cxx", "alltypes.pb.cxx", "pb_encode.cxx", "pb_common.cxx"])
+dec = env.Program(["decode_alltypes.cxx", "alltypes.pb.cxx", "pb_decode.cxx", "pb_common.cxx"])
env.RunTest(enc)
env.RunTest([dec, "encode_alltypes.output"])
diff --git a/tests/decode_unittests/decode_unittests.c b/tests/decode_unittests/decode_unittests.c
index 98055df3..59c4a074 100644
--- a/tests/decode_unittests/decode_unittests.c
+++ b/tests/decode_unittests/decode_unittests.c
@@ -1,5 +1,6 @@
/* This includes the whole .c file to get access to static functions. */
#define PB_ENABLE_MALLOC
+#include "pb_common.c"
#include "pb_decode.c"
#include <stdio.h>
diff --git a/tests/encode_unittests/encode_unittests.c b/tests/encode_unittests/encode_unittests.c
index 06935f9a..a5f868c9 100644
--- a/tests/encode_unittests/encode_unittests.c
+++ b/tests/encode_unittests/encode_unittests.c
@@ -1,4 +1,5 @@
/* This includes the whole .c file to get access to static functions. */
+#include "pb_common.c"
#include "pb_encode.c"
#include <stdio.h>
diff --git a/tests/extensions/SConscript b/tests/extensions/SConscript
index 26fc5a3f..cf2e096e 100644
--- a/tests/extensions/SConscript
+++ b/tests/extensions/SConscript
@@ -8,8 +8,8 @@ incpath.Append(PROTOCPATH = '$BUILD/alltypes')
incpath.Append(CPPPATH = '$BUILD/alltypes')
incpath.NanopbProto(["extensions", "extensions.options"])
-enc = incpath.Program(["encode_extensions.c", "extensions.pb.c", "$BUILD/alltypes/alltypes.pb$OBJSUFFIX", "$COMMON/pb_encode.o"])
-dec = incpath.Program(["decode_extensions.c", "extensions.pb.c", "$BUILD/alltypes/alltypes.pb$OBJSUFFIX", "$COMMON/pb_decode.o"])
+enc = incpath.Program(["encode_extensions.c", "extensions.pb.c", "$BUILD/alltypes/alltypes.pb.o", "$COMMON/pb_encode.o", "$COMMON/pb_common.o"])
+dec = incpath.Program(["decode_extensions.c", "extensions.pb.c", "$BUILD/alltypes/alltypes.pb.o", "$COMMON/pb_decode.o", "$COMMON/pb_common.o"])
env.RunTest(enc)
env.RunTest([dec, "encode_extensions.output"])
diff --git a/tests/field_size_16/SConscript b/tests/field_size_16/SConscript
index 8fee0049..ffb29c4e 100644
--- a/tests/field_size_16/SConscript
+++ b/tests/field_size_16/SConscript
@@ -19,10 +19,11 @@ strict = opts.Clone()
strict.Append(CFLAGS = strict['CORECFLAGS'])
strict.Object("pb_decode_fields16.o", "$NANOPB/pb_decode.c")
strict.Object("pb_encode_fields16.o", "$NANOPB/pb_encode.c")
+strict.Object("pb_common_fields16.o", "$NANOPB/pb_common.c")
# Now build and run the test normally.
-enc = opts.Program(["encode_alltypes.c", "alltypes.pb.c", "pb_encode_fields16.o"])
-dec = opts.Program(["decode_alltypes.c", "alltypes.pb.c", "pb_decode_fields16.o"])
+enc = opts.Program(["encode_alltypes.c", "alltypes.pb.c", "pb_encode_fields16.o", "pb_common_fields16.o"])
+dec = opts.Program(["decode_alltypes.c", "alltypes.pb.c", "pb_decode_fields16.o", "pb_common_fields16.o"])
env.RunTest(enc)
env.RunTest([dec, "encode_alltypes.output"])
diff --git a/tests/field_size_32/SConscript b/tests/field_size_32/SConscript
index 2a64c6c5..0b8dc0e3 100644
--- a/tests/field_size_32/SConscript
+++ b/tests/field_size_32/SConscript
@@ -19,10 +19,11 @@ strict = opts.Clone()
strict.Append(CFLAGS = strict['CORECFLAGS'])
strict.Object("pb_decode_fields32.o", "$NANOPB/pb_decode.c")
strict.Object("pb_encode_fields32.o", "$NANOPB/pb_encode.c")
+strict.Object("pb_common_fields32.o", "$NANOPB/pb_common.c")
# Now build and run the test normally.
-enc = opts.Program(["encode_alltypes.c", "alltypes.pb.c", "pb_encode_fields32.o"])
-dec = opts.Program(["decode_alltypes.c", "alltypes.pb.c", "pb_decode_fields32.o"])
+enc = opts.Program(["encode_alltypes.c", "alltypes.pb.c", "pb_encode_fields32.o", "pb_common_fields32.o"])
+dec = opts.Program(["decode_alltypes.c", "alltypes.pb.c", "pb_decode_fields32.o", "pb_common_fields32.o"])
env.RunTest(enc)
env.RunTest([dec, "encode_alltypes.output"])
diff --git a/tests/missing_fields/SConscript b/tests/missing_fields/SConscript
index 9926efad..86ba0833 100644
--- a/tests/missing_fields/SConscript
+++ b/tests/missing_fields/SConscript
@@ -3,6 +3,6 @@
Import("env")
env.NanopbProto("missing_fields")
-test = env.Program(["missing_fields.c", "missing_fields.pb.c", "$COMMON/pb_encode.o", "$COMMON/pb_decode.o"])
+test = env.Program(["missing_fields.c", "missing_fields.pb.c", "$COMMON/pb_encode.o", "$COMMON/pb_decode.o", "$COMMON/pb_common.o"])
env.RunTest(test)
diff --git a/tests/no_errmsg/SConscript b/tests/no_errmsg/SConscript
index ed467051..629bfa68 100644
--- a/tests/no_errmsg/SConscript
+++ b/tests/no_errmsg/SConscript
@@ -18,10 +18,11 @@ strict = opts.Clone()
strict.Append(CFLAGS = strict['CORECFLAGS'])
strict.Object("pb_decode_noerr.o", "$NANOPB/pb_decode.c")
strict.Object("pb_encode_noerr.o", "$NANOPB/pb_encode.c")
+strict.Object("pb_common_noerr.o", "$NANOPB/pb_common.c")
# Now build and run the test normally.
-enc = opts.Program(["encode_alltypes.c", "alltypes.pb.c", "pb_encode_noerr.o"])
-dec = opts.Program(["decode_alltypes.c", "alltypes.pb.c", "pb_decode_noerr.o"])
+enc = opts.Program(["encode_alltypes.c", "alltypes.pb.c", "pb_encode_noerr.o", "pb_common_noerr.o"])
+dec = opts.Program(["decode_alltypes.c", "alltypes.pb.c", "pb_decode_noerr.o", "pb_common_noerr.o"])
env.RunTest(enc)
env.RunTest([dec, "encode_alltypes.output"])
diff --git a/tests/package_name/SConscript b/tests/package_name/SConscript
index 8f1b9021..897bc99c 100644
--- a/tests/package_name/SConscript
+++ b/tests/package_name/SConscript
@@ -29,7 +29,7 @@ def modify_c(target, source, env):
env.Command("encode_alltypes.c", "#alltypes/encode_alltypes.c", modify_c)
# Encode and compare results to original alltypes testcase
-enc = env.Program(["encode_alltypes.c", "alltypes.pb.c", "$COMMON/pb_encode.o"])
+enc = env.Program(["encode_alltypes.c", "alltypes.pb.c", "$COMMON/pb_encode.o", "$COMMON/pb_common.o"])
refdec = "$BUILD/alltypes/decode_alltypes$PROGSUFFIX"
env.RunTest(enc)
env.Compare(["encode_alltypes.output", "$BUILD/alltypes/encode_alltypes.output"])
diff --git a/tests/splint/SConscript b/tests/splint/SConscript
index c1432dde..cd4b5b9d 100644
--- a/tests/splint/SConscript
+++ b/tests/splint/SConscript
@@ -11,3 +11,6 @@ if p:
env.Command('pb_encode.splint', '$NANOPB/pb_encode.c',
'splint -f splint/splint.rc $SOURCE 2> $TARGET')
+ env.Command('pb_common.splint', '$NANOPB/pb_common.c',
+ 'splint -f splint/splint.rc $SOURCE 2> $TARGET')
+