diff options
author | Pavol Rusnak <pavol@rusnak.io> | 2019-10-11 09:27:29 +0200 |
---|---|---|
committer | Petteri Aimonen <jpa@git.mail.kapsi.fi> | 2019-10-11 10:51:45 +0300 |
commit | 536fe50629c3e9c88a0a4c367929ea0f10e53ddf (patch) | |
tree | 17332682d3165808b56abc0694a251e17c1bc63c | |
parent | 9bb001e88ad1cd7c36f090eee828d435ae63a294 (diff) | |
download | nanopb-c-536fe50629c3e9c88a0a4c367929ea0f10e53ddf.tar.gz |
Add test for PB_ENCODE_ARRAYS_UNPACKED
-rw-r--r-- | tests/encode_arrays_unpacked/SConscript | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/tests/encode_arrays_unpacked/SConscript b/tests/encode_arrays_unpacked/SConscript new file mode 100644 index 0000000..bd36d9d --- /dev/null +++ b/tests/encode_arrays_unpacked/SConscript @@ -0,0 +1,28 @@ +# Run the alltypes test case, but compile with PB_ENCODE_ARRAYS_UNPACKED=1 + +Import("env") + +# Take copy of the files for custom build. +c = Copy("$TARGET", "$SOURCE") +env.Command("alltypes.pb.h", "$BUILD/alltypes/alltypes.pb.h", c) +env.Command("alltypes.pb.c", "$BUILD/alltypes/alltypes.pb.c", c) +env.Command("encode_alltypes.c", "$BUILD/alltypes/encode_alltypes.c", c) +env.Command("decode_alltypes.c", "$BUILD/alltypes/decode_alltypes.c", c) + +# Define the compilation options +opts = env.Clone() +opts.Append(CPPDEFINES = {'PB_ENCODE_ARRAYS_UNPACKED': 1}) + +# Build new version of core +strict = opts.Clone() +strict.Append(CFLAGS = strict['CORECFLAGS']) +strict.Object("pb_decode_unpacked.o", "$NANOPB/pb_decode.c") +strict.Object("pb_encode_unpacked.o", "$NANOPB/pb_encode.c") +strict.Object("pb_common_unpacked.o", "$NANOPB/pb_common.c") + +# Now build and run the test normally. +enc = opts.Program(["encode_alltypes.c", "alltypes.pb.c", "pb_encode_unpacked.o", "pb_common_unpacked.o"]) +dec = opts.Program(["decode_alltypes.c", "alltypes.pb.c", "pb_decode_unpacked.o", "pb_common_unpacked.o"]) + +env.RunTest(enc) +env.RunTest([dec, "encode_alltypes.output"]) |