aboutsummaryrefslogtreecommitdiffstats
path: root/libs/nanopb/tests/io_errors_pointers
diff options
context:
space:
mode:
authorRomain Forlot <romain.forlot@iot.bzh>2017-06-20 10:24:05 +0000
committerRomain Forlot <romain.forlot@iot.bzh>2017-06-20 10:24:05 +0000
commit32e25cbca210a359b09768537b6f443fe90a3070 (patch)
tree3309794c15d8a8f8e9c1c08cad072ee1378813ba /libs/nanopb/tests/io_errors_pointers
parent76c43dec62b2e21cd6446360c00d4fe6b437533f (diff)
Separation Generator to a dedicated repo
Change-Id: Id94831651c3266861435272a6e36c7884bef2c45 Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
Diffstat (limited to 'libs/nanopb/tests/io_errors_pointers')
-rw-r--r--libs/nanopb/tests/io_errors_pointers/SConscript26
-rw-r--r--libs/nanopb/tests/io_errors_pointers/alltypes.options3
2 files changed, 29 insertions, 0 deletions
diff --git a/libs/nanopb/tests/io_errors_pointers/SConscript b/libs/nanopb/tests/io_errors_pointers/SConscript
new file mode 100644
index 00000000..03727df9
--- /dev/null
+++ b/libs/nanopb/tests/io_errors_pointers/SConscript
@@ -0,0 +1,26 @@
+# Simulate io errors when encoding and decoding
+
+Import("env", "malloc_env")
+
+c = Copy("$TARGET", "$SOURCE")
+env.Command("alltypes.proto", "#alltypes/alltypes.proto", c)
+env.Command("io_errors.c", "#io_errors/io_errors.c", c)
+
+env.NanopbProto(["alltypes", "alltypes.options"])
+
+ioerr = env.Program(["io_errors.c", "alltypes.pb.c",
+ "$COMMON/pb_encode_with_malloc.o",
+ "$COMMON/pb_decode_with_malloc.o",
+ "$COMMON/pb_common_with_malloc.o",
+ "$COMMON/malloc_wrappers.o"])
+
+# Run tests under valgrind if available
+valgrind = env.WhereIs('valgrind')
+kwargs = {}
+if valgrind:
+ kwargs['COMMAND'] = valgrind
+ kwargs['ARGS'] = ["-q", "--error-exitcode=99", ioerr[0].abspath]
+
+env.RunTest("io_errors.output", [ioerr, "$BUILD/alltypes/encode_alltypes.output"], **kwargs)
+
+
diff --git a/libs/nanopb/tests/io_errors_pointers/alltypes.options b/libs/nanopb/tests/io_errors_pointers/alltypes.options
new file mode 100644
index 00000000..7e3ad1e5
--- /dev/null
+++ b/libs/nanopb/tests/io_errors_pointers/alltypes.options
@@ -0,0 +1,3 @@
+# Generate all fields as pointers.
+* type:FT_POINTER
+*.*fbytes fixed_length:true max_size:4