Make tests build in a separate folder, add to gitignore

This commit is contained in:
Petteri Aimonen
2013-11-13 22:10:42 +02:00
parent 171d64734a
commit 5813144246
17 changed files with 61 additions and 51 deletions

19
.gitignore vendored
View File

@@ -5,17 +5,22 @@
*.pb.c *.pb.c
*.pb.h *.pb.h
*.pb *.pb
*.pyc
*~ *~
*.tar.gz *.tar.gz
.sconsign.dblite .sconsign.dblite
config.log
.sconf_temp
tests/build
julkaisu.txt julkaisu.txt
docs/*.html docs/*.html
docs/generator_flow.png docs/generator_flow.png
example/client examples/simple/simple
example/server examples/network_server/client
example_avr_double/decode_double examples/network_server/server
example_avr_double/encode_double examples/using_double_on_avr/decode_double
example_avr_double/test_conversions examples/using_double_on_avr/encode_double
example_unions/decode examples/using_double_on_avr/test_conversions
example_unions/encode examples/using_union_messages/decode
examples/using_union_messages/encode
generator/nanopb_pb2.pyc generator/nanopb_pb2.pyc

View File

@@ -26,7 +26,7 @@ if 'CXXFLAGS' in ARGUMENTS: env.Append(CCFLAGS = ARGUMENTS['CXXFLAGS'])
add_nanopb_builders(env) add_nanopb_builders(env)
# Path to the files shared by tests, and to the nanopb core. # 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 # Path for finding nanopb.proto
env.Append(PROTOCPATH = '#../generator') env.Append(PROTOCPATH = '#../generator')
@@ -110,5 +110,10 @@ elif 'cl' in env['CXX']:
env.Append(CXXFLAGS = '/Zi /W2 /WX') env.Append(CXXFLAGS = '/Zi /W2 /WX')
# Now include the SConscript files from all subdirectories # 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)))

View File

@@ -3,9 +3,9 @@
Import("env") Import("env")
env.NanopbProto("alltypes") env.NanopbProto(["alltypes", "alltypes.options"])
enc = env.Program(["encode_alltypes.c", "alltypes.pb.c", "#common/pb_encode.o"]) 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"]) dec = env.Program(["decode_alltypes.c", "alltypes.pb.c", "$COMMON/pb_decode.o"])
env.RunTest(enc) env.RunTest(enc)
env.RunTest([dec, "encode_alltypes.output"]) env.RunTest([dec, "encode_alltypes.output"])

View File

@@ -3,8 +3,8 @@
Import("env") Import("env")
enc = env.Program(["encode_legacy.c", "alltypes_legacy.c", "#common/pb_encode.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"]) dec = env.Program(["decode_legacy.c", "alltypes_legacy.c", "$COMMON/pb_decode.o"])
env.RunTest(enc) env.RunTest(enc)
env.RunTest([dec, "encode_legacy.output"]) env.RunTest([dec, "encode_legacy.output"])

View File

@@ -2,11 +2,11 @@
Import("env") Import("env")
enc = env.Program(["encode_buffer.c", "#common/person.pb.c", "#common/pb_encode.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"]) dec = env.Program(["decode_buffer.c", "$COMMON/person.pb.c", "$COMMON/pb_decode.o"])
env.RunTest(enc) env.RunTest(enc)
env.RunTest([dec, "encode_buffer.output"]) 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"]) env.Compare(["decode_buffer.output", "encode_buffer.decoded"])

View File

@@ -2,11 +2,11 @@
Import("env") Import("env")
enc = env.Program(["encode_stream.c", "#common/person.pb.c", "#common/pb_encode.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"]) dec = env.Program(["decode_stream.c", "$COMMON/person.pb.c", "$COMMON/pb_decode.o"])
env.RunTest(enc) env.RunTest(enc)
env.RunTest([dec, "encode_stream.output"]) 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"]) env.Compare(["decode_stream.output", "encode_stream.decoded"])

View File

@@ -6,10 +6,10 @@ Import("env")
c = Copy("$TARGET", "$SOURCE") c = Copy("$TARGET", "$SOURCE")
env.Command("pb_encode.c", "#../pb_encode.c", c) env.Command("pb_encode.c", "#../pb_encode.c", c)
env.Command("pb_decode.c", "#../pb_decode.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.h", "$BUILD/alltypes/alltypes.pb.h", c)
env.Command("alltypes.pb.c", "#alltypes/alltypes.pb.c", c) env.Command("alltypes.pb.c", "$BUILD/alltypes/alltypes.pb.c", c)
env.Command("encode_alltypes.c", "#alltypes/encode_alltypes.c", c) env.Command("encode_alltypes.c", "$BUILD/alltypes/encode_alltypes.c", c)
env.Command("decode_alltypes.c", "#alltypes/decode_alltypes.c", c) env.Command("decode_alltypes.c", "$BUILD/alltypes/decode_alltypes.c", c)
# Define the compilation options # Define the compilation options
opts = env.Clone() opts = env.Clone()

View File

@@ -3,8 +3,8 @@
Import("env") Import("env")
env.NanopbProto("callbacks") env.NanopbProto("callbacks")
enc = env.Program(["encode_callbacks.c", "callbacks.pb.c", "#common/pb_encode.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"]) dec = env.Program(["decode_callbacks.c", "callbacks.pb.c", "$COMMON/pb_decode.o"])
env.RunTest(enc) env.RunTest(enc)
env.RunTest([dec, "encode_callbacks.output"]) env.RunTest([dec, "encode_callbacks.output"])

View File

@@ -7,10 +7,10 @@ Import("env")
c = Copy("$TARGET", "$SOURCE") c = Copy("$TARGET", "$SOURCE")
env.Command("pb_encode.cxx", "#../pb_encode.c", c) env.Command("pb_encode.cxx", "#../pb_encode.c", c)
env.Command("pb_decode.cxx", "#../pb_decode.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.h", "$BUILD/alltypes/alltypes.pb.h", c)
env.Command("alltypes.pb.cxx", "#alltypes/alltypes.pb.c", c) env.Command("alltypes.pb.cxx", "$BUILD/alltypes/alltypes.pb.c", c)
env.Command("encode_alltypes.cxx", "#alltypes/encode_alltypes.c", c) env.Command("encode_alltypes.cxx", "$BUILD/alltypes/encode_alltypes.c", c)
env.Command("decode_alltypes.cxx", "#alltypes/decode_alltypes.c", c) env.Command("decode_alltypes.cxx", "$BUILD/alltypes/decode_alltypes.c", c)
# Now build and run the test normally. # Now build and run the test normally.
enc = env.Program(["encode_alltypes.cxx", "alltypes.pb.cxx", "pb_encode.cxx"]) enc = env.Program(["encode_alltypes.cxx", "alltypes.pb.cxx", "pb_encode.cxx"])

View File

@@ -1,4 +1,4 @@
Import('env') 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) env.RunTest(p)

View File

@@ -1,5 +1,5 @@
# Build and run the stand-alone unit tests for the nanopb encoder part. # Build and run the stand-alone unit tests for the nanopb encoder part.
Import('env') 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) env.RunTest(p)

View File

@@ -4,12 +4,12 @@ Import("env")
# We use the files from the alltypes test case # We use the files from the alltypes test case
incpath = env.Clone() incpath = env.Clone()
incpath.Append(PROTOCPATH = '#alltypes') incpath.Append(PROTOCPATH = '$BUILD/alltypes')
incpath.Append(CPPPATH = '#alltypes') incpath.Append(CPPPATH = '$BUILD/alltypes')
incpath.NanopbProto("extensions") incpath.NanopbProto(["extensions", "extensions.options"])
enc = incpath.Program(["encode_extensions.c", "extensions.pb.c", "#alltypes/alltypes.pb$OBJSUFFIX", "#common/pb_encode.o"]) 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", "#alltypes/alltypes.pb$OBJSUFFIX", "#common/pb_decode.o"]) dec = incpath.Program(["decode_extensions.c", "extensions.pb.c", "$BUILD/alltypes/alltypes.pb$OBJSUFFIX", "$COMMON/pb_decode.o"])
env.RunTest(enc) env.RunTest(enc)
env.RunTest([dec, "encode_extensions.output"]) env.RunTest([dec, "encode_extensions.output"])

View File

@@ -2,13 +2,13 @@
Import("env") 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.RunTest('person_with_extra_field.output', [dec, "person_with_extra_field.pb"])
env.Compare(["person_with_extra_field.output", "person_with_extra_field.expected"]) 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.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"]) 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']) env.RunTest('alltypes_with_extra_fields.output', [dec2, 'alltypes_with_extra_fields.pb'])

View File

@@ -7,10 +7,10 @@ Import("env")
c = Copy("$TARGET", "$SOURCE") c = Copy("$TARGET", "$SOURCE")
env.Command("pb_encode.c", "#../pb_encode.c", c) env.Command("pb_encode.c", "#../pb_encode.c", c)
env.Command("pb_decode.c", "#../pb_decode.c", c) env.Command("pb_decode.c", "#../pb_decode.c", c)
env.Command("encode_alltypes.c", "#alltypes/encode_alltypes.c", c) env.Command("encode_alltypes.c", "$BUILD/alltypes/encode_alltypes.c", c)
env.Command("decode_alltypes.c", "#alltypes/decode_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 # Define the compilation options
opts = env.Clone() opts = env.Clone()

View File

@@ -7,10 +7,10 @@ Import("env")
c = Copy("$TARGET", "$SOURCE") c = Copy("$TARGET", "$SOURCE")
env.Command("pb_encode.c", "#../pb_encode.c", c) env.Command("pb_encode.c", "#../pb_encode.c", c)
env.Command("pb_decode.c", "#../pb_decode.c", c) env.Command("pb_decode.c", "#../pb_decode.c", c)
env.Command("encode_alltypes.c", "#alltypes/encode_alltypes.c", c) env.Command("encode_alltypes.c", "$BUILD/alltypes/encode_alltypes.c", c)
env.Command("decode_alltypes.c", "#alltypes/decode_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 # Define the compilation options
opts = env.Clone() opts = env.Clone()

View File

@@ -3,6 +3,6 @@
Import("env") Import("env")
env.NanopbProto("missing_fields") 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) env.RunTest(test)

View File

@@ -6,10 +6,10 @@ Import("env")
c = Copy("$TARGET", "$SOURCE") c = Copy("$TARGET", "$SOURCE")
env.Command("pb_encode.c", "#../pb_encode.c", c) env.Command("pb_encode.c", "#../pb_encode.c", c)
env.Command("pb_decode.c", "#../pb_decode.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.h", "$BUILD/alltypes/alltypes.pb.h", c)
env.Command("alltypes.pb.c", "#alltypes/alltypes.pb.c", c) env.Command("alltypes.pb.c", "$BUILD/alltypes/alltypes.pb.c", c)
env.Command("encode_alltypes.c", "#alltypes/encode_alltypes.c", c) env.Command("encode_alltypes.c", "$BUILD/alltypes/encode_alltypes.c", c)
env.Command("decode_alltypes.c", "#alltypes/decode_alltypes.c", c) env.Command("decode_alltypes.c", "$BUILD/alltypes/decode_alltypes.c", c)
# Define the compilation options # Define the compilation options
opts = env.Clone() opts = env.Clone()