From ba10da07d002c6a9aa30a828e4759fa7fbebe884 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pawe=C5=82=20Bylica?= Date: Thu, 30 May 2019 14:15:20 +0200 Subject: [PATCH] loader: Use new VM mock with wrong ABI version --- test/unittests/test_loader.cpp | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/test/unittests/test_loader.cpp b/test/unittests/test_loader.cpp index 8ae7ada..8083be6 100644 --- a/test/unittests/test_loader.cpp +++ b/test/unittests/test_loader.cpp @@ -118,12 +118,6 @@ static evmc_instance* create_failure() return nullptr; } -static evmc_instance* create_abi42() -{ - static int abi_version = 42; - return reinterpret_cast(&abi_version); -} - TEST_F(loader, load_nonexistent) { constexpr auto path = "nonexistent"; @@ -282,12 +276,14 @@ TEST_F(loader, load_and_create_failure) TEST_F(loader, load_and_create_abi_mismatch) { - setup("abi42.vm", "evmc_create", create_abi42); + setup("abi1985.vm", "evmc_create", create_vm_with_wrong_abi); evmc_loader_error_code ec; auto vm = evmc_load_and_create(evmc_test_library_path, &ec); EXPECT_TRUE(vm == nullptr); EXPECT_EQ(ec, EVMC_LOADER_ABI_VERSION_MISMATCH); - EXPECT_STREQ(evmc_last_error_msg(), - "EVMC ABI version 42 of abi42.vm mismatches the expected version 6"); + const auto expected_error_msg = + "EVMC ABI version 1985 of abi1985.vm mismatches the expected version " + + std::to_string(EVMC_ABI_VERSION); + EXPECT_EQ(evmc_last_error_msg(), expected_error_msg); }