Skip to content

Commit

Permalink
test: add _cpp suffix to the C++ test data.
Browse files Browse the repository at this point in the history
Signed-off-by: Piotr Sikora <piotrsikora@google.com>
  • Loading branch information
PiotrSikora authored Mar 14, 2019
1 parent 6d0ba26 commit 098f146
Show file tree
Hide file tree
Showing 27 changed files with 26 additions and 26 deletions.
6 changes: 3 additions & 3 deletions test/extensions/filters/http/wasm/config_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ TEST_F(WasmFilterConfigTest, JsonLoadFromFileWASM) {
"vm_config": {
"vm": "envoy.wasm.vm.wavm",
"code": {
"filename": "{{ test_rundir }}/test/extensions/filters/http/wasm/test_data/headers.wasm"
"filename": "{{ test_rundir }}/test/extensions/filters/http/wasm/test_data/headers_cpp.wasm"
},
"allow_precompiled": true
}}
Expand All @@ -58,7 +58,7 @@ TEST_F(WasmFilterConfigTest, YamlLoadFromFileWASM) {
const std::string yaml = TestEnvironment::substitute(R"EOF(
vm_config:
vm: "envoy.wasm.vm.wavm"
code: { filename: "{{ test_rundir }}/test/extensions/filters/http/wasm/test_data/headers.wasm" }
code: { filename: "{{ test_rundir }}/test/extensions/filters/http/wasm/test_data/headers_cpp.wasm" }
)EOF");

envoy::config::filter::http::wasm::v2::Wasm proto_config;
Expand All @@ -73,7 +73,7 @@ TEST_F(WasmFilterConfigTest, YamlLoadFromFileWASM) {

TEST_F(WasmFilterConfigTest, YamlLoadInlineWASM) {
const std::string code = TestEnvironment::readFileToStringForTest(TestEnvironment::substitute(
"{{ test_rundir }}/test/extensions/filters/http/wasm/test_data/headers.wasm"));
"{{ test_rundir }}/test/extensions/filters/http/wasm/test_data/headers_cpp.wasm"));
EXPECT_FALSE(code.empty());
const std::string yaml =
absl::StrCat("vm_config:\n vm: \"envoy.wasm.vm.wavm\"\n", " code: { inline_bytes: \"",
Expand Down
2 changes: 1 addition & 1 deletion test/extensions/filters/http/wasm/test_data/Makefile
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
all: headers.wasm async_call.wasm
all: headers_cpp.wasm async_call_cpp.wasm

include ../../../../../../api/wasm/cpp/Makefile.base
8 changes: 4 additions & 4 deletions test/extensions/filters/http/wasm/wasm_filter_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ TEST_F(WasmHttpFilterTest, BadCode) {
// Script touching headers only, request that is headers only.
TEST_F(WasmHttpFilterTest, HeadersOnlyRequestHeadersOnly) {
setupConfig(TestEnvironment::readFileToStringForTest(TestEnvironment::substitute(
"{{ test_rundir }}/test/extensions/filters/http/wasm/test_data/headers.wasm")));
"{{ test_rundir }}/test/extensions/filters/http/wasm/test_data/headers_cpp.wasm")));
setupFilter();
EXPECT_CALL(*filter_,
scriptLog(spdlog::level::debug, Eq(absl::string_view("onRequestHeaders 1"))));
Expand All @@ -103,7 +103,7 @@ TEST_F(WasmHttpFilterTest, HeadersOnlyRequestHeadersOnly) {
// Script touching headers only, request that is headers only.
TEST_F(WasmHttpFilterTest, HeadersOnlyRequestHeadersAndBody) {
setupConfig(TestEnvironment::readFileToStringForTest(TestEnvironment::substitute(
"{{ test_rundir }}/test/extensions/filters/http/wasm/test_data/headers.wasm")));
"{{ test_rundir }}/test/extensions/filters/http/wasm/test_data/headers_cpp.wasm")));
setupFilter();
EXPECT_CALL(*filter_,
scriptLog(spdlog::level::debug, Eq(absl::string_view("onRequestHeaders 1"))));
Expand All @@ -122,7 +122,7 @@ TEST_F(WasmHttpFilterTest, HeadersOnlyRequestHeadersAndBody) {
// Script testing AccessLog::Instance::log.
TEST_F(WasmHttpFilterTest, AccessLog) {
setupConfig(TestEnvironment::readFileToStringForTest(TestEnvironment::substitute(
"{{ test_rundir }}/test/extensions/filters/http/wasm/test_data/headers.wasm")));
"{{ test_rundir }}/test/extensions/filters/http/wasm/test_data/headers_cpp.wasm")));
setupFilter();
EXPECT_CALL(*filter_,
scriptLog(spdlog::level::debug, Eq(absl::string_view("onRequestHeaders 1"))));
Expand All @@ -143,7 +143,7 @@ TEST_F(WasmHttpFilterTest, AccessLog) {

TEST_F(WasmHttpFilterTest, AsyncCall) {
setupConfig(TestEnvironment::readFileToStringForTest(TestEnvironment::substitute(
"{{ test_rundir }}/test/extensions/filters/http/wasm/test_data/async_call.wasm")));
"{{ test_rundir }}/test/extensions/filters/http/wasm/test_data/async_call_cpp.wasm")));
setupFilter();
wasm_->start();

Expand Down
12 changes: 6 additions & 6 deletions test/extensions/wasm/config_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@ TEST(WasmFactoryTest, CreateWasmFromWASM) {
ASSERT_NE(factory, nullptr);
envoy::config::wasm::v2::WasmConfig config;
config.mutable_vm_config()->set_vm("envoy.wasm.vm.wavm");
config.mutable_vm_config()->mutable_code()->set_filename(
TestEnvironment::substitute("{{ test_rundir }}/test/extensions/wasm/test_data/logging.wasm"));
config.mutable_vm_config()->mutable_code()->set_filename(TestEnvironment::substitute(
"{{ test_rundir }}/test/extensions/wasm/test_data/logging_cpp.wasm"));
config.set_singleton(true);
Upstream::MockClusterManager cluster_manager;
Event::MockDispatcher dispatcher;
Expand All @@ -44,8 +44,8 @@ TEST(WasmFactoryTest, CreateWasmFromPrecompiledWASM) {
ASSERT_NE(factory, nullptr);
envoy::config::wasm::v2::WasmConfig config;
config.mutable_vm_config()->set_vm("envoy.wasm.vm.wavm");
config.mutable_vm_config()->mutable_code()->set_filename(
TestEnvironment::substitute("{{ test_rundir }}/test/extensions/wasm/test_data/logging.wasm"));
config.mutable_vm_config()->mutable_code()->set_filename(TestEnvironment::substitute(
"{{ test_rundir }}/test/extensions/wasm/test_data/logging_cpp.wasm"));
config.mutable_vm_config()->set_allow_precompiled(true);
config.set_singleton(true);
Upstream::MockClusterManager cluster_manager;
Expand All @@ -64,8 +64,8 @@ TEST(WasmFactoryTest, CreateWasmFromWASMPerThread) {
ASSERT_NE(factory, nullptr);
envoy::config::wasm::v2::WasmConfig config;
config.mutable_vm_config()->set_vm("envoy.wasm.vm.wavm");
config.mutable_vm_config()->mutable_code()->set_filename(
TestEnvironment::substitute("{{ test_rundir }}/test/extensions/wasm/test_data/logging.wasm"));
config.mutable_vm_config()->mutable_code()->set_filename(TestEnvironment::substitute(
"{{ test_rundir }}/test/extensions/wasm/test_data/logging_cpp.wasm"));
config.set_id("test_id");
Upstream::MockClusterManager cluster_manager;
Event::MockDispatcher dispatcher;
Expand Down
2 changes: 1 addition & 1 deletion test/extensions/wasm/test_data/Makefile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
NO_CONTEXT = true

all: logging.wasm bad_signature.wasm segv.wasm emscript.wasm asm2wasm.wasm
all: logging_cpp.wasm bad_signature_cpp.wasm segv_cpp.wasm emscripten_cpp.wasm asm2wasm_cpp.wasm

include ../../../../api/wasm/cpp/Makefile.base
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
22 changes: 11 additions & 11 deletions test/extensions/wasm/wasm_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,8 @@ TEST(WasmTest, Logging) {
auto wasm = std::make_unique<Extensions::Common::Wasm::Wasm>("envoy.wasm.vm.wavm", "", "",
cluster_manager, dispatcher);
EXPECT_NE(wasm, nullptr);
const auto code = TestEnvironment::readFileToStringForTest(
TestEnvironment::substitute("{{ test_rundir }}/test/extensions/wasm/test_data/logging.wasm"));
const auto code = TestEnvironment::readFileToStringForTest(TestEnvironment::substitute(
"{{ test_rundir }}/test/extensions/wasm/test_data/logging_cpp.wasm"));
EXPECT_FALSE(code.empty());
auto context = std::make_unique<TestContext>(wasm.get());

Expand All @@ -62,7 +62,7 @@ TEST(WasmTest, BadSignature) {
cluster_manager, dispatcher);
EXPECT_NE(wasm, nullptr);
const auto code = TestEnvironment::readFileToStringForTest(TestEnvironment::substitute(
"{{ test_rundir }}/test/extensions/wasm/test_data/bad_signature.wasm"));
"{{ test_rundir }}/test/extensions/wasm/test_data/bad_signature_cpp.wasm"));
EXPECT_FALSE(code.empty());
auto context = std::make_unique<TestContext>(wasm.get());
EXPECT_THROW_WITH_MESSAGE(wasm->initialize(code, "<test>", false),
Expand All @@ -78,8 +78,8 @@ TEST(WasmTest, Segv) {
auto wasm = std::make_shared<Extensions::Common::Wasm::Wasm>("envoy.wasm.vm.wavm", "", "",
cluster_manager, dispatcher);
EXPECT_NE(wasm, nullptr);
const auto code = TestEnvironment::readFileToStringForTest(
TestEnvironment::substitute("{{ test_rundir }}/test/extensions/wasm/test_data/segv.wasm"));
const auto code = TestEnvironment::readFileToStringForTest(TestEnvironment::substitute(
"{{ test_rundir }}/test/extensions/wasm/test_data/segv_cpp.wasm"));
EXPECT_FALSE(code.empty());
auto context = std::make_unique<TestContext>(wasm.get());
EXPECT_CALL(*context, scriptLog(spdlog::level::err, Eq("before badptr")));
Expand All @@ -97,8 +97,8 @@ TEST(WasmTest, DivByZero) {
auto wasm = std::make_shared<Extensions::Common::Wasm::Wasm>("envoy.wasm.vm.wavm", "", "",
cluster_manager, dispatcher);
EXPECT_NE(wasm, nullptr);
const auto code = TestEnvironment::readFileToStringForTest(
TestEnvironment::substitute("{{ test_rundir }}/test/extensions/wasm/test_data/segv.wasm"));
const auto code = TestEnvironment::readFileToStringForTest(TestEnvironment::substitute(
"{{ test_rundir }}/test/extensions/wasm/test_data/segv_cpp.wasm"));
EXPECT_FALSE(code.empty());
auto context = std::make_unique<TestContext>(wasm.get());
EXPECT_CALL(*context, scriptLog(spdlog::level::err, Eq("before div by zero")));
Expand All @@ -117,8 +117,8 @@ TEST(WasmTest, EmscriptenVersion) {
auto wasm = std::make_shared<Extensions::Common::Wasm::Wasm>("envoy.wasm.vm.wavm", "", "",
cluster_manager, dispatcher);
EXPECT_NE(wasm, nullptr);
const auto code = TestEnvironment::readFileToStringForTest(
TestEnvironment::substitute("{{ test_rundir }}/test/extensions/wasm/test_data/segv.wasm"));
const auto code = TestEnvironment::readFileToStringForTest(TestEnvironment::substitute(
"{{ test_rundir }}/test/extensions/wasm/test_data/segv_cpp.wasm"));
EXPECT_FALSE(code.empty());
auto context = std::make_unique<TestContext>(wasm.get());
EXPECT_TRUE(wasm->initialize(code, "<test>", false));
Expand All @@ -139,7 +139,7 @@ TEST(WasmTest, IntrinsicGlobals) {
cluster_manager, dispatcher);
EXPECT_NE(wasm, nullptr);
const auto code = TestEnvironment::readFileToStringForTest(TestEnvironment::substitute(
"{{ test_rundir }}/test/extensions/wasm/test_data/emscript.wasm"));
"{{ test_rundir }}/test/extensions/wasm/test_data/emscripten_cpp.wasm"));
EXPECT_FALSE(code.empty());
auto context = std::make_unique<TestContext>(wasm.get());
EXPECT_CALL(*context, scriptLog(spdlog::level::info, Eq("NaN nan")));
Expand All @@ -164,7 +164,7 @@ TEST(WasmTest, Asm2Wasm) {
cluster_manager, dispatcher);
EXPECT_NE(wasm, nullptr);
const auto code = TestEnvironment::readFileToStringForTest(TestEnvironment::substitute(
"{{ test_rundir }}/test/extensions/wasm/test_data/asm2wasm.wasm"));
"{{ test_rundir }}/test/extensions/wasm/test_data/asm2wasm_cpp.wasm"));
EXPECT_FALSE(code.empty());
auto context = std::make_unique<TestContext>(wasm.get());
EXPECT_CALL(*context, scriptLog(spdlog::level::info, Eq("out 0 0 0")));
Expand Down

0 comments on commit 098f146

Please sign in to comment.