diff options
author | Petteri Aimonen <jpa@git.mail.kapsi.fi> | 2013-11-13 22:10:42 +0200 |
---|---|---|
committer | Petteri Aimonen <jpa@git.mail.kapsi.fi> | 2013-11-13 22:10:42 +0200 |
commit | 5813144246f8f132f90bea117e578477914be0ea (patch) | |
tree | 3240f066191fe124d67996f9b8b87dc789476a3f /tests | |
parent | 171d64734a34674cd648ac7b8569b4b21285fed4 (diff) |
Make tests build in a separate folder, add to gitignore
Diffstat (limited to 'tests')
-rw-r--r-- | tests/SConstruct | 9 | ||||
-rw-r--r-- | tests/alltypes/SConscript | 6 | ||||
-rw-r--r-- | tests/backwards_compatibility/SConscript | 4 | ||||
-rw-r--r-- | tests/basic_buffer/SConscript | 6 | ||||
-rw-r--r-- | tests/basic_stream/SConscript | 6 | ||||
-rw-r--r-- | tests/buffer_only/SConscript | 8 | ||||
-rw-r--r-- | tests/callbacks/SConscript | 4 | ||||
-rw-r--r-- | tests/cxx_main_program/SConscript | 8 | ||||
-rw-r--r-- | tests/decode_unittests/SConscript | 2 | ||||
-rw-r--r-- | tests/encode_unittests/SConscript | 2 | ||||
-rw-r--r-- | tests/extensions/SConscript | 10 | ||||
-rw-r--r-- | tests/extra_fields/SConscript | 6 | ||||
-rw-r--r-- | tests/field_size_16/SConscript | 6 | ||||
-rw-r--r-- | tests/field_size_32/SConscript | 6 | ||||
-rw-r--r-- | tests/missing_fields/SConscript | 2 | ||||
-rw-r--r-- | tests/no_errmsg/SConscript | 8 |
16 files changed, 49 insertions, 44 deletions
diff --git a/tests/SConstruct b/tests/SConstruct index 100fb544..675989a0 100644 --- a/tests/SConstruct +++ b/tests/SConstruct @@ -26,7 +26,7 @@ if 'CXXFLAGS' in ARGUMENTS: env.Append(CCFLAGS = ARGUMENTS['CXXFLAGS']) add_nanopb_builders(env) # Path to the files shared by tests, and to the nanopb core. -env.Append(CPPPATH = ["#../", "#common"]) +env.Append(CPPPATH = ["#../", "$COMMON"]) # Path for finding nanopb.proto env.Append(PROTOCPATH = '#../generator') @@ -110,5 +110,10 @@ elif 'cl' in env['CXX']: env.Append(CXXFLAGS = '/Zi /W2 /WX') # Now include the SConscript files from all subdirectories -SConscript(Glob('*/SConscript'), exports = 'env') +import os.path +env['VARIANT_DIR'] = 'build' +env['BUILD'] = '#' + env['VARIANT_DIR'] +env['COMMON'] = '#' + env['VARIANT_DIR'] + '/common' +for subdir in Glob('*/SConscript'): + SConscript(subdir, exports = 'env', variant_dir = env['VARIANT_DIR'] + '/' + os.path.dirname(str(subdir))) diff --git a/tests/alltypes/SConscript b/tests/alltypes/SConscript index 8aa45b6b..1dc6f871 100644 --- a/tests/alltypes/SConscript +++ b/tests/alltypes/SConscript @@ -3,9 +3,9 @@ Import("env") -env.NanopbProto("alltypes") -enc = env.Program(["encode_alltypes.c", "alltypes.pb.c", "#common/pb_encode.o"]) -dec = env.Program(["decode_alltypes.c", "alltypes.pb.c", "#common/pb_decode.o"]) +env.NanopbProto(["alltypes", "alltypes.options"]) +enc = env.Program(["encode_alltypes.c", "alltypes.pb.c", "$COMMON/pb_encode.o"]) +dec = env.Program(["decode_alltypes.c", "alltypes.pb.c", "$COMMON/pb_decode.o"]) env.RunTest(enc) env.RunTest([dec, "encode_alltypes.output"]) diff --git a/tests/backwards_compatibility/SConscript b/tests/backwards_compatibility/SConscript index 5fb978f3..777ef402 100644 --- a/tests/backwards_compatibility/SConscript +++ b/tests/backwards_compatibility/SConscript @@ -3,8 +3,8 @@ Import("env") -enc = env.Program(["encode_legacy.c", "alltypes_legacy.c", "#common/pb_encode.o"]) -dec = env.Program(["decode_legacy.c", "alltypes_legacy.c", "#common/pb_decode.o"]) +enc = env.Program(["encode_legacy.c", "alltypes_legacy.c", "$COMMON/pb_encode.o"]) +dec = env.Program(["decode_legacy.c", "alltypes_legacy.c", "$COMMON/pb_decode.o"]) env.RunTest(enc) env.RunTest([dec, "encode_legacy.output"]) diff --git a/tests/basic_buffer/SConscript b/tests/basic_buffer/SConscript index 349fb14f..2546aaa3 100644 --- a/tests/basic_buffer/SConscript +++ b/tests/basic_buffer/SConscript @@ -2,11 +2,11 @@ Import("env") -enc = env.Program(["encode_buffer.c", "#common/person.pb.c", "#common/pb_encode.o"]) -dec = env.Program(["decode_buffer.c", "#common/person.pb.c", "#common/pb_decode.o"]) +enc = env.Program(["encode_buffer.c", "$COMMON/person.pb.c", "$COMMON/pb_encode.o"]) +dec = env.Program(["decode_buffer.c", "$COMMON/person.pb.c", "$COMMON/pb_decode.o"]) env.RunTest(enc) env.RunTest([dec, "encode_buffer.output"]) -env.Decode(["encode_buffer.output", "#common/person.proto"], MESSAGE = "Person") +env.Decode(["encode_buffer.output", "$COMMON/person.proto"], MESSAGE = "Person") env.Compare(["decode_buffer.output", "encode_buffer.decoded"]) diff --git a/tests/basic_stream/SConscript b/tests/basic_stream/SConscript index 17382a98..46db8c43 100644 --- a/tests/basic_stream/SConscript +++ b/tests/basic_stream/SConscript @@ -2,11 +2,11 @@ Import("env") -enc = env.Program(["encode_stream.c", "#common/person.pb.c", "#common/pb_encode.o"]) -dec = env.Program(["decode_stream.c", "#common/person.pb.c", "#common/pb_decode.o"]) +enc = env.Program(["encode_stream.c", "$COMMON/person.pb.c", "$COMMON/pb_encode.o"]) +dec = env.Program(["decode_stream.c", "$COMMON/person.pb.c", "$COMMON/pb_decode.o"]) env.RunTest(enc) env.RunTest([dec, "encode_stream.output"]) -env.Decode(["encode_stream.output", "#common/person.proto"], MESSAGE = "Person") +env.Decode(["encode_stream.output", "$COMMON/person.proto"], MESSAGE = "Person") env.Compare(["decode_stream.output", "encode_stream.decoded"]) diff --git a/tests/buffer_only/SConscript b/tests/buffer_only/SConscript index 0770b2fc..db86d377 100644 --- a/tests/buffer_only/SConscript +++ b/tests/buffer_only/SConscript @@ -6,10 +6,10 @@ Import("env") c = Copy("$TARGET", "$SOURCE") env.Command("pb_encode.c", "#../pb_encode.c", c) env.Command("pb_decode.c", "#../pb_decode.c", c) -env.Command("alltypes.pb.h", "#alltypes/alltypes.pb.h", c) -env.Command("alltypes.pb.c", "#alltypes/alltypes.pb.c", c) -env.Command("encode_alltypes.c", "#alltypes/encode_alltypes.c", c) -env.Command("decode_alltypes.c", "#alltypes/decode_alltypes.c", c) +env.Command("alltypes.pb.h", "$BUILD/alltypes/alltypes.pb.h", c) +env.Command("alltypes.pb.c", "$BUILD/alltypes/alltypes.pb.c", c) +env.Command("encode_alltypes.c", "$BUILD/alltypes/encode_alltypes.c", c) +env.Command("decode_alltypes.c", "$BUILD/alltypes/decode_alltypes.c", c) # Define the compilation options opts = env.Clone() diff --git a/tests/callbacks/SConscript b/tests/callbacks/SConscript index 729fd65f..9ec8a434 100644 --- a/tests/callbacks/SConscript +++ b/tests/callbacks/SConscript @@ -3,8 +3,8 @@ Import("env") env.NanopbProto("callbacks") -enc = env.Program(["encode_callbacks.c", "callbacks.pb.c", "#common/pb_encode.o"]) -dec = env.Program(["decode_callbacks.c", "callbacks.pb.c", "#common/pb_decode.o"]) +enc = env.Program(["encode_callbacks.c", "callbacks.pb.c", "$COMMON/pb_encode.o"]) +dec = env.Program(["decode_callbacks.c", "callbacks.pb.c", "$COMMON/pb_decode.o"]) env.RunTest(enc) env.RunTest([dec, "encode_callbacks.output"]) diff --git a/tests/cxx_main_program/SConscript b/tests/cxx_main_program/SConscript index 055c5aee..4bca1b1f 100644 --- a/tests/cxx_main_program/SConscript +++ b/tests/cxx_main_program/SConscript @@ -7,10 +7,10 @@ Import("env") c = Copy("$TARGET", "$SOURCE") env.Command("pb_encode.cxx", "#../pb_encode.c", c) env.Command("pb_decode.cxx", "#../pb_decode.c", c) -env.Command("alltypes.pb.h", "#alltypes/alltypes.pb.h", c) -env.Command("alltypes.pb.cxx", "#alltypes/alltypes.pb.c", c) -env.Command("encode_alltypes.cxx", "#alltypes/encode_alltypes.c", c) -env.Command("decode_alltypes.cxx", "#alltypes/decode_alltypes.c", c) +env.Command("alltypes.pb.h", "$BUILD/alltypes/alltypes.pb.h", c) +env.Command("alltypes.pb.cxx", "$BUILD/alltypes/alltypes.pb.c", c) +env.Command("encode_alltypes.cxx", "$BUILD/alltypes/encode_alltypes.c", c) +env.Command("decode_alltypes.cxx", "$BUILD/alltypes/decode_alltypes.c", c) # Now build and run the test normally. enc = env.Program(["encode_alltypes.cxx", "alltypes.pb.cxx", "pb_encode.cxx"]) diff --git a/tests/decode_unittests/SConscript b/tests/decode_unittests/SConscript index 9a639f7b..369b9dc7 100644 --- a/tests/decode_unittests/SConscript +++ b/tests/decode_unittests/SConscript @@ -1,4 +1,4 @@ Import('env') -p = env.Program(["decode_unittests.c", "#common/unittestproto.pb.c"]) +p = env.Program(["decode_unittests.c", "$COMMON/unittestproto.pb.c"]) env.RunTest(p) diff --git a/tests/encode_unittests/SConscript b/tests/encode_unittests/SConscript index 7509ec03..bf6d1404 100644 --- a/tests/encode_unittests/SConscript +++ b/tests/encode_unittests/SConscript @@ -1,5 +1,5 @@ # Build and run the stand-alone unit tests for the nanopb encoder part. Import('env') -p = env.Program(["encode_unittests.c", "#common/unittestproto.pb.c"]) +p = env.Program(["encode_unittests.c", "$COMMON/unittestproto.pb.c"]) env.RunTest(p) diff --git a/tests/extensions/SConscript b/tests/extensions/SConscript index f632a9ae..26fc5a3f 100644 --- a/tests/extensions/SConscript +++ b/tests/extensions/SConscript @@ -4,12 +4,12 @@ Import("env") # We use the files from the alltypes test case incpath = env.Clone() -incpath.Append(PROTOCPATH = '#alltypes') -incpath.Append(CPPPATH = '#alltypes') +incpath.Append(PROTOCPATH = '$BUILD/alltypes') +incpath.Append(CPPPATH = '$BUILD/alltypes') -incpath.NanopbProto("extensions") -enc = incpath.Program(["encode_extensions.c", "extensions.pb.c", "#alltypes/alltypes.pb$OBJSUFFIX", "#common/pb_encode.o"]) -dec = incpath.Program(["decode_extensions.c", "extensions.pb.c", "#alltypes/alltypes.pb$OBJSUFFIX", "#common/pb_decode.o"]) +incpath.NanopbProto(["extensions", "extensions.options"]) +enc = incpath.Program(["encode_extensions.c", "extensions.pb.c", "$BUILD/alltypes/alltypes.pb$OBJSUFFIX", "$COMMON/pb_encode.o"]) +dec = incpath.Program(["decode_extensions.c", "extensions.pb.c", "$BUILD/alltypes/alltypes.pb$OBJSUFFIX", "$COMMON/pb_decode.o"]) env.RunTest(enc) env.RunTest([dec, "encode_extensions.output"]) diff --git a/tests/extra_fields/SConscript b/tests/extra_fields/SConscript index 9227e950..797c4e6e 100644 --- a/tests/extra_fields/SConscript +++ b/tests/extra_fields/SConscript @@ -2,13 +2,13 @@ Import("env") -dec = env.GetBuildPath('#basic_buffer/${PROGPREFIX}decode_buffer${PROGSUFFIX}') +dec = env.GetBuildPath('$BUILD/basic_buffer/${PROGPREFIX}decode_buffer${PROGSUFFIX}') env.RunTest('person_with_extra_field.output', [dec, "person_with_extra_field.pb"]) env.Compare(["person_with_extra_field.output", "person_with_extra_field.expected"]) -dec = env.GetBuildPath('#basic_stream/${PROGPREFIX}decode_stream${PROGSUFFIX}') +dec = env.GetBuildPath('$BUILD/basic_stream/${PROGPREFIX}decode_stream${PROGSUFFIX}') env.RunTest('person_with_extra_field_stream.output', [dec, "person_with_extra_field.pb"]) env.Compare(["person_with_extra_field_stream.output", "person_with_extra_field.expected"]) -dec2 = env.GetBuildPath('#alltypes/${PROGPREFIX}decode_alltypes${PROGSUFFIX}') +dec2 = env.GetBuildPath('$BUILD/alltypes/${PROGPREFIX}decode_alltypes${PROGSUFFIX}') env.RunTest('alltypes_with_extra_fields.output', [dec2, 'alltypes_with_extra_fields.pb']) diff --git a/tests/field_size_16/SConscript b/tests/field_size_16/SConscript index 48d08e84..15dc0f5d 100644 --- a/tests/field_size_16/SConscript +++ b/tests/field_size_16/SConscript @@ -7,10 +7,10 @@ Import("env") c = Copy("$TARGET", "$SOURCE") env.Command("pb_encode.c", "#../pb_encode.c", c) env.Command("pb_decode.c", "#../pb_decode.c", c) -env.Command("encode_alltypes.c", "#alltypes/encode_alltypes.c", c) -env.Command("decode_alltypes.c", "#alltypes/decode_alltypes.c", c) +env.Command("encode_alltypes.c", "$BUILD/alltypes/encode_alltypes.c", c) +env.Command("decode_alltypes.c", "$BUILD/alltypes/decode_alltypes.c", c) -env.NanopbProto("alltypes") +env.NanopbProto(["alltypes", "alltypes.options"]) # Define the compilation options opts = env.Clone() diff --git a/tests/field_size_32/SConscript b/tests/field_size_32/SConscript index a8584dc0..25ef3546 100644 --- a/tests/field_size_32/SConscript +++ b/tests/field_size_32/SConscript @@ -7,10 +7,10 @@ Import("env") c = Copy("$TARGET", "$SOURCE") env.Command("pb_encode.c", "#../pb_encode.c", c) env.Command("pb_decode.c", "#../pb_decode.c", c) -env.Command("encode_alltypes.c", "#alltypes/encode_alltypes.c", c) -env.Command("decode_alltypes.c", "#alltypes/decode_alltypes.c", c) +env.Command("encode_alltypes.c", "$BUILD/alltypes/encode_alltypes.c", c) +env.Command("decode_alltypes.c", "$BUILD/alltypes/decode_alltypes.c", c) -env.NanopbProto("alltypes") +env.NanopbProto(["alltypes", "alltypes.options"]) # Define the compilation options opts = env.Clone() diff --git a/tests/missing_fields/SConscript b/tests/missing_fields/SConscript index 361b5502..9926efad 100644 --- a/tests/missing_fields/SConscript +++ b/tests/missing_fields/SConscript @@ -3,6 +3,6 @@ Import("env") env.NanopbProto("missing_fields") -test = env.Program(["missing_fields.c", "missing_fields.pb.c", "#common/pb_encode.o", "#common/pb_decode.o"]) +test = env.Program(["missing_fields.c", "missing_fields.pb.c", "$COMMON/pb_encode.o", "$COMMON/pb_decode.o"]) env.RunTest(test) diff --git a/tests/no_errmsg/SConscript b/tests/no_errmsg/SConscript index 870e8946..2b9815d1 100644 --- a/tests/no_errmsg/SConscript +++ b/tests/no_errmsg/SConscript @@ -6,10 +6,10 @@ Import("env") c = Copy("$TARGET", "$SOURCE") env.Command("pb_encode.c", "#../pb_encode.c", c) env.Command("pb_decode.c", "#../pb_decode.c", c) -env.Command("alltypes.pb.h", "#alltypes/alltypes.pb.h", c) -env.Command("alltypes.pb.c", "#alltypes/alltypes.pb.c", c) -env.Command("encode_alltypes.c", "#alltypes/encode_alltypes.c", c) -env.Command("decode_alltypes.c", "#alltypes/decode_alltypes.c", c) +env.Command("alltypes.pb.h", "$BUILD/alltypes/alltypes.pb.h", c) +env.Command("alltypes.pb.c", "$BUILD/alltypes/alltypes.pb.c", c) +env.Command("encode_alltypes.c", "$BUILD/alltypes/encode_alltypes.c", c) +env.Command("decode_alltypes.c", "$BUILD/alltypes/decode_alltypes.c", c) # Define the compilation options opts = env.Clone() |