| 29 | | config_info = ConfigInfoAdapter(lib_name, lib_map, default_lib_settings, |
|---|
| 30 | | osg_lib_suffix=shared_lib_suffix) |
|---|
| | 29 | try: |
|---|
| | 30 | config_info = ConfigInfoAdapter(lib_name, lib_map, default_lib_settings, |
|---|
| | 31 | osg_lib_suffix=shared_lib_suffix) |
|---|
| | 32 | ## config_info = ConfigInfoAdapter(lib_name, lib_map, default_lib_settings, |
|---|
| | 33 | ## osg_lib_suffix=shared_lib_suffix, opts=opts) |
|---|
| | 34 | #except Exception, e: |
|---|
| | 35 | except EOFError, e: |
|---|
| | 36 | print "Caught %s trying to configure deps for %s!" % (str(e), lib_name) |
|---|
| | 37 | break |
|---|
| 54 | | # Verify we have all the deps for the tests |
|---|
| 55 | | # todo: How do we verify the "other test libs" |
|---|
| 56 | | have_test_deps = True |
|---|
| 57 | | for n in library.osg_test_libs: |
|---|
| 58 | | if not lib_map.has_key(n): |
|---|
| 59 | | have_test_deps = False |
|---|
| 60 | | print "*******************************************" |
|---|
| 61 | | print " missing test dep library:", n |
|---|
| 62 | | print "*******************************************" |
|---|
| 63 | | |
|---|
| 64 | | if have_test_deps: |
|---|
| 65 | | # Use ConfigInfo to find build flags for building applications against this library |
|---|
| 66 | | config_info = ConfigInfoAdapter([lib_name] + library.osg_test_libs, |
|---|
| 67 | | lib_map, |
|---|
| 68 | | osg_lib_suffix=shared_lib_suffix) |
|---|
| 69 | | test_env = build_env.Copy() |
|---|
| 70 | | test_env.Append(CPPPATH=library.test_cpppath + config_info.getIncPath(), |
|---|
| 71 | | LIBPATH=library.test_libpath + [inst_paths["lib_inst_combo"]] + config_info.getLibPath(), |
|---|
| 72 | | LIBS=config_info.getLibs() + library.other_test_libs) |
|---|
| 73 | | |
|---|
| 74 | | # - Build them all in the local 'test' subdir |
|---|
| 75 | | for s in library.test_files: |
|---|
| 76 | | test_env.Program(target= pj("..","test",os.path.splitext(os.path.basename(s))[0]), |
|---|
| 77 | | source=s) |
|---|
| 78 | | |
|---|
| 79 | | # ---- Build Unit Tests ---- # |
|---|
| 80 | | # - Build them all in the unittest directory |
|---|
| 81 | | if build_env["enable_unittests"] and (len(library.unittest_files) > 0): |
|---|
| 82 | | unittest_env = test_env.Copy() |
|---|
| 83 | | unittest_env.Append(CPPPATH=unittest_inc, |
|---|
| 84 | | LIBPATH=unittest_libpath, |
|---|
| 85 | | LIBS=unittest_lib) |
|---|
| 86 | | runner_obj = unittest_env.Object(target=pj("..","unittest","run"+lib_name), source=unittest_runner) |
|---|
| 87 | | runner = unittest_env.Program(pj("..","unittest","run"+lib_name), |
|---|
| 88 | | library.unittest_files + [str(runner_obj[0])]) |
|---|
| | 61 | # Use ConfigInfo to find build flags for building applications against this library |
|---|
| | 62 | config_info = ConfigInfoAdapter([lib_name] + library.osg_test_libs, |
|---|
| | 63 | lib_map, |
|---|
| | 64 | osg_lib_suffix=shared_lib_suffix) |
|---|
| | 65 | ##config_info = ConfigInfoAdapter([lib_name] + library.osg_test_libs, |
|---|
| | 66 | ## lib_map, |
|---|
| | 67 | ## osg_lib_suffix=shared_lib_suffix, opts=opts) |
|---|
| | 68 | test_env = build_env.Copy() |
|---|
| | 69 | test_env.Append(CPPPATH=library.test_cpppath + config_info.getIncPath(), |
|---|
| | 70 | LIBPATH=library.test_libpath + [inst_paths["lib_inst_combo"]] + config_info.getLibPath(), |
|---|
| | 71 | LIBS=config_info.getLibs() + library.other_test_libs) |
|---|
| 90 | | # Run the Test once the program is built |
|---|
| 91 | | def runTest(target, source, env): |
|---|
| 92 | | print "Running ", os.path.basename(str(target[0])) |
|---|
| 93 | | os.system(str(target[0])) |
|---|
| | 73 | # - Build them all in the local 'test' subdir |
|---|
| | 74 | for s in library.test_files: |
|---|
| | 75 | test_env.Program(target= pj("..","test",os.path.splitext(os.path.basename(s))[0]), |
|---|
| | 76 | source=s) |
|---|
| 95 | | AddPostAction(runner, runTest) |
|---|
| | 78 | # ---- Build Unit Tests ---- # |
|---|
| | 79 | # - Build them all in the unittest directory |
|---|
| | 80 | if build_env["enable_unittests"] and (len(library.unittest_files) > 0): |
|---|
| | 81 | unittest_env = test_env.Copy() |
|---|
| | 82 | unittest_env.Append(CPPPATH=unittest_inc, |
|---|
| | 83 | LIBPATH=unittest_libpath, |
|---|
| | 84 | LIBS=unittest_lib) |
|---|
| | 85 | runner_obj = unittest_env.Object(target=pj("..","unittest","run"+lib_name), source=unittest_runner) |
|---|
| | 86 | runner = unittest_env.Program(pj("..","unittest","run"+lib_name), |
|---|
| | 87 | library.unittest_files + [str(runner_obj[0])]) |
|---|
| | 88 | |
|---|
| | 89 | # Run the Test once the program is built |
|---|
| | 90 | def runTest(target, source, env): |
|---|
| | 91 | print "Running ", os.path.basename(str(target[0])) |
|---|
| | 92 | env = os.environ |
|---|
| | 93 | if os.name == 'nt': |
|---|
| | 94 | env['PATH'] += inst_paths['lib_inst_combo'] |
|---|
| | 95 | else: |
|---|
| | 96 | if 'LD_LIBRARY_PATH' in env: |
|---|
| | 97 | env['LD_LIBRARY_PATH'] += inst_paths['lib_inst_combo'] |
|---|
| | 98 | else: |
|---|
| | 99 | env['LD_LIBRARY_PATH'] = inst_paths['lib_inst_combo'] |
|---|
| | 100 | os.spawnle(os.P_WAIT, str(target[0]), env) |
|---|
| | 101 | |
|---|
| | 102 | AddPostAction(runner, runTest) |
|---|