Skip to content

Commit 7f008b9

Browse files
authored
Add a simple test based googletest (#18634)
We received a bug report where the repro case was a googletest test so is seem like it would be good idea to have an easy way to run googletest test. We may want to consider using this framework within some of our existing test too?
1 parent 2188869 commit 7f008b9

File tree

6 files changed

+25
-0
lines changed

6 files changed

+25
-0
lines changed

.circleci/config.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -695,6 +695,9 @@ jobs:
695695
- attach_workspace:
696696
at: ~/
697697
- checkout
698+
- run:
699+
name: submodule update
700+
command: git submodule update --init
698701
- run:
699702
name: Remove Linux binaries
700703
command: |

.gitmodules

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
11
[submodule "test/third_party/posixtestsuite"]
22
path = test/third_party/posixtestsuite
33
url = https://github.com/emscripten-core/posixtestsuite
4+
[submodule "test/third_party/googletest"]
5+
path = test/third_party/googletest
6+
url = git@github.com:google/googletest.git

test/other/test_googletest.cc

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
#include "gtest/gtest.h"
2+
3+
TEST(MySuite, MyTest) {
4+
ASSERT_EQ(2 + 2, 4);
5+
}

test/other/test_googletest.out

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
[ PASSED ] 1 test.

test/test_other.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12934,3 +12934,15 @@ def test_standalone_settings(self):
1293412934

1293512935
err = self.expect_fail(base_cmd + ['-sMEMORY_GROWTH_LINEAR_STEP=1mb'])
1293612936
self.assertContained('error: MEMORY_GROWTH_LINEAR_STEP is not compatible with STANDALONE_WASM', err)
12937+
12938+
@is_slow_test
12939+
def test_googletest(self):
12940+
# TODO(sbc): Should we package gtest as an emscripten "port"? I guess we should if
12941+
# we plan on using it in more places.
12942+
self.emcc_args += [
12943+
'-I' + test_file('third_party/googletest/googletest'),
12944+
'-I' + test_file('third_party/googletest/googletest/include'),
12945+
test_file('third_party/googletest/googletest/src/gtest-all.cc'),
12946+
test_file('third_party/googletest/googletest/src/gtest_main.cc'),
12947+
]
12948+
self.do_other_test('test_googletest.cc')

test/third_party/googletest

Submodule googletest added at 4fb7039

0 commit comments

Comments
 (0)