Unverified Commit 130e5aa8 authored by Chris Johnson's avatar Chris Johnson Committed by GitHub
Browse files

Merge pull request #2 from google/master

merge upstream/master into master
parents fe14e303 b5f5c596
......@@ -3761,6 +3761,7 @@ void XmlUnitTestResultPrinter::OutputXmlTestInfo(::std::ostream* stream,
}
OutputXmlAttribute(stream, kTestcase, "status",
result.Skipped() ? "skipped" :
test_info.should_run() ? "run" : "notrun");
OutputXmlAttribute(stream, kTestcase, "time",
FormatTimeInMillisAsSeconds(result.elapsed_time()));
......@@ -4126,6 +4127,7 @@ void JsonUnitTestResultPrinter::OutputJsonTestInfo(::std::ostream* stream,
}
OutputJsonKey(stream, kTestcase, "status",
result.Skipped() ? "SKIPPED" :
test_info.should_run() ? "RUN" : "NOTRUN", kIndent);
OutputJsonKey(stream, kTestcase, "time",
FormatTimeInMillisAsDuration(result.elapsed_time()), kIndent);
......@@ -5363,7 +5365,7 @@ bool ShouldRunTestOnShard(int total_shards, int shard_index, int test_id) {
// each TestCase and TestInfo object.
// If shard_tests == true, further filters tests based on sharding
// variables in the environment - see
// https://github.com/abseil/googletest/blob/master/googletest/docs/advanced.md
// https://github.com/google/googletest/blob/master/googletest/docs/advanced.md
// . Returns the number of tests that should run.
int UnitTestImpl::FilterTests(ReactionToSharding shard_tests) {
const Int32 total_shards = shard_tests == HONOR_SHARDING_PROTOCOL ?
......
......@@ -30,8 +30,24 @@
#include <stdio.h>
#include "gtest/gtest.h"
#ifdef ARDUINO
void setup() {
// Since Arduino doesn't have a command line, fake out the argc/argv arguments
int argc = 1;
const auto arg0 = "PlatformIO";
char* argv0 = const_cast<char*>(arg0);
char** argv = &argv0;
testing::InitGoogleTest(&argc, argv);
}
void loop() { RUN_ALL_TESTS(); }
#else
GTEST_API_ int main(int argc, char **argv) {
printf("Running main() from %s\n", __FILE__);
testing::InitGoogleTest(&argc, argv);
return RUN_ALL_TESTS();
}
#endif
......@@ -57,7 +57,7 @@ else:
STACK_TRACE_TEMPLATE = ''
EXPECTED_NON_EMPTY = {
u'tests': 23,
u'tests': 24,
u'failures': 4,
u'disabled': 2,
u'errors': 0,
......@@ -123,6 +123,22 @@ EXPECTED_NON_EMPTY = {
}
]
},
{
u'name': u'SkippedTest',
u'tests': 1,
u'failures': 0,
u'disabled': 0,
u'errors': 0,
u'time': u'*',
u'testsuite': [
{
u'name': u'Skipped',
u'status': u'SKIPPED',
u'time': u'*',
u'classname': u'SkippedTest'
}
]
},
{
u'name': u'MixedResultTest',
u'tests': 3,
......
......@@ -65,7 +65,7 @@ else:
sys.argv.remove(NO_STACKTRACE_SUPPORT_FLAG)
EXPECTED_NON_EMPTY_XML = """<?xml version="1.0" encoding="UTF-8"?>
<testsuites tests="23" failures="4" disabled="2" errors="0" time="*" timestamp="*" name="AllTests" ad_hoc_property="42">
<testsuites tests="24" failures="4" disabled="2" errors="0" time="*" timestamp="*" name="AllTests" ad_hoc_property="42">
<testsuite name="SuccessfulTest" tests="1" failures="0" disabled="0" errors="0" time="*">
<testcase name="Succeeds" status="run" time="*" classname="SuccessfulTest"/>
</testsuite>
......@@ -108,6 +108,9 @@ Invalid characters in brackets []%(stack)s]]></failure>
<testsuite name="DisabledTest" tests="1" failures="0" disabled="1" errors="0" time="*">
<testcase name="DISABLED_test_not_run" status="notrun" time="*" classname="DisabledTest"/>
</testsuite>
<testsuite name="SkippedTest" tests="1" failures="0" disabled="0" errors="0" time="*">
<testcase name="Skipped" status="skipped" time="*" classname="SkippedTest"/>
</testsuite>
<testsuite name="PropertyRecordingTest" tests="4" failures="0" disabled="0" errors="0" time="*" SetUpTestCase="yes" TearDownTestCase="aye">
<testcase name="OneProperty" status="run" time="*" classname="PropertyRecordingTest">
<properties>
......@@ -183,15 +186,15 @@ EXPECTED_SHARDED_TEST_XML = """<?xml version="1.0" encoding="UTF-8"?>
<testsuite name="SuccessfulTest" tests="1" failures="0" disabled="0" errors="0" time="*">
<testcase name="Succeeds" status="run" time="*" classname="SuccessfulTest"/>
</testsuite>
<testsuite name="NoFixtureTest" tests="1" failures="0" disabled="0" errors="0" time="*">
<testcase name="RecordProperty" status="run" time="*" classname="NoFixtureTest">
<testsuite name="PropertyRecordingTest" tests="1" failures="0" disabled="0" errors="0" time="*" SetUpTestCase="yes" TearDownTestCase="aye">
<testcase name="TwoValuesForOneKeyUsesLastValue" status="run" time="*" classname="PropertyRecordingTest">
<properties>
<property name="key" value="1"/>
<property name="key_1" value="2"/>
</properties>
</testcase>
</testsuite>
<testsuite name="Single/ValueParamTest" tests="1" failures="0" disabled="0" errors="0" time="*">
<testcase name="AnotherTestThatHasValueParamAttribute/1" value_param="42" status="run" time="*" classname="Single/ValueParamTest" />
<testcase name="AnotherTestThatHasValueParamAttribute/0" value_param="33" status="run" time="*" classname="Single/ValueParamTest" />
</testsuite>
</testsuites>"""
......
......@@ -67,6 +67,13 @@ TEST_F(DisabledTest, DISABLED_test_not_run) {
FAIL() << "Unexpected failure: Disabled test should not be run";
}
class SkippedTest : public Test {
};
TEST_F(SkippedTest, Skipped) {
GTEST_SKIP();
}
TEST(MixedResultTest, Succeeds) {
EXPECT_EQ(1, 1);
ASSERT_EQ(1, 1);
......
{
"name": "googletest",
"keywords": "unittest, unit, test, gtest, gmock",
"description": "googletest is a testing framework developed by the Testing Technology team with Google's specific requirements and constraints in mind. No matter whether you work on Linux, Windows, or a Mac, if you write C++ code, googletest can help you. And it supports any kind of tests, not just unit tests.",
"license": "BSD-3-Clause",
"homepage": "https://github.com/abseil/googletest/blob/master/README.md",
"repository": {
"type": "git",
"url": "https://github.com/abseil/googletest.git"
},
"version": "1.8.1",
"exclude": [
"ci",
"googlemock/build-aux",
"googlemock/cmake",
"googlemock/make",
"googlemock/msvc",
"googlemock/scripts",
"googlemock/test",
"googlemock/CMakeLists.txt",
"googlemock/Makefile.am",
"googlemock/configure.ac",
"googletest/cmake",
"googletest/codegear",
"googletest/m4",
"googletest/make",
"googletest/msvc",
"googletest/scripts",
"googletest/test",
"googletest/xcode",
"googletest/CMakeLists.txt",
"googletest/Makefile.am",
"googletest/configure.ac",
],
"frameworks": "arduino",
"platforms": [
"espressif32"
],
"export": {
"include": [
"googlemock/include/*",
"googletest/include/*"
]
},
"build": {
"flags": [
"-I googlemock/include",
"-I googletest/include"
]
}
}
; PlatformIO Project Configuration File
;
; Build options: build flags, source filter
; Upload options: custom upload port, speed and extra flags
; Library options: dependencies, extra library storages
; Advanced options: extra scripting
;
; Please visit documentation for the other options and examples
; http://docs.platformio.org/page/projectconf.html
[platformio]
#src_dir = ./googlemock
#src_dir = ./googletest
src_dir = .
[env:googletest_esp32]
platform = espressif32
board = esp32dev
framework = arduino
build_flags = -I./googletest/include -I./googletest
src_filter = +<*> -<.git/> -<googlemock> -<googletest/codegear/> -<googletest/samples> -<googletest/test/> -<googletest/xcode> -<googletest/src> +<googletest/src/gtest-all.cc> +<googletest/src/gtest_main.cc>
upload_speed = 921600
[env:googlemock_esp32]
platform = espressif32
board = esp32dev
framework = arduino
build_flags = -I./googlemock/include -I./googletest/include -I./googletest -I./googlemock
src_filter = +<*> -<.git/> -<googletest> -<googlemock/test/> -<googlemock/src> +<googlemock/src/gmock-all.cc> +<googlemock/src/gmock_main.cc> +<googletest/src/gtest-all.cc>
upload_speed = 921600
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment