• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# Run the alltypes test case, but compile with PB_BUFFER_ONLY=1
2
3Import("env")
4
5# Take copy of the files for custom build.
6c = Copy("$TARGET", "$SOURCE")
7env.Command("alltypes.pb.h", "$BUILD/alltypes/alltypes.pb.h", c)
8env.Command("alltypes.pb.c", "$BUILD/alltypes/alltypes.pb.c", c)
9env.Command("encode_alltypes.c", "$BUILD/alltypes/encode_alltypes.c", c)
10env.Command("decode_alltypes.c", "$BUILD/alltypes/decode_alltypes.c", c)
11
12# Define the compilation options
13opts = env.Clone()
14opts.Append(CPPDEFINES = {'PB_BUFFER_ONLY': 1})
15
16# Build new version of core
17strict = opts.Clone()
18strict.Append(CFLAGS = strict['CORECFLAGS'])
19strict.Object("pb_decode_bufonly.o", "$NANOPB/pb_decode.c")
20strict.Object("pb_encode_bufonly.o", "$NANOPB/pb_encode.c")
21strict.Object("pb_common_bufonly.o", "$NANOPB/pb_common.c")
22
23# Now build and run the test normally.
24enc = opts.Program(["encode_alltypes.c", "alltypes.pb.c", "pb_encode_bufonly.o", "pb_common_bufonly.o"])
25dec = opts.Program(["decode_alltypes.c", "alltypes.pb.c", "pb_decode_bufonly.o", "pb_common_bufonly.o"])
26
27env.RunTest(enc)
28env.RunTest([dec, "encode_alltypes.output"])
29