mirror of https://github.com/status-im/evmc.git
Merge pull request #241 from ethereum/vmtester
vmtester: dereference if output_data is present
This commit is contained in:
commit
4f25bcbf5f
|
@ -10,6 +10,24 @@
|
||||||
#include <array>
|
#include <array>
|
||||||
#include <cstring>
|
#include <cstring>
|
||||||
|
|
||||||
|
namespace
|
||||||
|
{
|
||||||
|
// NOTE: this is to avoid compiler optimisations when reading the buffer
|
||||||
|
uint8_t read_uint8(const volatile uint8_t* p)
|
||||||
|
{
|
||||||
|
return *p;
|
||||||
|
}
|
||||||
|
|
||||||
|
void read_buffer(const uint8_t* ptr, size_t size)
|
||||||
|
{
|
||||||
|
for (size_t i = 0; i < size; i++)
|
||||||
|
{
|
||||||
|
read_uint8(&ptr[i]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
} // namespace
|
||||||
|
|
||||||
TEST_F(evmc_vm_test, abi_version_match)
|
TEST_F(evmc_vm_test, abi_version_match)
|
||||||
{
|
{
|
||||||
ASSERT_EQ(vm->abi_version, EVMC_ABI_VERSION);
|
ASSERT_EQ(vm->abi_version, EVMC_ABI_VERSION);
|
||||||
|
@ -46,6 +64,11 @@ TEST_F(evmc_vm_test, execute)
|
||||||
{
|
{
|
||||||
EXPECT_EQ(result.output_size, 0);
|
EXPECT_EQ(result.output_size, 0);
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
EXPECT_NE(result.output_size, 0);
|
||||||
|
read_buffer(result.output_data, result.output_size);
|
||||||
|
}
|
||||||
|
|
||||||
if (result.release)
|
if (result.release)
|
||||||
result.release(&result);
|
result.release(&result);
|
||||||
|
|
Loading…
Reference in New Issue