Add 'CAN-binder/libs/nanopb/' from commit '278ffb890e3d8722e4c7d824baaf221a1e375fc4'
[apps/agl-service-can-low-level.git] / CAN-binder / libs / nanopb / tests / io_errors_pointers / SConscript
1 # Simulate io errors when encoding and decoding
2
3 Import("env", "malloc_env")
4
5 c = Copy("$TARGET", "$SOURCE")
6 env.Command("alltypes.proto", "#alltypes/alltypes.proto", c)
7 env.Command("io_errors.c", "#io_errors/io_errors.c", c)
8
9 env.NanopbProto(["alltypes", "alltypes.options"])
10
11 ioerr = env.Program(["io_errors.c", "alltypes.pb.c",
12                      "$COMMON/pb_encode_with_malloc.o",
13                      "$COMMON/pb_decode_with_malloc.o",
14                      "$COMMON/pb_common_with_malloc.o",
15                      "$COMMON/malloc_wrappers.o"])
16
17 # Run tests under valgrind if available
18 valgrind = env.WhereIs('valgrind')
19 kwargs = {}
20 if valgrind:
21     kwargs['COMMAND'] = valgrind
22     kwargs['ARGS'] = ["-q", "--error-exitcode=99", ioerr[0].abspath]
23
24 env.RunTest("io_errors.output", [ioerr, "$BUILD/alltypes/encode_alltypes.output"], **kwargs)
25
26