diff options
author | gspencer@google.com <gspencer@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-07-01 22:30:03 +0000 |
---|---|---|
committer | gspencer@google.com <gspencer@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-07-01 22:30:03 +0000 |
commit | 30eb751d1a778b73e20c238ec2f54b7293eb1b6f (patch) | |
tree | 64f775e2bf824492b8d1e3e2680d05592a0abb57 | |
parent | 5d3d854522bf38df112ca73e3bb6e9c4adb627ae (diff) | |
download | chromium_src-30eb751d1a778b73e20c238ec2f54b7293eb1b6f.zip chromium_src-30eb751d1a778b73e20c238ec2f54b7293eb1b6f.tar.gz chromium_src-30eb751d1a778b73e20c238ec2f54b7293eb1b6f.tar.bz2 |
Adding in most of the unit tests. This adds 406 of our unit tests
into the gyp build. 21 of them fail, but that is only because they don't
have test input yet -- I haven't added the build code that copies
the test inputs into the build dir yet.
Review URL: http://codereview.chromium.org/147129
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@19778 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r-- | o3d/build/all.gyp | 1 | ||||
-rw-r--r-- | o3d/build/nacl.gyp | 4 | ||||
-rw-r--r-- | o3d/core/core.gyp | 119 | ||||
-rw-r--r-- | o3d/core/win/d3d9/effect_d3d9.cc | 4 | ||||
-rw-r--r-- | o3d/import/cross/memory_stream_test.cc | 6 | ||||
-rw-r--r-- | o3d/import/import.gyp | 35 | ||||
-rw-r--r-- | o3d/plugin/plugin.gyp | 18 | ||||
-rw-r--r-- | o3d/plugin/win/main_win.cc | 2 | ||||
-rw-r--r-- | o3d/serializer/serializer.gyp | 11 | ||||
-rw-r--r-- | o3d/statsreport/statsreport.gyp | 53 | ||||
-rw-r--r-- | o3d/tests/build.scons | 12 | ||||
-rw-r--r-- | o3d/tests/common/win/testing_common.cc | 3 | ||||
-rw-r--r-- | o3d/utils/utils.gyp | 21 |
13 files changed, 176 insertions, 113 deletions
diff --git a/o3d/build/all.gyp b/o3d/build/all.gyp index 6ca0803..43ea2ae 100644 --- a/o3d/build/all.gyp +++ b/o3d/build/all.gyp @@ -23,6 +23,7 @@ '../converter/converter.gyp:*', '../core/core.gyp:*', '../import/import.gyp:*', + '../tests/tests.gyp:*', '../plugin/idl/idl.gyp:*', '../plugin/plugin.gyp:*', '../serializer/serializer.gyp:*', diff --git a/o3d/build/nacl.gyp b/o3d/build/nacl.gyp index 99ed5ec..8b84e89 100644 --- a/o3d/build/nacl.gyp +++ b/o3d/build/nacl.gyp @@ -34,7 +34,7 @@ 'dummy_file_that_never_gets_built_so_scons_always_runs', ], 'action': [ - 'python', + 'C:/Python24/python.exe', '<@(_inputs)', '--output="<(nacl_output_dir)"', '--configuration="<(CONFIGURATION)"', @@ -43,7 +43,7 @@ ], }, ], - 'direct_dependent_settings': { + 'all_dependent_settings': { 'include_dirs': [ '<(nacldir)', ], diff --git a/o3d/core/core.gyp b/o3d/core/core.gyp index 1f27990..949b9f5 100644 --- a/o3d/core/core.gyp +++ b/o3d/core/core.gyp @@ -35,6 +35,7 @@ '../../<(pngdir)/libpng.gyp:libpng', '../../<(zlibdir)/zlib.gyp:zlib', '../../skia/skia.gyp:skia', + '../build/nacl.gyp:build_nacl', ], 'sources': [ 'cross/bitmap.cc', @@ -268,63 +269,6 @@ ], }, { - 'target_name': 'o3dCoreTest', - 'type': 'static_library', - 'dependencies': [ - ], - 'sources': [ - 'cross/bitmap_test.cc', - 'cross/bounding_box_test.cc', - 'cross/buffer_test.cc', - 'cross/class_manager_test.cc', - 'cross/client_test.cc', - 'cross/counter_test.cc', - 'cross/curve_test.cc', - 'cross/draw_element_test.cc', - 'cross/draw_list_test.cc', - 'cross/draw_pass_test.cc', - 'cross/effect_test.cc', - 'cross/element_test.cc', - 'cross/features_test.cc', - 'cross/field_test.cc', - 'cross/float_n_test.cc', - 'cross/function_test.cc', - 'cross/material_test.cc', - 'cross/math_utilities_test.cc', - 'cross/matrix4_axis_rotation_test.cc', - 'cross/matrix4_composition_test.cc', - 'cross/matrix4_scale_test.cc', - 'cross/matrix4_translation_test.cc', -# TODO(gspencer): fix this test so it can be re-enabled. -# 'cross/message_queue_test.cc', - 'cross/object_base_test.cc', - 'cross/pack_test.cc', - 'cross/param_array_test.cc', - 'cross/param_object_test.cc', - 'cross/param_operation_test.cc', - 'cross/param_test.cc', - 'cross/performance_timer_test.cc', - 'cross/primitive_test.cc', - 'cross/ray_intersection_info_test.cc', - 'cross/render_node_test.cc', - 'cross/renderer_test.cc', - 'cross/service_locator_test.cc', - 'cross/shape_test.cc', - 'cross/skin_test.cc', - 'cross/smart_ptr_test.cc', - 'cross/state_set_test.cc', - 'cross/state_test.cc', - 'cross/stream_bank_test.cc', - 'cross/stream_test.cc', - 'cross/transform_test.cc', - 'cross/tree_traversal_test.cc', - 'cross/vector_map_test.cc', - 'cross/vertex_source_test.cc', - 'cross/visitor_base_test.cc', - 'cross/weak_ptr_test.cc', - ], - }, - { 'target_name': 'o3dCorePlatform', 'type': 'static_library', 'dependencies': [ @@ -395,5 +339,66 @@ ], ], }, + { + 'target_name': 'o3dCoreTest', + 'type': 'none', + 'dependencies': [ + 'o3dCore', + 'o3dCorePlatform', + ], + 'direct_dependent_settings': { + 'sources': [ + 'cross/bitmap_test.cc', + 'cross/bounding_box_test.cc', + 'cross/buffer_test.cc', + 'cross/class_manager_test.cc', + 'cross/client_test.cc', + 'cross/counter_test.cc', + 'cross/curve_test.cc', + 'cross/draw_element_test.cc', + 'cross/draw_list_test.cc', + 'cross/draw_pass_test.cc', + 'cross/effect_test.cc', + 'cross/element_test.cc', + 'cross/features_test.cc', + 'cross/field_test.cc', + 'cross/float_n_test.cc', + 'cross/function_test.cc', + 'cross/material_test.cc', + 'cross/math_utilities_test.cc', + 'cross/matrix4_axis_rotation_test.cc', + 'cross/matrix4_composition_test.cc', + 'cross/matrix4_scale_test.cc', + 'cross/matrix4_translation_test.cc', + # TODO(gspencer): fix this test so it can be re-enabled. + # 'cross/message_queue_test.cc', + 'cross/object_base_test.cc', + 'cross/pack_test.cc', + 'cross/param_array_test.cc', + 'cross/param_object_test.cc', + 'cross/param_operation_test.cc', + 'cross/param_test.cc', + 'cross/performance_timer_test.cc', + 'cross/primitive_test.cc', + 'cross/ray_intersection_info_test.cc', + 'cross/render_node_test.cc', + 'cross/renderer_test.cc', + 'cross/service_locator_test.cc', + 'cross/shape_test.cc', + 'cross/skin_test.cc', + 'cross/smart_ptr_test.cc', + 'cross/state_set_test.cc', + 'cross/state_test.cc', + 'cross/stream_bank_test.cc', + 'cross/stream_test.cc', + 'cross/transform_test.cc', + 'cross/tree_traversal_test.cc', + 'cross/vector_map_test.cc', + 'cross/vertex_source_test.cc', + 'cross/visitor_base_test.cc', + 'cross/weak_ptr_test.cc', + ], + }, + }, ], } diff --git a/o3d/core/win/d3d9/effect_d3d9.cc b/o3d/core/win/d3d9/effect_d3d9.cc index 2bac2d9..830f5a4 100644 --- a/o3d/core/win/d3d9/effect_d3d9.cc +++ b/o3d/core/win/d3d9/effect_d3d9.cc @@ -254,7 +254,7 @@ class EffectParamSamplerArrayHandlerD3D9 : public EffectParamHandlerD3D9 { << "number of params in ParamArray does not match number of params " << "needed by shader array"; } else { - for (int i = 0; i < size; ++i) { + for (unsigned i = 0; i < size; ++i) { SamplerUnitIndexArray& index_array = sampler_unit_index_arrays_[i]; Param* untyped_element = param->GetUntypedParam(i); // TODO(gman): Make this check happen when building the param cache. @@ -297,7 +297,7 @@ class EffectParamSamplerArrayHandlerD3D9 : public EffectParamHandlerD3D9 { if (param) { unsigned size = param->size(); if (size == sampler_unit_index_arrays_.size()) { - for (int i = 0; i < size; ++i) { + for (unsigned i = 0; i < size; ++i) { SamplerUnitIndexArray& index_array = sampler_unit_index_arrays_[i]; Param* untyped_element = param->GetUntypedParam(i); // TODO(gman): Make this check happen when building the param cache. diff --git a/o3d/import/cross/memory_stream_test.cc b/o3d/import/cross/memory_stream_test.cc index a02fcca..77ae95c 100644 --- a/o3d/import/cross/memory_stream_test.cc +++ b/o3d/import/cross/memory_stream_test.cc @@ -233,7 +233,7 @@ TEST_F(MemoryStreamTest, EndianSanityFloat32) { uint8 *p8 = reinterpret_cast<uint8*>(p); MemoryWriteStream write_stream(p8, sizeof(int32) * 2); - float value = 3.14159; + float value = 3.14159f; write_stream.WriteLittleEndianFloat32(value); write_stream.WriteBigEndianFloat32(value); @@ -261,9 +261,9 @@ TEST_F(MemoryStreamTest, EndianSanityFloat32) { TEST_F(MemoryStreamTest, Endian) { const int16 kValue1 = 13243; const int32 kValue2 = 2393043; - const float kValue3 = -0.039483; + const float kValue3 = -0.039483f; const int16 kValue4 = -3984; - const float kValue5 = 1234.5678; + const float kValue5 = 1234.5678f; const uint8 kValue6 = 5; // write a single byte to make things interesting const int32 kValue7 = -3920393; diff --git a/o3d/import/import.gyp b/o3d/import/import.gyp index 4ecb9c64..41cd4c4 100644 --- a/o3d/import/import.gyp +++ b/o3d/import/import.gyp @@ -126,5 +126,40 @@ ], ], }, + { + 'target_name': 'o3dImportTest', + 'type': 'none', + 'dependencies': [ + 'o3dArchive', + 'o3dImport', + '../../<(antlrdir)/antlr.gyp:antlr3c', + '../../<(fcolladadir)/fcollada.gyp:fcollada', + '../../<(jpegdir)/libjpeg.gyp:libjpeg', + '../../<(pngdir)/libpng.gyp:libpng', + '../../<(zlibdir)/zlib.gyp:zlib', + ], + 'direct_dependent_settings': { + 'sources': [ + 'cross/gz_compressor_test.cc', + 'cross/gz_decompressor_test.cc', + 'cross/memory_buffer_test.cc', + 'cross/memory_stream_test.cc', + 'cross/raw_data_test.cc', + 'cross/tar_generator_test.cc', + 'cross/tar_processor_test.cc', + 'cross/targz_generator_test.cc', + 'cross/targz_processor_test.cc', + ], + 'conditions' : [ + ['renderer == "d3d9" and OS == "win"', + { + 'include_dirs': [ + '$(DXSDK_DIR)/Include', + ], + } + ], + ], + }, + }, ], } diff --git a/o3d/plugin/plugin.gyp b/o3d/plugin/plugin.gyp index 86c4695..3966d40 100644 --- a/o3d/plugin/plugin.gyp +++ b/o3d/plugin/plugin.gyp @@ -21,6 +21,7 @@ 'O3D_PLUGIN_MIME_TYPE="<!(python version_info.py --mimetype)"', ], }, + 'targets': [ { 'target_name': 'npo3dautoplugin', @@ -108,16 +109,21 @@ 'msvs_settings': { 'VCLinkerTool': { 'AdditionalDependencies': [ + 'rpcrt4.lib', + ], + }, + }, + }, + ], + ['OS == "win" and renderer == "d3d9"', + { + 'msvs_settings': { + 'VCLinkerTool': { + 'AdditionalDependencies': [ '"$(DXSDK_DIR)/Lib/x86/DxErr9.lib"', '"$(DXSDK_DIR)/Lib/x86/d3dx9.lib"', - '../../<(cgdir)/lib/cg.lib', - '../../<(cgdir)/lib/cgGL.lib', 'd3d9.lib', - 'rpcrt4.lib', ], - # Set /SUBSYSTEM:CONSOLE for converter.exe, since - # it is a console app. - 'SubSystem': '1', }, }, }, diff --git a/o3d/plugin/win/main_win.cc b/o3d/plugin/win/main_win.cc index db11b17..90f8d44 100644 --- a/o3d/plugin/win/main_win.cc +++ b/o3d/plugin/win/main_win.cc @@ -47,7 +47,7 @@ #include "plugin/cross/plugin_logging.h" #include "plugin/cross/out_of_memory.h" #include "statsreport/metrics.h" -#include "third_party/v8/include/v8.h" +#include "v8/include/v8.h" #include "breakpad/win/bluescreen_detector.h" using glue::_o3d::PluginObject; diff --git a/o3d/serializer/serializer.gyp b/o3d/serializer/serializer.gyp index 906f77f..9953aaf 100644 --- a/o3d/serializer/serializer.gyp +++ b/o3d/serializer/serializer.gyp @@ -30,10 +30,15 @@ }, { 'target_name': 'o3dSerializerTest', - 'type': 'static_library', - 'sources': [ - 'cross/serializer_test.cc', + 'type': 'none', + 'dependencies': [ + 'o3dSerializer', ], + 'direct_dependent_settings': { + 'sources': [ + 'cross/serializer_test.cc', + ], + }, }, ], } diff --git a/o3d/statsreport/statsreport.gyp b/o3d/statsreport/statsreport.gyp index 2b045d6..99b97e6 100644 --- a/o3d/statsreport/statsreport.gyp +++ b/o3d/statsreport/statsreport.gyp @@ -84,33 +84,38 @@ }, { 'target_name': 'o3dStatsReportTest', - 'type': 'static_library', - 'sources': [ - 'aggregator-win32_unittest.cc', - 'aggregator-win32_unittest.h', - 'aggregator_unittest.cc', - 'aggregator_unittest.h', - 'common/highres_timer_unittest.cc', - 'formatter_unittest.cc', - 'metrics_unittest.cc', - 'persistent_iterator-win32_unittest.cc', + 'type': 'none', + 'dependencies': [ + 'o3dStatsReport', ], - 'conditions': [ - ['OS != "win"', - { - 'sources/': [ - ['exclude', '(-win32)_unittest\.(cc|h)$'], - ], - }, + 'direct_dependent_settings': { + 'sources': [ + 'aggregator-win32_unittest.cc', + 'aggregator-win32_unittest.h', + 'aggregator_unittest.cc', + 'aggregator_unittest.h', + 'common/highres_timer_unittest.cc', + 'formatter_unittest.cc', + 'metrics_unittest.cc', + 'persistent_iterator-win32_unittest.cc', ], - ['OS != "mac"', - { - 'sources/': [ - ['exclude', '(-mac)_unittest\.(cc|mm|h)$'], - ], - }, + 'conditions': [ + ['OS != "win"', + { + 'sources/': [ + ['exclude', '(-win32)_unittest\.(cc|h)$'], + ], + }, + ], + ['OS != "mac"', + { + 'sources/': [ + ['exclude', '(-mac)_unittest\.(cc|mm|h)$'], + ], + }, + ], ], - ], + }, }, ], }, diff --git a/o3d/tests/build.scons b/o3d/tests/build.scons index 83efd83..218fbda 100644 --- a/o3d/tests/build.scons +++ b/o3d/tests/build.scons @@ -153,12 +153,12 @@ if env.Bit('windows'): env.Help('\n') swiftshader_install = [] -if env.Bit('windows'):
- # Copy SwiftShader to plugin dir.
- swiftshader_path = env.subst('$SWIFTSHADER_DIR/swiftshader_d3d9.dll')
- if os.path.exists(swiftshader_path):
- swiftshader_install = env.Replicate('$ARTIFACTS_DIR/O3DExtras',
- swiftshader_path)
+if env.Bit('windows'): + # Copy SwiftShader to plugin dir. + swiftshader_path = env.subst('$SWIFTSHADER_DIR/swiftshader_d3d9.dll') + if os.path.exists(swiftshader_path): + swiftshader_install = env.Replicate('$ARTIFACTS_DIR/O3DExtras', + swiftshader_path) # ------------------------------------------------------------------------- # Unit tests diff --git a/o3d/tests/common/win/testing_common.cc b/o3d/tests/common/win/testing_common.cc index e51fc6a..702f970 100644 --- a/o3d/tests/common/win/testing_common.cc +++ b/o3d/tests/common/win/testing_common.cc @@ -160,7 +160,8 @@ int WINAPI WinMain(HINSTANCE instance, display_window = display_window; display_window->set_hwnd(g_window_handle); g_display_window = display_window; - bool offscreen = ::GetEnvironmentVariableW(kOffScreenRenderer, NULL, 0); + bool offscreen = (::GetEnvironmentVariableW(kOffScreenRenderer, + NULL, 0) == 0); if (offscreen) { success = g_renderer->Init(*g_display_window, true) == o3d::Renderer::SUCCESS; diff --git a/o3d/utils/utils.gyp b/o3d/utils/utils.gyp index a193113..9fb5e45 100644 --- a/o3d/utils/utils.gyp +++ b/o3d/utils/utils.gyp @@ -44,15 +44,20 @@ }, { 'target_name': 'o3dUtilsTest', - 'type': 'static_library', - 'sources': [ - "cross/file_path_utils_test.cc", - "cross/file_text_reader_test.cc", - "cross/json_writer_test.cc", - "cross/string_reader_test.cc", - "cross/string_writer_test.cc", - "cross/temporary_file_test.cc", + 'type': 'none', + 'dependencies': [ + 'o3dUtils', ], + 'direct_dependent_settings': { + 'sources': [ + "cross/file_path_utils_test.cc", + "cross/file_text_reader_test.cc", + "cross/json_writer_test.cc", + "cross/string_reader_test.cc", + "cross/string_writer_test.cc", + "cross/temporary_file_test.cc", + ], + }, }, ], } |