Fix bugs in proto3 mode encoding of submessages (#256)
[apps/agl-service-can-low-level.git] / tests / field_size_32 / SConscript
1 # Run the alltypes test case, but compile with PB_FIELD_32BIT=1.
2 # Also the .proto file has been modified to have high indexes.
3
4 Import("env")
5
6 # Take copy of the files for custom build.
7 c = Copy("$TARGET", "$SOURCE")
8 env.Command("encode_alltypes.c", "$BUILD/alltypes/encode_alltypes.c", c)
9 env.Command("decode_alltypes.c", "$BUILD/alltypes/decode_alltypes.c", c)
10
11 env.NanopbProto(["alltypes", "alltypes.options"])
12
13 # Define the compilation options
14 opts = env.Clone()
15 opts.Append(CPPDEFINES = {'PB_FIELD_32BIT': 1})
16
17 # Build new version of core
18 strict = opts.Clone()
19 strict.Append(CFLAGS = strict['CORECFLAGS'])
20 strict.Object("pb_decode_fields32.o", "$NANOPB/pb_decode.c")
21 strict.Object("pb_encode_fields32.o", "$NANOPB/pb_encode.c")
22 strict.Object("pb_common_fields32.o", "$NANOPB/pb_common.c")
23
24 # Now build and run the test normally.
25 enc = opts.Program(["encode_alltypes.c", "alltypes.pb.c", "pb_encode_fields32.o", "pb_common_fields32.o"])
26 dec = opts.Program(["decode_alltypes.c", "alltypes.pb.c", "pb_decode_fields32.o", "pb_common_fields32.o"])
27
28 env.RunTest(enc)
29 env.RunTest([dec, "encode_alltypes.output"])