rj_schema 0.0.1 → 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/Rakefile +4 -0
- data/ext/rj_schema/rapidjson/thirdparty/gtest/CMakeLists.txt +16 -0
- data/ext/rj_schema/rapidjson/thirdparty/gtest/README.md +141 -0
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/CHANGES +126 -0
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/CMakeLists.txt +202 -0
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/CONTRIBUTORS +40 -0
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/LICENSE +28 -0
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/Makefile.am +224 -0
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/README.md +333 -0
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/configure.ac +146 -0
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/docs/CheatSheet.md +562 -0
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/docs/CookBook.md +3675 -0
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/docs/DesignDoc.md +280 -0
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/docs/DevGuide.md +132 -0
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/docs/Documentation.md +12 -0
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/docs/ForDummies.md +439 -0
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/docs/FrequentlyAskedQuestions.md +628 -0
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/docs/KnownIssues.md +19 -0
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/docs/v1_5/CheatSheet.md +525 -0
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/docs/v1_5/CookBook.md +3250 -0
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/docs/v1_5/Documentation.md +11 -0
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/docs/v1_5/ForDummies.md +439 -0
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/docs/v1_5/FrequentlyAskedQuestions.md +624 -0
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/docs/v1_6/CheatSheet.md +534 -0
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/docs/v1_6/CookBook.md +3342 -0
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/docs/v1_6/Documentation.md +12 -0
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/docs/v1_6/ForDummies.md +439 -0
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/docs/v1_6/FrequentlyAskedQuestions.md +628 -0
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/docs/v1_7/CheatSheet.md +556 -0
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/docs/v1_7/CookBook.md +3432 -0
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/docs/v1_7/Documentation.md +12 -0
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/docs/v1_7/ForDummies.md +439 -0
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/docs/v1_7/FrequentlyAskedQuestions.md +628 -0
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/include/gmock/gmock-actions.h +1205 -0
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/include/gmock/gmock-cardinalities.h +147 -0
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/include/gmock/gmock-generated-actions.h +2377 -0
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/include/gmock/gmock-generated-actions.h.pump +794 -0
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/include/gmock/gmock-generated-function-mockers.h +1095 -0
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/include/gmock/gmock-generated-function-mockers.h.pump +291 -0
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/include/gmock/gmock-generated-matchers.h +2179 -0
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/include/gmock/gmock-generated-matchers.h.pump +672 -0
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/include/gmock/gmock-generated-nice-strict.h +397 -0
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/include/gmock/gmock-generated-nice-strict.h.pump +161 -0
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/include/gmock/gmock-matchers.h +4399 -0
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/include/gmock/gmock-more-actions.h +246 -0
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/include/gmock/gmock-more-matchers.h +58 -0
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/include/gmock/gmock-spec-builders.h +1847 -0
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/include/gmock/gmock.h +94 -0
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/include/gmock/internal/custom/gmock-generated-actions.h +8 -0
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/include/gmock/internal/custom/gmock-generated-actions.h.pump +10 -0
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/include/gmock/internal/custom/gmock-matchers.h +39 -0
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/include/gmock/internal/custom/gmock-port.h +46 -0
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/include/gmock/internal/gmock-generated-internal-utils.h +279 -0
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/include/gmock/internal/gmock-generated-internal-utils.h.pump +136 -0
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/include/gmock/internal/gmock-internal-utils.h +511 -0
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/include/gmock/internal/gmock-port.h +91 -0
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/make/Makefile +101 -0
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/msvc/2005/gmock.sln +32 -0
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/msvc/2005/gmock.vcproj +191 -0
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/msvc/2005/gmock_config.vsprops +15 -0
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/msvc/2005/gmock_main.vcproj +187 -0
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/msvc/2005/gmock_test.vcproj +201 -0
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/msvc/2010/gmock.sln +32 -0
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/msvc/2010/gmock.vcxproj +82 -0
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/msvc/2010/gmock_config.props +19 -0
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/msvc/2010/gmock_main.vcxproj +88 -0
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/msvc/2010/gmock_test.vcxproj +101 -0
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/msvc/2015/gmock.sln +32 -0
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/msvc/2015/gmock.vcxproj +84 -0
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/msvc/2015/gmock_config.props +19 -0
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/msvc/2015/gmock_main.vcxproj +90 -0
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/msvc/2015/gmock_test.vcxproj +103 -0
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/scripts/fuse_gmock_files.py +240 -0
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/scripts/generator/LICENSE +203 -0
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/scripts/generator/README +35 -0
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/scripts/generator/README.cppclean +115 -0
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/scripts/generator/cpp/__init__.py +0 -0
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/scripts/generator/cpp/ast.py +1733 -0
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/scripts/generator/cpp/gmock_class.py +227 -0
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/scripts/generator/cpp/gmock_class_test.py +448 -0
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/scripts/generator/cpp/keywords.py +59 -0
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/scripts/generator/cpp/tokenize.py +287 -0
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/scripts/generator/cpp/utils.py +41 -0
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/scripts/generator/gmock_gen.py +31 -0
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/scripts/gmock-config.in +303 -0
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/scripts/gmock_doctor.py +640 -0
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/scripts/upload.py +1387 -0
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/scripts/upload_gmock.py +78 -0
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/src/gmock-all.cc +47 -0
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/src/gmock-cardinalities.cc +156 -0
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/src/gmock-internal-utils.cc +174 -0
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/src/gmock-matchers.cc +498 -0
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/src/gmock-spec-builders.cc +823 -0
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/src/gmock.cc +183 -0
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/src/gmock_main.cc +54 -0
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/test/gmock-actions_test.cc +1411 -0
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/test/gmock-cardinalities_test.cc +428 -0
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/test/gmock-generated-actions_test.cc +1228 -0
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/test/gmock-generated-function-mockers_test.cc +622 -0
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/test/gmock-generated-internal-utils_test.cc +127 -0
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/test/gmock-generated-matchers_test.cc +1286 -0
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/test/gmock-internal-utils_test.cc +699 -0
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/test/gmock-matchers_test.cc +5648 -0
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/test/gmock-more-actions_test.cc +708 -0
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/test/gmock-nice-strict_test.cc +424 -0
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/test/gmock-port_test.cc +43 -0
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/test/gmock-spec-builders_test.cc +2644 -0
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/test/gmock_all_test.cc +51 -0
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/test/gmock_ex_test.cc +81 -0
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/test/gmock_leak_test.py +108 -0
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/test/gmock_leak_test_.cc +100 -0
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/test/gmock_link2_test.cc +40 -0
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/test/gmock_link_test.cc +40 -0
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/test/gmock_link_test.h +669 -0
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/test/gmock_output_test.py +180 -0
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/test/gmock_output_test_.cc +291 -0
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/test/gmock_output_test_golden.txt +310 -0
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/test/gmock_stress_test.cc +322 -0
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/test/gmock_test.cc +220 -0
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/test/gmock_test_utils.py +112 -0
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/CHANGES +157 -0
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/CMakeLists.txt +286 -0
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/CONTRIBUTORS +37 -0
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/LICENSE +28 -0
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/Makefile.am +310 -0
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/README.md +280 -0
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/cmake/internal_utils.cmake +242 -0
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/codegear/gtest.cbproj +138 -0
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/codegear/gtest.groupproj +54 -0
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/codegear/gtest_all.cc +38 -0
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/codegear/gtest_link.cc +40 -0
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/codegear/gtest_main.cbproj +82 -0
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/codegear/gtest_unittest.cbproj +88 -0
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/configure.ac +68 -0
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/docs/AdvancedGuide.md +2182 -0
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/docs/DevGuide.md +126 -0
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/docs/Documentation.md +14 -0
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/docs/FAQ.md +1087 -0
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/docs/Primer.md +502 -0
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/docs/PumpManual.md +177 -0
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/docs/Samples.md +14 -0
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/docs/V1_5_AdvancedGuide.md +2096 -0
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/docs/V1_5_Documentation.md +12 -0
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/docs/V1_5_FAQ.md +886 -0
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/docs/V1_5_Primer.md +497 -0
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/docs/V1_5_PumpManual.md +177 -0
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/docs/V1_5_XcodeGuide.md +93 -0
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/docs/V1_6_AdvancedGuide.md +2178 -0
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/docs/V1_6_Documentation.md +14 -0
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/docs/V1_6_FAQ.md +1038 -0
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/docs/V1_6_Primer.md +501 -0
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/docs/V1_6_PumpManual.md +177 -0
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/docs/V1_6_Samples.md +14 -0
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/docs/V1_6_XcodeGuide.md +93 -0
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/docs/V1_7_AdvancedGuide.md +2181 -0
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/docs/V1_7_Documentation.md +14 -0
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/docs/V1_7_FAQ.md +1082 -0
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/docs/V1_7_Primer.md +501 -0
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/docs/V1_7_PumpManual.md +177 -0
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/docs/V1_7_Samples.md +14 -0
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/docs/V1_7_XcodeGuide.md +93 -0
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/docs/XcodeGuide.md +93 -0
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/include/gtest/gtest-death-test.h +294 -0
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/include/gtest/gtest-message.h +250 -0
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/include/gtest/gtest-param-test.h +1444 -0
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/include/gtest/gtest-param-test.h.pump +510 -0
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/include/gtest/gtest-printers.h +993 -0
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/include/gtest/gtest-spi.h +232 -0
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/include/gtest/gtest-test-part.h +179 -0
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/include/gtest/gtest-typed-test.h +263 -0
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/include/gtest/gtest.h +2236 -0
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/include/gtest/gtest_pred_impl.h +358 -0
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/include/gtest/gtest_prod.h +58 -0
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/include/gtest/internal/custom/gtest-port.h +69 -0
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/include/gtest/internal/custom/gtest-printers.h +42 -0
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/include/gtest/internal/custom/gtest.h +41 -0
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/include/gtest/internal/gtest-death-test-internal.h +319 -0
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/include/gtest/internal/gtest-filepath.h +206 -0
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/include/gtest/internal/gtest-internal.h +1238 -0
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/include/gtest/internal/gtest-linked_ptr.h +243 -0
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/include/gtest/internal/gtest-param-util-generated.h +5146 -0
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/include/gtest/internal/gtest-param-util-generated.h.pump +286 -0
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/include/gtest/internal/gtest-param-util.h +731 -0
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/include/gtest/internal/gtest-port-arch.h +93 -0
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/include/gtest/internal/gtest-port.h +2554 -0
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/include/gtest/internal/gtest-string.h +167 -0
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/include/gtest/internal/gtest-tuple.h +1020 -0
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/include/gtest/internal/gtest-tuple.h.pump +347 -0
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/include/gtest/internal/gtest-type-util.h +3331 -0
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/include/gtest/internal/gtest-type-util.h.pump +297 -0
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/m4/acx_pthread.m4 +363 -0
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/m4/gtest.m4 +74 -0
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/make/Makefile +82 -0
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/msvc/gtest-md.sln +45 -0
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/msvc/gtest-md.vcproj +126 -0
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/msvc/gtest.sln +45 -0
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/msvc/gtest.vcproj +126 -0
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/msvc/gtest_main-md.vcproj +129 -0
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/msvc/gtest_main.vcproj +129 -0
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/msvc/gtest_prod_test-md.vcproj +164 -0
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/msvc/gtest_prod_test.vcproj +164 -0
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/msvc/gtest_unittest-md.vcproj +147 -0
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/msvc/gtest_unittest.vcproj +147 -0
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/samples/prime_tables.h +123 -0
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/samples/sample1.cc +68 -0
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/samples/sample1.h +43 -0
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/samples/sample10_unittest.cc +144 -0
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/samples/sample1_unittest.cc +153 -0
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/samples/sample2.cc +56 -0
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/samples/sample2.h +85 -0
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/samples/sample2_unittest.cc +109 -0
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/samples/sample3-inl.h +172 -0
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/samples/sample3_unittest.cc +151 -0
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/samples/sample4.cc +46 -0
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/samples/sample4.h +53 -0
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/samples/sample4_unittest.cc +45 -0
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/samples/sample5_unittest.cc +199 -0
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/samples/sample6_unittest.cc +224 -0
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/samples/sample7_unittest.cc +130 -0
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/samples/sample8_unittest.cc +173 -0
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/samples/sample9_unittest.cc +160 -0
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/scripts/common.py +83 -0
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/scripts/fuse_gtest_files.py +253 -0
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/scripts/gen_gtest_pred_impl.py +730 -0
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/scripts/gtest-config.in +274 -0
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/scripts/pump.py +855 -0
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/scripts/release_docs.py +158 -0
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/scripts/test/Makefile +59 -0
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/scripts/upload.py +1387 -0
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/scripts/upload_gtest.py +78 -0
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/src/gtest-all.cc +48 -0
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/src/gtest-death-test.cc +1342 -0
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/src/gtest-filepath.cc +387 -0
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/src/gtest-internal-inl.h +1183 -0
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/src/gtest-port.cc +1259 -0
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/src/gtest-printers.cc +373 -0
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/src/gtest-test-part.cc +110 -0
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/src/gtest-typed-test.cc +118 -0
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/src/gtest.cc +5388 -0
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/src/gtest_main.cc +38 -0
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/test/gtest-death-test_ex_test.cc +93 -0
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/test/gtest-death-test_test.cc +1427 -0
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/test/gtest-filepath_test.cc +662 -0
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/test/gtest-linked_ptr_test.cc +154 -0
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/test/gtest-listener_test.cc +311 -0
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/test/gtest-message_test.cc +159 -0
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/test/gtest-options_test.cc +215 -0
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/test/gtest-param-test2_test.cc +65 -0
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/test/gtest-param-test_test.cc +1055 -0
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/test/gtest-param-test_test.h +57 -0
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/test/gtest-port_test.cc +1304 -0
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/test/gtest-printers_test.cc +1635 -0
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/test/gtest-test-part_test.cc +208 -0
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/test/gtest-tuple_test.cc +320 -0
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/test/gtest-typed-test2_test.cc +45 -0
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/test/gtest-typed-test_test.cc +380 -0
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/test/gtest-typed-test_test.h +66 -0
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/test/gtest-unittest-api_test.cc +341 -0
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/test/gtest_all_test.cc +47 -0
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/test/gtest_break_on_failure_unittest.py +212 -0
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/test/gtest_break_on_failure_unittest_.cc +88 -0
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/test/gtest_catch_exceptions_test.py +237 -0
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/test/gtest_catch_exceptions_test_.cc +311 -0
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/test/gtest_color_test.py +130 -0
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/test/gtest_color_test_.cc +71 -0
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/test/gtest_env_var_test.py +117 -0
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/test/gtest_env_var_test_.cc +126 -0
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/test/gtest_environment_test.cc +192 -0
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/test/gtest_filter_unittest.py +636 -0
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/test/gtest_filter_unittest_.cc +140 -0
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/test/gtest_help_test.py +172 -0
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/test/gtest_help_test_.cc +46 -0
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/test/gtest_list_tests_unittest.py +207 -0
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/test/gtest_list_tests_unittest_.cc +157 -0
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/test/gtest_main_unittest.cc +45 -0
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/test/gtest_no_test_unittest.cc +56 -0
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/test/gtest_output_test.py +340 -0
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/test/gtest_output_test_.cc +1062 -0
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/test/gtest_output_test_golden_lin.txt +743 -0
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/test/gtest_pred_impl_unittest.cc +2427 -0
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/test/gtest_premature_exit_test.cc +127 -0
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/test/gtest_prod_test.cc +57 -0
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/test/gtest_repeat_test.cc +253 -0
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/test/gtest_shuffle_test.py +325 -0
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/test/gtest_shuffle_test_.cc +103 -0
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/test/gtest_sole_header_test.cc +57 -0
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/test/gtest_stress_test.cc +256 -0
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/test/gtest_test_utils.py +320 -0
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/test/gtest_throw_on_failure_ex_test.cc +92 -0
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/test/gtest_throw_on_failure_test.py +171 -0
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/test/gtest_throw_on_failure_test_.cc +72 -0
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/test/gtest_uninitialized_test.py +70 -0
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/test/gtest_uninitialized_test_.cc +43 -0
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/test/gtest_unittest.cc +7706 -0
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/test/gtest_xml_outfile1_test_.cc +49 -0
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/test/gtest_xml_outfile2_test_.cc +49 -0
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/test/gtest_xml_outfiles_test.py +132 -0
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/test/gtest_xml_output_unittest.py +308 -0
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/test/gtest_xml_output_unittest_.cc +181 -0
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/test/gtest_xml_test_utils.py +194 -0
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/test/production.cc +36 -0
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/test/production.h +55 -0
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/xcode/Config/DebugProject.xcconfig +30 -0
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/xcode/Config/FrameworkTarget.xcconfig +17 -0
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/xcode/Config/General.xcconfig +41 -0
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/xcode/Config/ReleaseProject.xcconfig +32 -0
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/xcode/Config/StaticLibraryTarget.xcconfig +18 -0
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/xcode/Config/TestTarget.xcconfig +8 -0
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/xcode/Resources/Info.plist +30 -0
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/xcode/Samples/FrameworkSample/Info.plist +28 -0
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/xcode/Samples/FrameworkSample/WidgetFramework.xcodeproj/project.pbxproj +457 -0
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/xcode/Samples/FrameworkSample/runtests.sh +62 -0
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/xcode/Samples/FrameworkSample/widget.cc +63 -0
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/xcode/Samples/FrameworkSample/widget.h +59 -0
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/xcode/Samples/FrameworkSample/widget_test.cc +68 -0
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/xcode/Scripts/runtests.sh +65 -0
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/xcode/Scripts/versiongenerate.py +100 -0
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/xcode/gtest.xcodeproj/project.pbxproj +1135 -0
- data/ext/rj_schema/rapidjson/thirdparty/gtest/travis.sh +15 -0
- data/ext/rj_schema/rj_schema.cpp +64 -41
- data/lib/rj_schema.rb +1 -1
- metadata +378 -5
@@ -0,0 +1,103 @@
|
|
1
|
+
// Copyright 2009, Google Inc.
|
2
|
+
// All rights reserved.
|
3
|
+
//
|
4
|
+
// Redistribution and use in source and binary forms, with or without
|
5
|
+
// modification, are permitted provided that the following conditions are
|
6
|
+
// met:
|
7
|
+
//
|
8
|
+
// * Redistributions of source code must retain the above copyright
|
9
|
+
// notice, this list of conditions and the following disclaimer.
|
10
|
+
// * Redistributions in binary form must reproduce the above
|
11
|
+
// copyright notice, this list of conditions and the following disclaimer
|
12
|
+
// in the documentation and/or other materials provided with the
|
13
|
+
// distribution.
|
14
|
+
// * Neither the name of Google Inc. nor the names of its
|
15
|
+
// contributors may be used to endorse or promote products derived from
|
16
|
+
// this software without specific prior written permission.
|
17
|
+
//
|
18
|
+
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
19
|
+
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
20
|
+
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
21
|
+
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
22
|
+
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
23
|
+
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
24
|
+
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
25
|
+
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
26
|
+
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
27
|
+
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
28
|
+
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
29
|
+
//
|
30
|
+
// Author: wan@google.com (Zhanyong Wan)
|
31
|
+
|
32
|
+
// Verifies that test shuffling works.
|
33
|
+
|
34
|
+
#include "gtest/gtest.h"
|
35
|
+
|
36
|
+
namespace {
|
37
|
+
|
38
|
+
using ::testing::EmptyTestEventListener;
|
39
|
+
using ::testing::InitGoogleTest;
|
40
|
+
using ::testing::Message;
|
41
|
+
using ::testing::Test;
|
42
|
+
using ::testing::TestEventListeners;
|
43
|
+
using ::testing::TestInfo;
|
44
|
+
using ::testing::UnitTest;
|
45
|
+
using ::testing::internal::scoped_ptr;
|
46
|
+
|
47
|
+
// The test methods are empty, as the sole purpose of this program is
|
48
|
+
// to print the test names before/after shuffling.
|
49
|
+
|
50
|
+
class A : public Test {};
|
51
|
+
TEST_F(A, A) {}
|
52
|
+
TEST_F(A, B) {}
|
53
|
+
|
54
|
+
TEST(ADeathTest, A) {}
|
55
|
+
TEST(ADeathTest, B) {}
|
56
|
+
TEST(ADeathTest, C) {}
|
57
|
+
|
58
|
+
TEST(B, A) {}
|
59
|
+
TEST(B, B) {}
|
60
|
+
TEST(B, C) {}
|
61
|
+
TEST(B, DISABLED_D) {}
|
62
|
+
TEST(B, DISABLED_E) {}
|
63
|
+
|
64
|
+
TEST(BDeathTest, A) {}
|
65
|
+
TEST(BDeathTest, B) {}
|
66
|
+
|
67
|
+
TEST(C, A) {}
|
68
|
+
TEST(C, B) {}
|
69
|
+
TEST(C, C) {}
|
70
|
+
TEST(C, DISABLED_D) {}
|
71
|
+
|
72
|
+
TEST(CDeathTest, A) {}
|
73
|
+
|
74
|
+
TEST(DISABLED_D, A) {}
|
75
|
+
TEST(DISABLED_D, DISABLED_B) {}
|
76
|
+
|
77
|
+
// This printer prints the full test names only, starting each test
|
78
|
+
// iteration with a "----" marker.
|
79
|
+
class TestNamePrinter : public EmptyTestEventListener {
|
80
|
+
public:
|
81
|
+
virtual void OnTestIterationStart(const UnitTest& /* unit_test */,
|
82
|
+
int /* iteration */) {
|
83
|
+
printf("----\n");
|
84
|
+
}
|
85
|
+
|
86
|
+
virtual void OnTestStart(const TestInfo& test_info) {
|
87
|
+
printf("%s.%s\n", test_info.test_case_name(), test_info.name());
|
88
|
+
}
|
89
|
+
};
|
90
|
+
|
91
|
+
} // namespace
|
92
|
+
|
93
|
+
int main(int argc, char **argv) {
|
94
|
+
InitGoogleTest(&argc, argv);
|
95
|
+
|
96
|
+
// Replaces the default printer with TestNamePrinter, which prints
|
97
|
+
// the test name only.
|
98
|
+
TestEventListeners& listeners = UnitTest::GetInstance()->listeners();
|
99
|
+
delete listeners.Release(listeners.default_result_printer());
|
100
|
+
listeners.Append(new TestNamePrinter);
|
101
|
+
|
102
|
+
return RUN_ALL_TESTS();
|
103
|
+
}
|
@@ -0,0 +1,57 @@
|
|
1
|
+
// Copyright 2008, Google Inc.
|
2
|
+
// All rights reserved.
|
3
|
+
//
|
4
|
+
// Redistribution and use in source and binary forms, with or without
|
5
|
+
// modification, are permitted provided that the following conditions are
|
6
|
+
// met:
|
7
|
+
//
|
8
|
+
// * Redistributions of source code must retain the above copyright
|
9
|
+
// notice, this list of conditions and the following disclaimer.
|
10
|
+
// * Redistributions in binary form must reproduce the above
|
11
|
+
// copyright notice, this list of conditions and the following disclaimer
|
12
|
+
// in the documentation and/or other materials provided with the
|
13
|
+
// distribution.
|
14
|
+
// * Neither the name of Google Inc. nor the names of its
|
15
|
+
// contributors may be used to endorse or promote products derived from
|
16
|
+
// this software without specific prior written permission.
|
17
|
+
//
|
18
|
+
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
19
|
+
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
20
|
+
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
21
|
+
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
22
|
+
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
23
|
+
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
24
|
+
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
25
|
+
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
26
|
+
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
27
|
+
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
28
|
+
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
29
|
+
//
|
30
|
+
// Author: mheule@google.com (Markus Heule)
|
31
|
+
//
|
32
|
+
// This test verifies that it's possible to use Google Test by including
|
33
|
+
// the gtest.h header file alone.
|
34
|
+
|
35
|
+
#include "gtest/gtest.h"
|
36
|
+
|
37
|
+
namespace {
|
38
|
+
|
39
|
+
void Subroutine() {
|
40
|
+
EXPECT_EQ(42, 42);
|
41
|
+
}
|
42
|
+
|
43
|
+
TEST(NoFatalFailureTest, ExpectNoFatalFailure) {
|
44
|
+
EXPECT_NO_FATAL_FAILURE(;);
|
45
|
+
EXPECT_NO_FATAL_FAILURE(SUCCEED());
|
46
|
+
EXPECT_NO_FATAL_FAILURE(Subroutine());
|
47
|
+
EXPECT_NO_FATAL_FAILURE({ SUCCEED(); });
|
48
|
+
}
|
49
|
+
|
50
|
+
TEST(NoFatalFailureTest, AssertNoFatalFailure) {
|
51
|
+
ASSERT_NO_FATAL_FAILURE(;);
|
52
|
+
ASSERT_NO_FATAL_FAILURE(SUCCEED());
|
53
|
+
ASSERT_NO_FATAL_FAILURE(Subroutine());
|
54
|
+
ASSERT_NO_FATAL_FAILURE({ SUCCEED(); });
|
55
|
+
}
|
56
|
+
|
57
|
+
} // namespace
|
@@ -0,0 +1,256 @@
|
|
1
|
+
// Copyright 2007, Google Inc.
|
2
|
+
// All rights reserved.
|
3
|
+
//
|
4
|
+
// Redistribution and use in source and binary forms, with or without
|
5
|
+
// modification, are permitted provided that the following conditions are
|
6
|
+
// met:
|
7
|
+
//
|
8
|
+
// * Redistributions of source code must retain the above copyright
|
9
|
+
// notice, this list of conditions and the following disclaimer.
|
10
|
+
// * Redistributions in binary form must reproduce the above
|
11
|
+
// copyright notice, this list of conditions and the following disclaimer
|
12
|
+
// in the documentation and/or other materials provided with the
|
13
|
+
// distribution.
|
14
|
+
// * Neither the name of Google Inc. nor the names of its
|
15
|
+
// contributors may be used to endorse or promote products derived from
|
16
|
+
// this software without specific prior written permission.
|
17
|
+
//
|
18
|
+
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
19
|
+
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
20
|
+
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
21
|
+
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
22
|
+
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
23
|
+
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
24
|
+
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
25
|
+
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
26
|
+
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
27
|
+
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
28
|
+
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
29
|
+
//
|
30
|
+
// Author: wan@google.com (Zhanyong Wan)
|
31
|
+
|
32
|
+
// Tests that SCOPED_TRACE() and various Google Test assertions can be
|
33
|
+
// used in a large number of threads concurrently.
|
34
|
+
|
35
|
+
#include "gtest/gtest.h"
|
36
|
+
|
37
|
+
#include <iostream>
|
38
|
+
#include <vector>
|
39
|
+
|
40
|
+
// We must define this macro in order to #include
|
41
|
+
// gtest-internal-inl.h. This is how Google Test prevents a user from
|
42
|
+
// accidentally depending on its internal implementation.
|
43
|
+
#define GTEST_IMPLEMENTATION_ 1
|
44
|
+
#include "src/gtest-internal-inl.h"
|
45
|
+
#undef GTEST_IMPLEMENTATION_
|
46
|
+
|
47
|
+
#if GTEST_IS_THREADSAFE
|
48
|
+
|
49
|
+
namespace testing {
|
50
|
+
namespace {
|
51
|
+
|
52
|
+
using internal::Notification;
|
53
|
+
using internal::TestPropertyKeyIs;
|
54
|
+
using internal::ThreadWithParam;
|
55
|
+
using internal::scoped_ptr;
|
56
|
+
|
57
|
+
// In order to run tests in this file, for platforms where Google Test is
|
58
|
+
// thread safe, implement ThreadWithParam. See the description of its API
|
59
|
+
// in gtest-port.h, where it is defined for already supported platforms.
|
60
|
+
|
61
|
+
// How many threads to create?
|
62
|
+
const int kThreadCount = 50;
|
63
|
+
|
64
|
+
std::string IdToKey(int id, const char* suffix) {
|
65
|
+
Message key;
|
66
|
+
key << "key_" << id << "_" << suffix;
|
67
|
+
return key.GetString();
|
68
|
+
}
|
69
|
+
|
70
|
+
std::string IdToString(int id) {
|
71
|
+
Message id_message;
|
72
|
+
id_message << id;
|
73
|
+
return id_message.GetString();
|
74
|
+
}
|
75
|
+
|
76
|
+
void ExpectKeyAndValueWereRecordedForId(
|
77
|
+
const std::vector<TestProperty>& properties,
|
78
|
+
int id, const char* suffix) {
|
79
|
+
TestPropertyKeyIs matches_key(IdToKey(id, suffix).c_str());
|
80
|
+
const std::vector<TestProperty>::const_iterator property =
|
81
|
+
std::find_if(properties.begin(), properties.end(), matches_key);
|
82
|
+
ASSERT_TRUE(property != properties.end())
|
83
|
+
<< "expecting " << suffix << " value for id " << id;
|
84
|
+
EXPECT_STREQ(IdToString(id).c_str(), property->value());
|
85
|
+
}
|
86
|
+
|
87
|
+
// Calls a large number of Google Test assertions, where exactly one of them
|
88
|
+
// will fail.
|
89
|
+
void ManyAsserts(int id) {
|
90
|
+
GTEST_LOG_(INFO) << "Thread #" << id << " running...";
|
91
|
+
|
92
|
+
SCOPED_TRACE(Message() << "Thread #" << id);
|
93
|
+
|
94
|
+
for (int i = 0; i < kThreadCount; i++) {
|
95
|
+
SCOPED_TRACE(Message() << "Iteration #" << i);
|
96
|
+
|
97
|
+
// A bunch of assertions that should succeed.
|
98
|
+
EXPECT_TRUE(true);
|
99
|
+
ASSERT_FALSE(false) << "This shouldn't fail.";
|
100
|
+
EXPECT_STREQ("a", "a");
|
101
|
+
ASSERT_LE(5, 6);
|
102
|
+
EXPECT_EQ(i, i) << "This shouldn't fail.";
|
103
|
+
|
104
|
+
// RecordProperty() should interact safely with other threads as well.
|
105
|
+
// The shared_key forces property updates.
|
106
|
+
Test::RecordProperty(IdToKey(id, "string").c_str(), IdToString(id).c_str());
|
107
|
+
Test::RecordProperty(IdToKey(id, "int").c_str(), id);
|
108
|
+
Test::RecordProperty("shared_key", IdToString(id).c_str());
|
109
|
+
|
110
|
+
// This assertion should fail kThreadCount times per thread. It
|
111
|
+
// is for testing whether Google Test can handle failed assertions in a
|
112
|
+
// multi-threaded context.
|
113
|
+
EXPECT_LT(i, 0) << "This should always fail.";
|
114
|
+
}
|
115
|
+
}
|
116
|
+
|
117
|
+
void CheckTestFailureCount(int expected_failures) {
|
118
|
+
const TestInfo* const info = UnitTest::GetInstance()->current_test_info();
|
119
|
+
const TestResult* const result = info->result();
|
120
|
+
GTEST_CHECK_(expected_failures == result->total_part_count())
|
121
|
+
<< "Logged " << result->total_part_count() << " failures "
|
122
|
+
<< " vs. " << expected_failures << " expected";
|
123
|
+
}
|
124
|
+
|
125
|
+
// Tests using SCOPED_TRACE() and Google Test assertions in many threads
|
126
|
+
// concurrently.
|
127
|
+
TEST(StressTest, CanUseScopedTraceAndAssertionsInManyThreads) {
|
128
|
+
{
|
129
|
+
scoped_ptr<ThreadWithParam<int> > threads[kThreadCount];
|
130
|
+
Notification threads_can_start;
|
131
|
+
for (int i = 0; i != kThreadCount; i++)
|
132
|
+
threads[i].reset(new ThreadWithParam<int>(&ManyAsserts,
|
133
|
+
i,
|
134
|
+
&threads_can_start));
|
135
|
+
|
136
|
+
threads_can_start.Notify();
|
137
|
+
|
138
|
+
// Blocks until all the threads are done.
|
139
|
+
for (int i = 0; i != kThreadCount; i++)
|
140
|
+
threads[i]->Join();
|
141
|
+
}
|
142
|
+
|
143
|
+
// Ensures that kThreadCount*kThreadCount failures have been reported.
|
144
|
+
const TestInfo* const info = UnitTest::GetInstance()->current_test_info();
|
145
|
+
const TestResult* const result = info->result();
|
146
|
+
|
147
|
+
std::vector<TestProperty> properties;
|
148
|
+
// We have no access to the TestResult's list of properties but we can
|
149
|
+
// copy them one by one.
|
150
|
+
for (int i = 0; i < result->test_property_count(); ++i)
|
151
|
+
properties.push_back(result->GetTestProperty(i));
|
152
|
+
|
153
|
+
EXPECT_EQ(kThreadCount * 2 + 1, result->test_property_count())
|
154
|
+
<< "String and int values recorded on each thread, "
|
155
|
+
<< "as well as one shared_key";
|
156
|
+
for (int i = 0; i < kThreadCount; ++i) {
|
157
|
+
ExpectKeyAndValueWereRecordedForId(properties, i, "string");
|
158
|
+
ExpectKeyAndValueWereRecordedForId(properties, i, "int");
|
159
|
+
}
|
160
|
+
CheckTestFailureCount(kThreadCount*kThreadCount);
|
161
|
+
}
|
162
|
+
|
163
|
+
void FailingThread(bool is_fatal) {
|
164
|
+
if (is_fatal)
|
165
|
+
FAIL() << "Fatal failure in some other thread. "
|
166
|
+
<< "(This failure is expected.)";
|
167
|
+
else
|
168
|
+
ADD_FAILURE() << "Non-fatal failure in some other thread. "
|
169
|
+
<< "(This failure is expected.)";
|
170
|
+
}
|
171
|
+
|
172
|
+
void GenerateFatalFailureInAnotherThread(bool is_fatal) {
|
173
|
+
ThreadWithParam<bool> thread(&FailingThread, is_fatal, NULL);
|
174
|
+
thread.Join();
|
175
|
+
}
|
176
|
+
|
177
|
+
TEST(NoFatalFailureTest, ExpectNoFatalFailureIgnoresFailuresInOtherThreads) {
|
178
|
+
EXPECT_NO_FATAL_FAILURE(GenerateFatalFailureInAnotherThread(true));
|
179
|
+
// We should only have one failure (the one from
|
180
|
+
// GenerateFatalFailureInAnotherThread()), since the EXPECT_NO_FATAL_FAILURE
|
181
|
+
// should succeed.
|
182
|
+
CheckTestFailureCount(1);
|
183
|
+
}
|
184
|
+
|
185
|
+
void AssertNoFatalFailureIgnoresFailuresInOtherThreads() {
|
186
|
+
ASSERT_NO_FATAL_FAILURE(GenerateFatalFailureInAnotherThread(true));
|
187
|
+
}
|
188
|
+
TEST(NoFatalFailureTest, AssertNoFatalFailureIgnoresFailuresInOtherThreads) {
|
189
|
+
// Using a subroutine, to make sure, that the test continues.
|
190
|
+
AssertNoFatalFailureIgnoresFailuresInOtherThreads();
|
191
|
+
// We should only have one failure (the one from
|
192
|
+
// GenerateFatalFailureInAnotherThread()), since the EXPECT_NO_FATAL_FAILURE
|
193
|
+
// should succeed.
|
194
|
+
CheckTestFailureCount(1);
|
195
|
+
}
|
196
|
+
|
197
|
+
TEST(FatalFailureTest, ExpectFatalFailureIgnoresFailuresInOtherThreads) {
|
198
|
+
// This statement should fail, since the current thread doesn't generate a
|
199
|
+
// fatal failure, only another one does.
|
200
|
+
EXPECT_FATAL_FAILURE(GenerateFatalFailureInAnotherThread(true), "expected");
|
201
|
+
CheckTestFailureCount(2);
|
202
|
+
}
|
203
|
+
|
204
|
+
TEST(FatalFailureOnAllThreadsTest, ExpectFatalFailureOnAllThreads) {
|
205
|
+
// This statement should succeed, because failures in all threads are
|
206
|
+
// considered.
|
207
|
+
EXPECT_FATAL_FAILURE_ON_ALL_THREADS(
|
208
|
+
GenerateFatalFailureInAnotherThread(true), "expected");
|
209
|
+
CheckTestFailureCount(0);
|
210
|
+
// We need to add a failure, because main() checks that there are failures.
|
211
|
+
// But when only this test is run, we shouldn't have any failures.
|
212
|
+
ADD_FAILURE() << "This is an expected non-fatal failure.";
|
213
|
+
}
|
214
|
+
|
215
|
+
TEST(NonFatalFailureTest, ExpectNonFatalFailureIgnoresFailuresInOtherThreads) {
|
216
|
+
// This statement should fail, since the current thread doesn't generate a
|
217
|
+
// fatal failure, only another one does.
|
218
|
+
EXPECT_NONFATAL_FAILURE(GenerateFatalFailureInAnotherThread(false),
|
219
|
+
"expected");
|
220
|
+
CheckTestFailureCount(2);
|
221
|
+
}
|
222
|
+
|
223
|
+
TEST(NonFatalFailureOnAllThreadsTest, ExpectNonFatalFailureOnAllThreads) {
|
224
|
+
// This statement should succeed, because failures in all threads are
|
225
|
+
// considered.
|
226
|
+
EXPECT_NONFATAL_FAILURE_ON_ALL_THREADS(
|
227
|
+
GenerateFatalFailureInAnotherThread(false), "expected");
|
228
|
+
CheckTestFailureCount(0);
|
229
|
+
// We need to add a failure, because main() checks that there are failures,
|
230
|
+
// But when only this test is run, we shouldn't have any failures.
|
231
|
+
ADD_FAILURE() << "This is an expected non-fatal failure.";
|
232
|
+
}
|
233
|
+
|
234
|
+
} // namespace
|
235
|
+
} // namespace testing
|
236
|
+
|
237
|
+
int main(int argc, char **argv) {
|
238
|
+
testing::InitGoogleTest(&argc, argv);
|
239
|
+
|
240
|
+
const int result = RUN_ALL_TESTS(); // Expected to fail.
|
241
|
+
GTEST_CHECK_(result == 1) << "RUN_ALL_TESTS() did not fail as expected";
|
242
|
+
|
243
|
+
printf("\nPASS\n");
|
244
|
+
return 0;
|
245
|
+
}
|
246
|
+
|
247
|
+
#else
|
248
|
+
TEST(StressTest,
|
249
|
+
DISABLED_ThreadSafetyTestsAreSkippedWhenGoogleTestIsNotThreadSafe) {
|
250
|
+
}
|
251
|
+
|
252
|
+
int main(int argc, char **argv) {
|
253
|
+
testing::InitGoogleTest(&argc, argv);
|
254
|
+
return RUN_ALL_TESTS();
|
255
|
+
}
|
256
|
+
#endif // GTEST_IS_THREADSAFE
|
@@ -0,0 +1,320 @@
|
|
1
|
+
#!/usr/bin/env python
|
2
|
+
#
|
3
|
+
# Copyright 2006, Google Inc.
|
4
|
+
# All rights reserved.
|
5
|
+
#
|
6
|
+
# Redistribution and use in source and binary forms, with or without
|
7
|
+
# modification, are permitted provided that the following conditions are
|
8
|
+
# met:
|
9
|
+
#
|
10
|
+
# * Redistributions of source code must retain the above copyright
|
11
|
+
# notice, this list of conditions and the following disclaimer.
|
12
|
+
# * Redistributions in binary form must reproduce the above
|
13
|
+
# copyright notice, this list of conditions and the following disclaimer
|
14
|
+
# in the documentation and/or other materials provided with the
|
15
|
+
# distribution.
|
16
|
+
# * Neither the name of Google Inc. nor the names of its
|
17
|
+
# contributors may be used to endorse or promote products derived from
|
18
|
+
# this software without specific prior written permission.
|
19
|
+
#
|
20
|
+
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
21
|
+
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
22
|
+
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
23
|
+
# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
24
|
+
# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
25
|
+
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
26
|
+
# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
27
|
+
# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
28
|
+
# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
29
|
+
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
30
|
+
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
31
|
+
|
32
|
+
"""Unit test utilities for Google C++ Testing Framework."""
|
33
|
+
|
34
|
+
__author__ = 'wan@google.com (Zhanyong Wan)'
|
35
|
+
|
36
|
+
import atexit
|
37
|
+
import os
|
38
|
+
import shutil
|
39
|
+
import sys
|
40
|
+
import tempfile
|
41
|
+
import unittest
|
42
|
+
_test_module = unittest
|
43
|
+
|
44
|
+
# Suppresses the 'Import not at the top of the file' lint complaint.
|
45
|
+
# pylint: disable-msg=C6204
|
46
|
+
try:
|
47
|
+
import subprocess
|
48
|
+
_SUBPROCESS_MODULE_AVAILABLE = True
|
49
|
+
except:
|
50
|
+
import popen2
|
51
|
+
_SUBPROCESS_MODULE_AVAILABLE = False
|
52
|
+
# pylint: enable-msg=C6204
|
53
|
+
|
54
|
+
GTEST_OUTPUT_VAR_NAME = 'GTEST_OUTPUT'
|
55
|
+
|
56
|
+
IS_WINDOWS = os.name == 'nt'
|
57
|
+
IS_CYGWIN = os.name == 'posix' and 'CYGWIN' in os.uname()[0]
|
58
|
+
|
59
|
+
# The environment variable for specifying the path to the premature-exit file.
|
60
|
+
PREMATURE_EXIT_FILE_ENV_VAR = 'TEST_PREMATURE_EXIT_FILE'
|
61
|
+
|
62
|
+
environ = os.environ.copy()
|
63
|
+
|
64
|
+
|
65
|
+
def SetEnvVar(env_var, value):
|
66
|
+
"""Sets/unsets an environment variable to a given value."""
|
67
|
+
|
68
|
+
if value is not None:
|
69
|
+
environ[env_var] = value
|
70
|
+
elif env_var in environ:
|
71
|
+
del environ[env_var]
|
72
|
+
|
73
|
+
|
74
|
+
# Here we expose a class from a particular module, depending on the
|
75
|
+
# environment. The comment suppresses the 'Invalid variable name' lint
|
76
|
+
# complaint.
|
77
|
+
TestCase = _test_module.TestCase # pylint: disable-msg=C6409
|
78
|
+
|
79
|
+
# Initially maps a flag to its default value. After
|
80
|
+
# _ParseAndStripGTestFlags() is called, maps a flag to its actual value.
|
81
|
+
_flag_map = {'source_dir': os.path.dirname(sys.argv[0]),
|
82
|
+
'build_dir': os.path.dirname(sys.argv[0])}
|
83
|
+
_gtest_flags_are_parsed = False
|
84
|
+
|
85
|
+
|
86
|
+
def _ParseAndStripGTestFlags(argv):
|
87
|
+
"""Parses and strips Google Test flags from argv. This is idempotent."""
|
88
|
+
|
89
|
+
# Suppresses the lint complaint about a global variable since we need it
|
90
|
+
# here to maintain module-wide state.
|
91
|
+
global _gtest_flags_are_parsed # pylint: disable-msg=W0603
|
92
|
+
if _gtest_flags_are_parsed:
|
93
|
+
return
|
94
|
+
|
95
|
+
_gtest_flags_are_parsed = True
|
96
|
+
for flag in _flag_map:
|
97
|
+
# The environment variable overrides the default value.
|
98
|
+
if flag.upper() in os.environ:
|
99
|
+
_flag_map[flag] = os.environ[flag.upper()]
|
100
|
+
|
101
|
+
# The command line flag overrides the environment variable.
|
102
|
+
i = 1 # Skips the program name.
|
103
|
+
while i < len(argv):
|
104
|
+
prefix = '--' + flag + '='
|
105
|
+
if argv[i].startswith(prefix):
|
106
|
+
_flag_map[flag] = argv[i][len(prefix):]
|
107
|
+
del argv[i]
|
108
|
+
break
|
109
|
+
else:
|
110
|
+
# We don't increment i in case we just found a --gtest_* flag
|
111
|
+
# and removed it from argv.
|
112
|
+
i += 1
|
113
|
+
|
114
|
+
|
115
|
+
def GetFlag(flag):
|
116
|
+
"""Returns the value of the given flag."""
|
117
|
+
|
118
|
+
# In case GetFlag() is called before Main(), we always call
|
119
|
+
# _ParseAndStripGTestFlags() here to make sure the --gtest_* flags
|
120
|
+
# are parsed.
|
121
|
+
_ParseAndStripGTestFlags(sys.argv)
|
122
|
+
|
123
|
+
return _flag_map[flag]
|
124
|
+
|
125
|
+
|
126
|
+
def GetSourceDir():
|
127
|
+
"""Returns the absolute path of the directory where the .py files are."""
|
128
|
+
|
129
|
+
return os.path.abspath(GetFlag('source_dir'))
|
130
|
+
|
131
|
+
|
132
|
+
def GetBuildDir():
|
133
|
+
"""Returns the absolute path of the directory where the test binaries are."""
|
134
|
+
|
135
|
+
return os.path.abspath(GetFlag('build_dir'))
|
136
|
+
|
137
|
+
|
138
|
+
_temp_dir = None
|
139
|
+
|
140
|
+
def _RemoveTempDir():
|
141
|
+
if _temp_dir:
|
142
|
+
shutil.rmtree(_temp_dir, ignore_errors=True)
|
143
|
+
|
144
|
+
atexit.register(_RemoveTempDir)
|
145
|
+
|
146
|
+
|
147
|
+
def GetTempDir():
|
148
|
+
"""Returns a directory for temporary files."""
|
149
|
+
|
150
|
+
global _temp_dir
|
151
|
+
if not _temp_dir:
|
152
|
+
_temp_dir = tempfile.mkdtemp()
|
153
|
+
return _temp_dir
|
154
|
+
|
155
|
+
|
156
|
+
def GetTestExecutablePath(executable_name, build_dir=None):
|
157
|
+
"""Returns the absolute path of the test binary given its name.
|
158
|
+
|
159
|
+
The function will print a message and abort the program if the resulting file
|
160
|
+
doesn't exist.
|
161
|
+
|
162
|
+
Args:
|
163
|
+
executable_name: name of the test binary that the test script runs.
|
164
|
+
build_dir: directory where to look for executables, by default
|
165
|
+
the result of GetBuildDir().
|
166
|
+
|
167
|
+
Returns:
|
168
|
+
The absolute path of the test binary.
|
169
|
+
"""
|
170
|
+
|
171
|
+
path = os.path.abspath(os.path.join(build_dir or GetBuildDir(),
|
172
|
+
executable_name))
|
173
|
+
if (IS_WINDOWS or IS_CYGWIN) and not path.endswith('.exe'):
|
174
|
+
path += '.exe'
|
175
|
+
|
176
|
+
if not os.path.exists(path):
|
177
|
+
message = (
|
178
|
+
'Unable to find the test binary "%s". Please make sure to provide\n'
|
179
|
+
'a path to the binary via the --build_dir flag or the BUILD_DIR\n'
|
180
|
+
'environment variable.' % path)
|
181
|
+
sys.stdout.write(message)
|
182
|
+
sys.exit(1)
|
183
|
+
|
184
|
+
return path
|
185
|
+
|
186
|
+
|
187
|
+
def GetExitStatus(exit_code):
|
188
|
+
"""Returns the argument to exit(), or -1 if exit() wasn't called.
|
189
|
+
|
190
|
+
Args:
|
191
|
+
exit_code: the result value of os.system(command).
|
192
|
+
"""
|
193
|
+
|
194
|
+
if os.name == 'nt':
|
195
|
+
# On Windows, os.WEXITSTATUS() doesn't work and os.system() returns
|
196
|
+
# the argument to exit() directly.
|
197
|
+
return exit_code
|
198
|
+
else:
|
199
|
+
# On Unix, os.WEXITSTATUS() must be used to extract the exit status
|
200
|
+
# from the result of os.system().
|
201
|
+
if os.WIFEXITED(exit_code):
|
202
|
+
return os.WEXITSTATUS(exit_code)
|
203
|
+
else:
|
204
|
+
return -1
|
205
|
+
|
206
|
+
|
207
|
+
class Subprocess:
|
208
|
+
def __init__(self, command, working_dir=None, capture_stderr=True, env=None):
|
209
|
+
"""Changes into a specified directory, if provided, and executes a command.
|
210
|
+
|
211
|
+
Restores the old directory afterwards.
|
212
|
+
|
213
|
+
Args:
|
214
|
+
command: The command to run, in the form of sys.argv.
|
215
|
+
working_dir: The directory to change into.
|
216
|
+
capture_stderr: Determines whether to capture stderr in the output member
|
217
|
+
or to discard it.
|
218
|
+
env: Dictionary with environment to pass to the subprocess.
|
219
|
+
|
220
|
+
Returns:
|
221
|
+
An object that represents outcome of the executed process. It has the
|
222
|
+
following attributes:
|
223
|
+
terminated_by_signal True iff the child process has been terminated
|
224
|
+
by a signal.
|
225
|
+
signal Sygnal that terminated the child process.
|
226
|
+
exited True iff the child process exited normally.
|
227
|
+
exit_code The code with which the child process exited.
|
228
|
+
output Child process's stdout and stderr output
|
229
|
+
combined in a string.
|
230
|
+
"""
|
231
|
+
|
232
|
+
# The subprocess module is the preferrable way of running programs
|
233
|
+
# since it is available and behaves consistently on all platforms,
|
234
|
+
# including Windows. But it is only available starting in python 2.4.
|
235
|
+
# In earlier python versions, we revert to the popen2 module, which is
|
236
|
+
# available in python 2.0 and later but doesn't provide required
|
237
|
+
# functionality (Popen4) under Windows. This allows us to support Mac
|
238
|
+
# OS X 10.4 Tiger, which has python 2.3 installed.
|
239
|
+
if _SUBPROCESS_MODULE_AVAILABLE:
|
240
|
+
if capture_stderr:
|
241
|
+
stderr = subprocess.STDOUT
|
242
|
+
else:
|
243
|
+
stderr = subprocess.PIPE
|
244
|
+
|
245
|
+
p = subprocess.Popen(command,
|
246
|
+
stdout=subprocess.PIPE, stderr=stderr,
|
247
|
+
cwd=working_dir, universal_newlines=True, env=env)
|
248
|
+
# communicate returns a tuple with the file obect for the child's
|
249
|
+
# output.
|
250
|
+
self.output = p.communicate()[0]
|
251
|
+
self._return_code = p.returncode
|
252
|
+
else:
|
253
|
+
old_dir = os.getcwd()
|
254
|
+
|
255
|
+
def _ReplaceEnvDict(dest, src):
|
256
|
+
# Changes made by os.environ.clear are not inheritable by child
|
257
|
+
# processes until Python 2.6. To produce inheritable changes we have
|
258
|
+
# to delete environment items with the del statement.
|
259
|
+
for key in dest.keys():
|
260
|
+
del dest[key]
|
261
|
+
dest.update(src)
|
262
|
+
|
263
|
+
# When 'env' is not None, backup the environment variables and replace
|
264
|
+
# them with the passed 'env'. When 'env' is None, we simply use the
|
265
|
+
# current 'os.environ' for compatibility with the subprocess.Popen
|
266
|
+
# semantics used above.
|
267
|
+
if env is not None:
|
268
|
+
old_environ = os.environ.copy()
|
269
|
+
_ReplaceEnvDict(os.environ, env)
|
270
|
+
|
271
|
+
try:
|
272
|
+
if working_dir is not None:
|
273
|
+
os.chdir(working_dir)
|
274
|
+
if capture_stderr:
|
275
|
+
p = popen2.Popen4(command)
|
276
|
+
else:
|
277
|
+
p = popen2.Popen3(command)
|
278
|
+
p.tochild.close()
|
279
|
+
self.output = p.fromchild.read()
|
280
|
+
ret_code = p.wait()
|
281
|
+
finally:
|
282
|
+
os.chdir(old_dir)
|
283
|
+
|
284
|
+
# Restore the old environment variables
|
285
|
+
# if they were replaced.
|
286
|
+
if env is not None:
|
287
|
+
_ReplaceEnvDict(os.environ, old_environ)
|
288
|
+
|
289
|
+
# Converts ret_code to match the semantics of
|
290
|
+
# subprocess.Popen.returncode.
|
291
|
+
if os.WIFSIGNALED(ret_code):
|
292
|
+
self._return_code = -os.WTERMSIG(ret_code)
|
293
|
+
else: # os.WIFEXITED(ret_code) should return True here.
|
294
|
+
self._return_code = os.WEXITSTATUS(ret_code)
|
295
|
+
|
296
|
+
if self._return_code < 0:
|
297
|
+
self.terminated_by_signal = True
|
298
|
+
self.exited = False
|
299
|
+
self.signal = -self._return_code
|
300
|
+
else:
|
301
|
+
self.terminated_by_signal = False
|
302
|
+
self.exited = True
|
303
|
+
self.exit_code = self._return_code
|
304
|
+
|
305
|
+
|
306
|
+
def Main():
|
307
|
+
"""Runs the unit test."""
|
308
|
+
|
309
|
+
# We must call _ParseAndStripGTestFlags() before calling
|
310
|
+
# unittest.main(). Otherwise the latter will be confused by the
|
311
|
+
# --gtest_* flags.
|
312
|
+
_ParseAndStripGTestFlags(sys.argv)
|
313
|
+
# The tested binaries should not be writing XML output files unless the
|
314
|
+
# script explicitly instructs them to.
|
315
|
+
# TODO(vladl@google.com): Move this into Subprocess when we implement
|
316
|
+
# passing environment into it as a parameter.
|
317
|
+
if GTEST_OUTPUT_VAR_NAME in os.environ:
|
318
|
+
del os.environ[GTEST_OUTPUT_VAR_NAME]
|
319
|
+
|
320
|
+
_test_module.main()
|