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