From 6b32b0c71c7cdf9207cfea35d6065423f71e732c Mon Sep 17 00:00:00 2001 From: Parth Dagia Date: Thu, 11 Jun 2026 21:42:48 +0530 Subject: [PATCH 01/17] feat(wasi_crypto): implement ECDSA public key verification (#4932) Implement Ecdsa::PublicKey::verify() using EVP_PKEY_public_check. Part of #2669. Signed-off-by: Parth Dagia --- plugins/wasi_crypto/asymmetric_common/ecdsa.h | 9 ++++++++- test/plugins/wasi_crypto/signatures.cpp | 18 ++++++++++++++++++ 2 files changed, 26 insertions(+), 1 deletion(-) diff --git a/plugins/wasi_crypto/asymmetric_common/ecdsa.h b/plugins/wasi_crypto/asymmetric_common/ecdsa.h index 85990ca3..3a48e19d 100644 --- a/plugins/wasi_crypto/asymmetric_common/ecdsa.h +++ b/plugins/wasi_crypto/asymmetric_common/ecdsa.h @@ -82,7 +82,14 @@ class Ecdsa { } WasiCryptoExpect verify() const noexcept { - return WasiCryptoUnexpect(__WASI_CRYPTO_ERRNO_NOT_IMPLEMENTED); + EvpPkeyCtxPtr CheckCtx{EVP_PKEY_CTX_new(Ctx.get(), nullptr)}; + ensureOrReturn(CheckCtx, __WASI_CRYPTO_ERRNO_ALGORITHM_FAILURE); + // EVP_PKEY_public_check() returns 1 for a valid key and 0 for an invalid + // one. A negative value means the check is unsupported for this key type + // (e.g. on OpenSSL 1.1.1), so only an explicit 0 is treated as invalid. + ensureOrReturn(EVP_PKEY_public_check(CheckCtx.get()) != 0, + __WASI_CRYPTO_ERRNO_INVALID_KEY); + return {}; } protected: diff --git a/test/plugins/wasi_crypto/signatures.cpp b/test/plugins/wasi_crypto/signatures.cpp index 6d814992..b63609b1 100644 --- a/test/plugins/wasi_crypto/signatures.cpp +++ b/test/plugins/wasi_crypto/signatures.cpp @@ -62,6 +62,9 @@ TEST_F(WasiCryptoTest, Signatures) { WASI_CRYPTO_EXPECT_TRUE(publickeyVerify(PkHandle)); }; PublicKeyVerifyTest(__WASI_ALGORITHM_TYPE_SIGNATURES, "Ed25519"sv); + PublicKeyVerifyTest(__WASI_ALGORITHM_TYPE_SIGNATURES, "ECDSA_P256_SHA256"sv); + PublicKeyVerifyTest(__WASI_ALGORITHM_TYPE_SIGNATURES, "ECDSA_K256_SHA256"sv); + PublicKeyVerifyTest(__WASI_ALGORITHM_TYPE_SIGNATURES, "ECDSA_P384_SHA384"sv); // A raw public key with an invalid length is rejected on import. auto PublicKeyImportInvalidTest = [this](__wasi_algorithm_type_e_t AlgType, @@ -73,6 +76,21 @@ TEST_F(WasiCryptoTest, Signatures) { }; PublicKeyImportInvalidTest(__WASI_ALGORITHM_TYPE_SIGNATURES, "Ed25519"sv); + // A SEC1 public key whose point is not on the curve is rejected on import. + auto PublicKeyImportInvalidSecTest = [this](__wasi_algorithm_type_e_t AlgType, + std::string_view Alg) { + SCOPED_TRACE(Alg); + WASI_CRYPTO_EXPECT_FAILURE( + publickeyImport( + AlgType, Alg, + "04ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff" + "ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"_u8v, + __WASI_PUBLICKEY_ENCODING_SEC), + __WASI_CRYPTO_ERRNO_INVALID_KEY); + }; + PublicKeyImportInvalidSecTest(__WASI_ALGORITHM_TYPE_SIGNATURES, + "ECDSA_P256_SHA256"sv); + auto SigEncodingTest = [this]( std::string_view Alg, From d0c29220f42094201e135691813523f89c85af84 Mon Sep 17 00:00:00 2001 From: hydai Date: Sat, 13 Jun 2026 01:20:21 +0800 Subject: [PATCH 02/17] fix(plugin/zlib): rename shadowed z_stream locals in zlib plugin GCC's -Wshadow=local errors because the z_stream unique_ptr locals in the init/copy host functions share the HostZStream/DestZStream names with the SyncRun lambda parameters. Rename the locals to NewZStream; the lambda parameter naming stays consistent across the file. Assisted-by: GitHub Copilot CLI (Claude Fable 5) Signed-off-by: hydai --- plugins/wasmedge_zlib/zlibfunc.cpp | 108 ++++++++++++++--------------- 1 file changed, 54 insertions(+), 54 deletions(-) diff --git a/plugins/wasmedge_zlib/zlibfunc.cpp b/plugins/wasmedge_zlib/zlibfunc.cpp index b283f69a..8e54dd8f 100644 --- a/plugins/wasmedge_zlib/zlibfunc.cpp +++ b/plugins/wasmedge_zlib/zlibfunc.cpp @@ -149,14 +149,14 @@ Expect WasmEdgeZlibDeflateInit::body(const Runtime::CallingFrame &Frame, uint32_t ZStreamPtr, int32_t Level) { - auto HostZStream = std::make_unique(); - HostZStream->zalloc = Z_NULL; - HostZStream->zfree = Z_NULL; - HostZStream->opaque = + auto NewZStream = std::make_unique(); + NewZStream->zalloc = Z_NULL; + NewZStream->zfree = Z_NULL; + NewZStream->opaque = Z_NULL; // ignore opaque since zmalloc and zfree was ignored auto It = - Env.ZStreamMap.emplace(std::make_pair(ZStreamPtr, std::move(HostZStream))) + Env.ZStreamMap.emplace(std::make_pair(ZStreamPtr, std::move(NewZStream))) .second; const auto ZRes = SyncRun( @@ -194,14 +194,14 @@ Expect WasmEdgeZlibInflateInit::body(const Runtime::CallingFrame &Frame, uint32_t ZStreamPtr) { - auto HostZStream = std::make_unique(); - HostZStream->zalloc = Z_NULL; - HostZStream->zfree = Z_NULL; - HostZStream->opaque = + auto NewZStream = std::make_unique(); + NewZStream->zalloc = Z_NULL; + NewZStream->zfree = Z_NULL; + NewZStream->opaque = Z_NULL; // ignore opaque since zmalloc and zfree was ignored auto It = - Env.ZStreamMap.emplace(std::make_pair(ZStreamPtr, std::move(HostZStream))) + Env.ZStreamMap.emplace(std::make_pair(ZStreamPtr, std::move(NewZStream))) .second; const auto ZRes = @@ -238,14 +238,14 @@ Expect WasmEdgeZlibDeflateInit2::body( const Runtime::CallingFrame &Frame, uint32_t ZStreamPtr, int32_t Level, int32_t Method, int32_t WindowBits, int32_t MemLevel, int32_t Strategy) { - auto HostZStream = std::make_unique(); - HostZStream->zalloc = Z_NULL; - HostZStream->zfree = Z_NULL; - HostZStream->opaque = + auto NewZStream = std::make_unique(); + NewZStream->zalloc = Z_NULL; + NewZStream->zfree = Z_NULL; + NewZStream->opaque = Z_NULL; // ignore opaque since zmalloc and zfree was ignored auto It = - Env.ZStreamMap.emplace(std::make_pair(ZStreamPtr, std::move(HostZStream))) + Env.ZStreamMap.emplace(std::make_pair(ZStreamPtr, std::move(NewZStream))) .second; const auto ZRes = @@ -308,10 +308,10 @@ WasmEdgeZlibDeflateCopy::body(const Runtime::CallingFrame &Frame, return Unexpect(ErrCode::Value::HostFuncError); } - auto DestZStream = std::make_unique(); + auto NewZStream = std::make_unique(); auto It = - Env.ZStreamMap.emplace(std::make_pair(DestPtr, std::move(DestZStream))) + Env.ZStreamMap.emplace(std::make_pair(DestPtr, std::move(NewZStream))) .second; const auto Res = SyncRun("WasmEdgeZlibDeflateCopy", Env, DestPtr, Frame, @@ -429,14 +429,14 @@ WasmEdgeZlibDeflateSetHeader::body(const Runtime::CallingFrame &Frame, Expect WasmEdgeZlibInflateInit2::body(const Runtime::CallingFrame &Frame, uint32_t ZStreamPtr, int32_t WindowBits) { - auto HostZStream = std::make_unique(); - HostZStream->zalloc = Z_NULL; - HostZStream->zfree = Z_NULL; - HostZStream->opaque = + auto NewZStream = std::make_unique(); + NewZStream->zalloc = Z_NULL; + NewZStream->zfree = Z_NULL; + NewZStream->opaque = Z_NULL; // ignore opaque since zmalloc and zfree was ignored auto It = - Env.ZStreamMap.emplace(std::make_pair(ZStreamPtr, std::move(HostZStream))) + Env.ZStreamMap.emplace(std::make_pair(ZStreamPtr, std::move(NewZStream))) .second; const auto ZRes = SyncRun("WasmEdgeZlibInflateInit2", Env, ZStreamPtr, Frame, @@ -500,10 +500,10 @@ WasmEdgeZlibInflateCopy::body(const Runtime::CallingFrame &Frame, return Unexpect(ErrCode::Value::HostFuncError); } - auto DestZStream = std::make_unique(); + auto NewZStream = std::make_unique(); auto It = - Env.ZStreamMap.emplace(std::make_pair(DestPtr, std::move(DestZStream))) + Env.ZStreamMap.emplace(std::make_pair(DestPtr, std::move(NewZStream))) .second; const auto Res = SyncRun("WasmEdgeZlibInflateCopy", Env, DestPtr, Frame, @@ -593,10 +593,10 @@ Expect WasmEdgeZlibInflateBackInit::body(const Runtime::CallingFrame &Frame, uint32_t ZStreamPtr, int32_t WindowBits, uint32_t WindowPtr) { - auto HostZStream = std::make_unique(); - HostZStream->zalloc = Z_NULL; - HostZStream->zfree = Z_NULL; - HostZStream->opaque = + auto NewZStream = std::make_unique(); + NewZStream->zalloc = Z_NULL; + NewZStream->zfree = Z_NULL; + NewZStream->opaque = Z_NULL; // ignore opaque since zmalloc and zfree was ignored MEMINST_CHECK(MemInst, Frame, 0) @@ -604,7 +604,7 @@ WasmEdgeZlibInflateBackInit::body(const Runtime::CallingFrame &Frame, auto *Window = MemInst->getPointer(WindowPtr); auto It = - Env.ZStreamMap.emplace(std::make_pair(ZStreamPtr, std::move(HostZStream))) + Env.ZStreamMap.emplace(std::make_pair(ZStreamPtr, std::move(NewZStream))) .second; const auto ZRes = @@ -1112,16 +1112,16 @@ WasmEdgeZlibDeflateInit_::body(const Runtime::CallingFrame &Frame, MEMINST_CHECK(MemInst, Frame, 0) const auto *WasmZlibVersion = MemInst->getPointer(VersionPtr); - auto HostZStream = std::make_unique(); + auto NewZStream = std::make_unique(); // ignore wasm custom allocators - HostZStream->zalloc = Z_NULL; - HostZStream->zfree = Z_NULL; + NewZStream->zalloc = Z_NULL; + NewZStream->zfree = Z_NULL; // Ignore opaque because zmalloc and zfree are ignored. - HostZStream->opaque = Z_NULL; + NewZStream->opaque = Z_NULL; auto It = - Env.ZStreamMap.emplace(std::make_pair(ZStreamPtr, std::move(HostZStream))) + Env.ZStreamMap.emplace(std::make_pair(ZStreamPtr, std::move(NewZStream))) .second; const auto ZRes = @@ -1147,16 +1147,16 @@ WasmEdgeZlibInflateInit_::body(const Runtime::CallingFrame &Frame, MEMINST_CHECK(MemInst, Frame, 0) const auto *WasmZlibVersion = MemInst->getPointer(VersionPtr); - auto HostZStream = std::make_unique(); + auto NewZStream = std::make_unique(); // ignore wasm custom allocators - HostZStream->zalloc = Z_NULL; - HostZStream->zfree = Z_NULL; + NewZStream->zalloc = Z_NULL; + NewZStream->zfree = Z_NULL; // Ignore opaque because zmalloc and zfree are ignored. - HostZStream->opaque = Z_NULL; + NewZStream->opaque = Z_NULL; auto It = - Env.ZStreamMap.emplace(std::make_pair(ZStreamPtr, std::move(HostZStream))) + Env.ZStreamMap.emplace(std::make_pair(ZStreamPtr, std::move(NewZStream))) .second; const auto ZRes = SyncRun("WasmEdgeZlibInflateInit_", Env, ZStreamPtr, Frame, @@ -1181,14 +1181,14 @@ Expect WasmEdgeZlibDeflateInit2_::body( MEMINST_CHECK(MemInst, Frame, 0) const auto *WasmZlibVersion = MemInst->getPointer(VersionPtr); - auto HostZStream = std::make_unique(); - HostZStream->zalloc = Z_NULL; - HostZStream->zfree = Z_NULL; - HostZStream->opaque = + auto NewZStream = std::make_unique(); + NewZStream->zalloc = Z_NULL; + NewZStream->zfree = Z_NULL; + NewZStream->opaque = Z_NULL; // ignore opaque since zmalloc and zfree was ignored auto It = - Env.ZStreamMap.emplace(std::make_pair(ZStreamPtr, std::move(HostZStream))) + Env.ZStreamMap.emplace(std::make_pair(ZStreamPtr, std::move(NewZStream))) .second; const auto ZRes = SyncRun( @@ -1214,14 +1214,14 @@ WasmEdgeZlibInflateInit2_::body(const Runtime::CallingFrame &Frame, MEMINST_CHECK(MemInst, Frame, 0) const auto *WasmZlibVersion = MemInst->getPointer(VersionPtr); - auto HostZStream = std::make_unique(); - HostZStream->zalloc = Z_NULL; - HostZStream->zfree = Z_NULL; - HostZStream->opaque = + auto NewZStream = std::make_unique(); + NewZStream->zalloc = Z_NULL; + NewZStream->zfree = Z_NULL; + NewZStream->opaque = Z_NULL; // ignore opaque since zmalloc and zfree was ignored auto It = - Env.ZStreamMap.emplace(std::make_pair(ZStreamPtr, std::move(HostZStream))) + Env.ZStreamMap.emplace(std::make_pair(ZStreamPtr, std::move(NewZStream))) .second; const auto ZRes = @@ -1247,14 +1247,14 @@ Expect WasmEdgeZlibInflateBackInit_::body( const auto *WasmZlibVersion = MemInst->getPointer(VersionPtr); auto *Window = MemInst->getPointer(WindowPtr); - auto HostZStream = std::make_unique(); - HostZStream->zalloc = Z_NULL; - HostZStream->zfree = Z_NULL; - HostZStream->opaque = + auto NewZStream = std::make_unique(); + NewZStream->zalloc = Z_NULL; + NewZStream->zfree = Z_NULL; + NewZStream->opaque = Z_NULL; // ignore opaque since zmalloc and zfree was ignored auto It = - Env.ZStreamMap.emplace(std::make_pair(ZStreamPtr, std::move(HostZStream))) + Env.ZStreamMap.emplace(std::make_pair(ZStreamPtr, std::move(NewZStream))) .second; const auto ZRes = From efb882d67374585cf2ed8e516bf237ca34be30f0 Mon Sep 17 00:00:00 2001 From: hydai Date: Sat, 13 Jun 2026 01:20:22 +0800 Subject: [PATCH 03/17] fix(plugin/wasm_bpf): rename shadowed loop variables in wasm_bpf test The histogram-printing loops reuse i inside the polling loop that already declares it, which errors under GCC's -Wshadow=local and Clang's -Wshadow. Rename the inner loop variables to j. Assisted-by: GitHub Copilot CLI (Claude Fable 5) Signed-off-by: hydai --- test/plugins/wasm_bpf/wasm_bpf.cpp | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/test/plugins/wasm_bpf/wasm_bpf.cpp b/test/plugins/wasm_bpf/wasm_bpf.cpp index 34f8b116..c71b8e6d 100644 --- a/test/plugins/wasm_bpf/wasm_bpf.cpp +++ b/test/plugins/wasm_bpf/wasm_bpf.cpp @@ -540,13 +540,13 @@ TEST(WasmBpfTest, RunBpfProgramWithMapOperation) { EXPECT_GE(mapLookupElem(histsFd, nextKeyOffset, histOffset), 0); const auto &histRef = readHistRef(histOffset); size_t maxIdx = 0; - for (size_t i = 0; i < std::size(histRef.slots); i++) - if (histRef.slots[i] > 0) - maxIdx = i; - for (size_t i = 0; i < maxIdx; i++) { - auto low = UINT64_C(1) << (i); - auto high = (UINT64_C(1) << (i + 1)) - 1; - fmt::print("{:<6}...{:<6} {:<6}\n"sv, low, high, histRef.slots[i]); + for (size_t j = 0; j < std::size(histRef.slots); j++) + if (histRef.slots[j] > 0) + maxIdx = j; + for (size_t j = 0; j < maxIdx; j++) { + auto low = UINT64_C(1) << (j); + auto high = (UINT64_C(1) << (j + 1)) - 1; + fmt::print("{:<6}...{:<6} {:<6}\n"sv, low, high, histRef.slots[j]); } writeU32(lookUpKeyOffset, readU32(nextKeyOffset)); } From ea67fef63705113cf6fcdace4fed18f0def077ab Mon Sep 17 00:00:00 2001 From: hydai Date: Sat, 13 Jun 2026 01:32:32 +0800 Subject: [PATCH 04/17] fix(test/opencvmini): suppress shadow warnings on the opencvmini test target The opencvmini test target pulls the OpenCV include path in through the plugin's INCLUDE_DIRECTORIES property as a regular include, so Clang's -Wshadow-field errors on parameters shadowing members inherited from cv::Mat inside OpenCV's own mat.inl.hpp. Reuse the wasmedge_suppress_shadow_warnings helper on the test target, matching how the other third-party dependencies are handled. Assisted-by: GitHub Copilot CLI (Claude Fable 5) Signed-off-by: hydai --- test/plugins/wasmedge_opencvmini/CMakeLists.txt | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/test/plugins/wasmedge_opencvmini/CMakeLists.txt b/test/plugins/wasmedge_opencvmini/CMakeLists.txt index 9f0946f2..006ccbab 100644 --- a/test/plugins/wasmedge_opencvmini/CMakeLists.txt +++ b/test/plugins/wasmedge_opencvmini/CMakeLists.txt @@ -5,6 +5,10 @@ wasmedge_add_executable(wasmedgeOpencvminiTests wasmedge_opencvmini.cpp ) +# OpenCV headers come in through the plugin's include directories as regular +# includes and trip the shadow warnings; they are not ours to fix. +wasmedge_suppress_shadow_warnings(wasmedgeOpencvminiTests) + add_dependencies(wasmedgeOpencvminiTests wasmedgePluginWasmEdgeOpenCVMini ) From cceb9331ec6b3aded8f7a349156acfb186bb7d4d Mon Sep 17 00:00:00 2001 From: hydai Date: Wed, 17 Jun 2026 03:57:40 +0800 Subject: [PATCH 05/17] chore(plugin/llmc): deprecate wasmedge-llmc plugin (#4964) Signed-off-by: hydai --- plugins/wasmedge_llmc/CMakeLists.txt | 64 +----- plugins/wasmedge_llmc/llmc_base.h | 28 --- plugins/wasmedge_llmc/llmc_env.cpp | 85 -------- plugins/wasmedge_llmc/llmc_env.h | 57 ----- plugins/wasmedge_llmc/llmc_func.cpp | 127 ----------- plugins/wasmedge_llmc/llmc_func.h | 91 -------- plugins/wasmedge_llmc/llmc_fwd.h | 29 --- plugins/wasmedge_llmc/llmc_module.cpp | 20 -- plugins/wasmedge_llmc/llmc_module.h | 22 -- test/plugins/wasmedge_llmc/CMakeLists.txt | 76 +------ test/plugins/wasmedge_llmc/wasmedge_llmc.cpp | 214 ------------------- 11 files changed, 2 insertions(+), 811 deletions(-) delete mode 100644 plugins/wasmedge_llmc/llmc_base.h delete mode 100644 plugins/wasmedge_llmc/llmc_env.cpp delete mode 100644 plugins/wasmedge_llmc/llmc_env.h delete mode 100644 plugins/wasmedge_llmc/llmc_func.cpp delete mode 100644 plugins/wasmedge_llmc/llmc_func.h delete mode 100644 plugins/wasmedge_llmc/llmc_fwd.h delete mode 100644 plugins/wasmedge_llmc/llmc_module.cpp delete mode 100644 plugins/wasmedge_llmc/llmc_module.h delete mode 100644 test/plugins/wasmedge_llmc/wasmedge_llmc.cpp diff --git a/plugins/wasmedge_llmc/CMakeLists.txt b/plugins/wasmedge_llmc/CMakeLists.txt index da37ed2f..6798cef7 100644 --- a/plugins/wasmedge_llmc/CMakeLists.txt +++ b/plugins/wasmedge_llmc/CMakeLists.txt @@ -1,66 +1,4 @@ # SPDX-License-Identifier: Apache-2.0 # SPDX-FileCopyrightText: 2019-2024 Second State INC -wasmedge_add_library(wasmedgePluginWasmEdgeLLMC - SHARED - llmc_func.cpp - llmc_module.cpp - llmc_env.cpp -) - -option(WASMEDGE_PLUGIN_LLMC_CUDA "Training GPT2 with CUDA" OFF) - -message(STATUS "Start fetching llm.c source") -include(FetchContent) - -if (WASMEDGE_PLUGIN_LLMC_CUDA) - set(CUDALIB ON) - message(STATUS "Build wasmedge_llmc with CUDA backend") -else() - message(STATUS "Build wasmedge_llmc with CPU backend") -endif() - -FetchContent_Declare( - llmc - GIT_REPOSITORY https://github.com/WasmEdge/llm.c -) -FetchContent_MakeAvailable(llmc) - -if (WASMEDGE_PLUGIN_LLMC_CUDA) - target_link_libraries(wasmedgePluginWasmEdgeLLMC PRIVATE - train_gpt2_cuda - ) -else() - target_link_libraries(wasmedgePluginWasmEdgeLLMC PRIVATE - train_gpt2_cpu - ) -endif() - -target_compile_options(wasmedgePluginWasmEdgeLLMC - PUBLIC - -DWASMEDGE_PLUGIN -) - -target_include_directories(wasmedgePluginWasmEdgeLLMC - PUBLIC - $ - ${CMAKE_CURRENT_SOURCE_DIR} -) - -if(WASMEDGE_LINK_PLUGINS_STATIC) - target_link_libraries(wasmedgePluginWasmEdgeLLMC - PRIVATE - wasmedgeCAPI - ) -else() - target_link_libraries(wasmedgePluginWasmEdgeLLMC - PRIVATE - wasmedge_shared - ) -endif() - -install( - TARGETS wasmedgePluginWasmEdgeLLMC - DESTINATION ${CMAKE_INSTALL_LIBDIR}/wasmedge - COMPONENT WasmEdge -) +message(FATAL_ERROR "WasmEdge LLMC plugin is removed due to the upstream end-of-life. Reference: https://github.com/WasmEdge/llm.c") diff --git a/plugins/wasmedge_llmc/llmc_base.h b/plugins/wasmedge_llmc/llmc_base.h deleted file mode 100644 index 6b35ffff..00000000 --- a/plugins/wasmedge_llmc/llmc_base.h +++ /dev/null @@ -1,28 +0,0 @@ -// SPDX-License-Identifier: Apache-2.0 -// SPDX-FileCopyrightText: 2019-2024 Second State INC - -#pragma once - -#include "llmc_env.h" - -#include "common/errcode.h" -#include "runtime/hostfunc.h" - -namespace WasmEdge { -namespace Host { -namespace WasmEdgeLLMC { - -template class HostFunction : public Runtime::HostFunction { -public: - HostFunction(LLMCEnv &HostEnv) : Runtime::HostFunction(0), Env(HostEnv) {} - -protected: - static constexpr uint32_t castErrNo(ErrNo E) noexcept { - return static_cast(E); - } - LLMCEnv &Env; -}; - -} // namespace WasmEdgeLLMC -} // namespace Host -} // namespace WasmEdge diff --git a/plugins/wasmedge_llmc/llmc_env.cpp b/plugins/wasmedge_llmc/llmc_env.cpp deleted file mode 100644 index a960ec16..00000000 --- a/plugins/wasmedge_llmc/llmc_env.cpp +++ /dev/null @@ -1,85 +0,0 @@ -// SPDX-License-Identifier: Apache-2.0 -// SPDX-FileCopyrightText: 2019-2024 Second State INC - -#include "llmc_env.h" -#include "llmc_fwd.h" -#include "llmc_module.h" - -namespace WasmEdge { -namespace Host { -namespace WasmEdgeLLMC { - -uint32_t LLMCEnv::addModel(GPT2 *M) noexcept { - Models.push_back(M); - return Models.size() - 1; -} - -GPT2 *LLMCEnv::getModel(uint32_t Id) noexcept { - assert(Id < Models.size() && "Out of bounds"); - return Models[Id]; -} - -uint32_t LLMCEnv::addTokenizer(Tokenizer *T) noexcept { - Tokenizers.push_back(T); - return Tokenizers.size() - 1; -} - -Tokenizer *LLMCEnv::getTokenizer(uint32_t Id) noexcept { - assert(Id < Tokenizers.size() && "Out of bounds"); - return Tokenizers[Id]; -} - -uint32_t LLMCEnv::addDataLoader(DataLoader *D) noexcept { - DataLoaders.push_back(D); - return DataLoaders.size() - 1; -} - -DataLoader *LLMCEnv::getDataLoader(uint32_t Id) noexcept { - assert(Id < DataLoaders.size() && "Out of bounds"); - return DataLoaders[Id]; -} - -LLMCEnv::~LLMCEnv() { - for (GPT2 *M : Models) { - gpt2_destroy(M); - } - for (DataLoader *DL : DataLoaders) { - dataloader_destroy(DL); - } - for (Tokenizer *T : Tokenizers) { - tokenizer_destroy(T); - } -} - -namespace { -Runtime::Instance::ModuleInstance * -create(const Plugin::PluginModule::ModuleDescriptor *) noexcept { - return new WasmEdgeLLMCModule; -} - -static Plugin::PluginModule::ModuleDescriptor MD[] = { - { - /* Name */ "wasmedge_llmc", - /* Description */ "", - /* Create */ create, - }, -}; - -Plugin::Plugin::PluginDescriptor Descriptor{ - /* Name */ "wasmedge_llmc", - /* Description */ "", - /* APIVersion */ Plugin::Plugin::CurrentAPIVersion, - /* Version */ {0, 1, 0, 0}, - /* ModuleCount */ 1, - /* ModuleDescriptions */ MD, - /* ComponentCount */ 0, - /* ComponentDescriptions */ nullptr, - /*AddOptions*/ nullptr, -}; -} // namespace - -EXPORT_GET_DESCRIPTOR(Descriptor) - -} // namespace WasmEdgeLLMC -} // namespace Host -} // namespace WasmEdge diff --git a/plugins/wasmedge_llmc/llmc_env.h b/plugins/wasmedge_llmc/llmc_env.h deleted file mode 100644 index 66b9b8c1..00000000 --- a/plugins/wasmedge_llmc/llmc_env.h +++ /dev/null @@ -1,57 +0,0 @@ -// SPDX-License-Identifier: Apache-2.0 -// SPDX-FileCopyrightText: 2019-2024 Second State INC - -#pragma once - -#include "plugin/plugin.h" - -#include -#include -#include - -extern "C" { -struct GPT2; -struct Tokenizer; -struct DataLoader; -} - -namespace WasmEdge { -namespace Host { -namespace WasmEdgeLLMC { - -enum class ErrNo : uint32_t { - Success = 0, - InvalidArgument = 1, - MissingMemory = 2, -}; - -class LLMCEnv { - std::vector Models; - std::vector Tokenizers; - std::vector DataLoaders; - -public: - uint32_t addModel(GPT2 *M) noexcept; - - GPT2 *getModel(uint32_t Id) noexcept; - - size_t getModelSize() const noexcept { return Models.size(); } - - uint32_t addTokenizer(Tokenizer *T) noexcept; - - Tokenizer *getTokenizer(uint32_t Id) noexcept; - - size_t getTokenizerSize() const noexcept { return Tokenizers.size(); } - - uint32_t addDataLoader(DataLoader *D) noexcept; - - DataLoader *getDataLoader(uint32_t Id) noexcept; - - size_t getDataLoaderSize() const noexcept { return DataLoaders.size(); } - - ~LLMCEnv(); -}; - -} // namespace WasmEdgeLLMC -} // namespace Host -} // namespace WasmEdge diff --git a/plugins/wasmedge_llmc/llmc_func.cpp b/plugins/wasmedge_llmc/llmc_func.cpp deleted file mode 100644 index b90fba78..00000000 --- a/plugins/wasmedge_llmc/llmc_func.cpp +++ /dev/null @@ -1,127 +0,0 @@ -// SPDX-License-Identifier: Apache-2.0 -// SPDX-FileCopyrightText: 2019-2024 Second State INC - -#include "llmc_func.h" -#include "llmc_fwd.h" - -#include "common/errcode.h" -#include "common/spdlog.h" - -#include -#include - -namespace WasmEdge { -namespace Host { -namespace WasmEdgeLLMC { - -Expect ModelCreate::bodyImpl(const Runtime::CallingFrame &Frame, - uint32_t CheckPointPath, - uint32_t CheckPointPathLen, - uint32_t ModelIdPtr) { - auto *MemInst = Frame.getMemoryByIndex(0); - if (MemInst == nullptr) { - spdlog::error("[WasmEdge-LLMC] Memory instance not found."sv); - return ErrNo::MissingMemory; - } - auto CheckPointPathSpan = - MemInst->getSpan(CheckPointPath, CheckPointPathLen); - if (unlikely(CheckPointPathSpan.size() != CheckPointPathLen)) { - spdlog::error( - "[WasmEdge-LLMC] Failed when accessing the input checkpoint path memory."sv); - return ErrNo::MissingMemory; - } - - auto *ModelId = MemInst->getPointer(ModelIdPtr); - if (unlikely(ModelId == nullptr)) { - spdlog::error( - "[WasmEdge-LLMC] Failed when accessing the return model memory."sv); - return ErrNo::InvalidArgument; - } - std::string CheckPointPathStr = - std::string(CheckPointPathSpan.begin(), - CheckPointPathSpan.begin() + CheckPointPathSpan.size()); - GPT2 *Model = gpt2_create(CheckPointPathStr.data()); - *ModelId = Env.addModel(Model); - return ErrNo::Success; -} - -Expect DataLoaderCreate::bodyImpl( - const Runtime::CallingFrame &Frame, uint32_t DataPath, uint32_t DataPathLen, - uint32_t B, uint32_t T, uint32_t ProcessRank, uint32_t NumProcesses, - int32_t ShouldShuffle, uint32_t DataLoaderIdPtr) { - auto *MemInst = Frame.getMemoryByIndex(0); - if (MemInst == nullptr) { - spdlog::error("[WasmEdge-LLMC] Memory instance not found."sv); - return ErrNo::MissingMemory; - } - auto DataPathSpan = MemInst->getSpan(DataPath, DataPathLen); - if (unlikely(DataPathSpan.size() != DataPathLen)) { - spdlog::error( - "[WasmEdge-LLMC] Failed when accessing the input dataloader path memory."sv); - return ErrNo::MissingMemory; - } - - auto *DataLoaderId = MemInst->getPointer(DataLoaderIdPtr); - if (unlikely(DataLoaderId == nullptr)) { - spdlog::error( - "[WasmEdge-LLMC] Failed when accessing the return dataloader memory."sv); - return ErrNo::InvalidArgument; - } - - std::string DataPathStr = std::string( - DataPathSpan.begin(), DataPathSpan.begin() + DataPathSpan.size()); - DataLoader *D = dataloader_create(DataPathStr.data(), B, T, ProcessRank, - NumProcesses, ShouldShuffle); - *DataLoaderId = Env.addDataLoader(D); - return ErrNo::Success; -} - -Expect TokenizerCreate::bodyImpl(const Runtime::CallingFrame &Frame, - uint32_t FilePath, uint32_t FilePathLen, - uint32_t TokenizerIdPtr) { - auto *MemInst = Frame.getMemoryByIndex(0); - if (MemInst == nullptr) { - spdlog::error("[WasmEdge-LLMC] Memory instance not found."sv); - return ErrNo::MissingMemory; - } - auto FilePathSpan = MemInst->getSpan(FilePath, FilePathLen); - if (unlikely(FilePathSpan.size() != FilePathLen)) { - spdlog::error( - "[WasmEdge-LLMC] Failed when accessing the input tokenizer path memory."sv); - return ErrNo::MissingMemory; - } - - auto *TokenizerId = MemInst->getPointer(TokenizerIdPtr); - if (unlikely(TokenizerId == nullptr)) { - spdlog::error( - "[WasmEdge-LLMC] Failed when accessing the return tokenizer memory."sv); - return ErrNo::InvalidArgument; - } - std::string FilePathStr = std::string( - FilePathSpan.begin(), FilePathSpan.begin() + FilePathSpan.size()); - Tokenizer *T = tokenizer_create(FilePathStr.data()); - *TokenizerId = Env.addTokenizer(T); - return ErrNo::Success; -} - -Expect ModelTrain::bodyImpl(const Runtime::CallingFrame &Frame, - uint32_t ModelId, uint32_t TrainDataLoaderId, - uint32_t ValDataLoaderId, - uint32_t TokenizerId, uint32_t B, uint32_t T, - float Lr, uint32_t Epoch) { - auto *MemInst = Frame.getMemoryByIndex(0); - if (MemInst == nullptr) { - spdlog::error("[WasmEdge-LLMC] Memory instance not found."sv); - return ErrNo::MissingMemory; - } - GPT2 *Model = Env.getModel(ModelId); - DataLoader *TrainDataLoader = Env.getDataLoader(TrainDataLoaderId); - DataLoader *ValDataLoader = Env.getDataLoader(ValDataLoaderId); - Tokenizer *Tokenizer = Env.getTokenizer(TokenizerId); - gpt2_train(Model, TrainDataLoader, ValDataLoader, Tokenizer, B, T, Lr, Epoch); - return ErrNo::Success; -} - -} // namespace WasmEdgeLLMC -} // namespace Host -} // namespace WasmEdge diff --git a/plugins/wasmedge_llmc/llmc_func.h b/plugins/wasmedge_llmc/llmc_func.h deleted file mode 100644 index 85c786f5..00000000 --- a/plugins/wasmedge_llmc/llmc_func.h +++ /dev/null @@ -1,91 +0,0 @@ -// SPDX-License-Identifier: Apache-2.0 -// SPDX-FileCopyrightText: 2019-2024 Second State INC - -#pragma once - -#include "llmc_base.h" -#include "llmc_env.h" - -#include "runtime/callingframe.h" - -#include - -namespace WasmEdge { -namespace Host { -namespace WasmEdgeLLMC { - -class ModelCreate : public HostFunction { -public: - explicit ModelCreate(LLMCEnv &HostEnv) : HostFunction(HostEnv) {} - - Expect body(const Runtime::CallingFrame &Frame, - uint32_t CheckPointPath, uint32_t CheckPointPathLen, - uint32_t ModelIdPtr) { - return bodyImpl(Frame, CheckPointPath, CheckPointPathLen, ModelIdPtr) - .map(castErrNo); - } - -private: - Expect bodyImpl(const Runtime::CallingFrame &Frame, - uint32_t CheckPointPath, uint32_t CheckPointPathLen, - uint32_t ModelIdPtr); -}; - -class DataLoaderCreate : public HostFunction { -public: - explicit DataLoaderCreate(LLMCEnv &HostEnv) : HostFunction(HostEnv) {} - - Expect body(const Runtime::CallingFrame &Frame, uint32_t DataPath, - uint32_t DataPathLen, uint32_t B, uint32_t T, - uint32_t ProcessRank, uint32_t NumProcesses, - int32_t ShouldShuffle, uint32_t DataLoaderIdPtr) { - return bodyImpl(Frame, DataPath, DataPathLen, B, T, ProcessRank, - NumProcesses, ShouldShuffle, DataLoaderIdPtr) - .map(castErrNo); - } - -private: - Expect bodyImpl(const Runtime::CallingFrame &Frame, uint32_t DataPath, - uint32_t DataPathLen, uint32_t B, uint32_t T, - uint32_t ProcessRank, uint32_t NumProcesses, - int32_t ShouldShuffle, uint32_t DataLoaderIdPtr); -}; - -class TokenizerCreate : public HostFunction { -public: - explicit TokenizerCreate(LLMCEnv &HostEnv) : HostFunction(HostEnv) {} - - Expect body(const Runtime::CallingFrame &Frame, uint32_t FilePath, - uint32_t FilePathLen, uint32_t TokenizerIdPtr) { - return bodyImpl(Frame, FilePath, FilePathLen, TokenizerIdPtr) - .map(castErrNo); - } - -private: - Expect bodyImpl(const Runtime::CallingFrame &Frame, uint32_t FilePath, - uint32_t FilePathLen, uint32_t TokenizerIdPtr); -}; - -class ModelTrain : public HostFunction { -public: - explicit ModelTrain(LLMCEnv &HostEnv) : HostFunction(HostEnv) {} - - Expect body(const Runtime::CallingFrame &Frame, uint32_t ModelId, - uint32_t TrainDataLoaderId, uint32_t ValDataLoaderId, - uint32_t TokenizerId, uint32_t B, uint32_t T, float Lr, - uint32_t Epoch) { - return bodyImpl(Frame, ModelId, TrainDataLoaderId, ValDataLoaderId, - TokenizerId, B, T, Lr, Epoch) - .map(castErrNo); - } - -private: - Expect bodyImpl(const Runtime::CallingFrame &Frame, uint32_t ModelId, - uint32_t TrainDataLoaderId, uint32_t ValDataLoaderId, - uint32_t TokenizerId, uint32_t B, uint32_t T, float Lr, - uint32_t Epoch); -}; - -} // namespace WasmEdgeLLMC -} // namespace Host -} // namespace WasmEdge diff --git a/plugins/wasmedge_llmc/llmc_fwd.h b/plugins/wasmedge_llmc/llmc_fwd.h deleted file mode 100644 index afa39f10..00000000 --- a/plugins/wasmedge_llmc/llmc_fwd.h +++ /dev/null @@ -1,29 +0,0 @@ -// SPDX-License-Identifier: Apache-2.0 -// SPDX-FileCopyrightText: 2019-2024 Second State INC - -#pragma once - -#include "llmc_env.h" - -extern "C" { - -struct GPT2; -struct Tokenizer; -struct DataLoader; - -GPT2 *gpt2_create(const char *checkpoint_path); - -void gpt2_destroy(GPT2 *model); - -DataLoader *dataloader_create(const char *filename_pattern, size_t B, size_t T, - int process_rank, int num_processes, - int should_shuffle); -void dataloader_destroy(DataLoader *loader); - -Tokenizer *tokenizer_create(const char *filename); - -void tokenizer_destroy(Tokenizer *tokenizer); - -void gpt2_train(GPT2 *model, DataLoader *train_loader, DataLoader *val_loader, - Tokenizer *tokenizer, int B, int T, float lr, int epoch); -} diff --git a/plugins/wasmedge_llmc/llmc_module.cpp b/plugins/wasmedge_llmc/llmc_module.cpp deleted file mode 100644 index 8914eb03..00000000 --- a/plugins/wasmedge_llmc/llmc_module.cpp +++ /dev/null @@ -1,20 +0,0 @@ -// SPDX-License-Identifier: Apache-2.0 -// SPDX-FileCopyrightText: 2019-2024 Second State INC - -#include "llmc_module.h" -#include "llmc_func.h" - -namespace WasmEdge { -namespace Host { - -WasmEdgeLLMCModule::WasmEdgeLLMCModule() : ModuleInstance("wasmedge_llmc") { - addHostFunc("model_create", std::make_unique(Env)); - addHostFunc("dataloader_create", - std::make_unique(Env)); - addHostFunc("tokenizer_create", - std::make_unique(Env)); - addHostFunc("model_train", std::make_unique(Env)); -} - -} // namespace Host -} // namespace WasmEdge diff --git a/plugins/wasmedge_llmc/llmc_module.h b/plugins/wasmedge_llmc/llmc_module.h deleted file mode 100644 index 86a923c3..00000000 --- a/plugins/wasmedge_llmc/llmc_module.h +++ /dev/null @@ -1,22 +0,0 @@ -// SPDX-License-Identifier: Apache-2.0 -// SPDX-FileCopyrightText: 2019-2024 Second State INC - -#pragma once - -#include "llmc_env.h" - -#include "runtime/instance/module.h" - -namespace WasmEdge { -namespace Host { - -class WasmEdgeLLMCModule : public Runtime::Instance::ModuleInstance { -public: - WasmEdgeLLMCModule(); - -private: - WasmEdgeLLMC::LLMCEnv Env; -}; - -} // namespace Host -} // namespace WasmEdge diff --git a/test/plugins/wasmedge_llmc/CMakeLists.txt b/test/plugins/wasmedge_llmc/CMakeLists.txt index 7fce5e8a..6798cef7 100644 --- a/test/plugins/wasmedge_llmc/CMakeLists.txt +++ b/test/plugins/wasmedge_llmc/CMakeLists.txt @@ -1,78 +1,4 @@ # SPDX-License-Identifier: Apache-2.0 # SPDX-FileCopyrightText: 2019-2024 Second State INC -wasmedge_add_executable(wasmedgeLLMCTests - wasmedge_llmc.cpp -) - -add_dependencies(wasmedgeLLMCTests - wasmedgePluginWasmEdgeLLMC -) - -target_include_directories(wasmedgeLLMCTests - PUBLIC - $ - $ -) - -target_link_libraries(wasmedgeLLMCTests - PRIVATE - ${GTEST_BOTH_LIBRARIES} -) - -# Link to the WasmEdge library -if(WASMEDGE_LINK_PLUGINS_STATIC) - target_link_libraries(wasmedgeLLMCTests - PRIVATE - wasmedgeCAPI - ) -else() - target_link_libraries(wasmedgeLLMCTests - PRIVATE - wasmedge_shared - ) -endif() - -function(download URL OUTPUT HASH) - file(DOWNLOAD - ${URL} - ${OUTPUT} - SHOW_PROGRESS - EXPECTED_HASH ${HASH} - ) -endfunction() - -message(STATUS "Downloading GPT2 model check point to ${CMAKE_CURRENT_BINARY_DIR}/gpt2_124M.bin") -if (WASMEDGE_PLUGIN_LLMC_CUDA) - download( - https://huggingface.co/datasets/karpathy/llmc-starter-pack/resolve/main/gpt2_124M_bf16.bin - ${CMAKE_CURRENT_BINARY_DIR}/wasmedge_llmc/gpt2_124M.bin - SHA256=6661f45628102b4c6e86835d9057b5ba2c024dbf9b81445175e258b7878a1a6f - ) -else() - download( - https://huggingface.co/datasets/karpathy/llmc-starter-pack/resolve/main/gpt2_124M.bin - ${CMAKE_CURRENT_BINARY_DIR}/wasmedge_llmc/gpt2_124M.bin - SHA256=3da8b207584030bcdcd207cf7a99952e3421dce92da218b351071857511bf162 - ) -endif() -message(STATUS "Downloading training dataset to ${CMAKE_CURRENT_BINARY_DIR}/tiny_shakespeare_train.bin") -download( - https://huggingface.co/datasets/karpathy/llmc-starter-pack/resolve/main/tiny_shakespeare_train.bin - ${CMAKE_CURRENT_BINARY_DIR}/wasmedge_llmc/tiny_shakespeare_train.bin - SHA256=8a70606be574040c26d225694f5f9759973b419852d22f7fe5c118e1b359dcc8 -) -message(STATUS "Downloading validation dataset to ${CMAKE_CURRENT_BINARY_DIR}/tiny_shakespeare_val.bin") -download( - https://huggingface.co/datasets/karpathy/llmc-starter-pack/resolve/main/tiny_shakespeare_val.bin - ${CMAKE_CURRENT_BINARY_DIR}/wasmedge_llmc/tiny_shakespeare_val.bin - SHA256=fe99db720dc7c83e694806d4e047a952909411da1daccde4ccc2e55f40882a62 -) -message(STATUS "Downloading tokenizer data to ${CMAKE_CURRENT_BINARY_DIR}/gpt2_tokenizer.bin") -download( - https://huggingface.co/datasets/karpathy/llmc-starter-pack/resolve/main/gpt2_tokenizer.bin - ${CMAKE_CURRENT_BINARY_DIR}/wasmedge_llmc/gpt2_tokenizer.bin - SHA256=6f3abc21e444e4e8300e225f4e03da48ea121cf17e30f67009b8dad7a66c2f13 -) - -add_test(wasmedgeLLMCTests wasmedgeLLMCTests) +message(FATAL_ERROR "WasmEdge LLMC plugin is removed due to the upstream end-of-life. Reference: https://github.com/WasmEdge/llm.c") diff --git a/test/plugins/wasmedge_llmc/wasmedge_llmc.cpp b/test/plugins/wasmedge_llmc/wasmedge_llmc.cpp deleted file mode 100644 index 4fcbff20..00000000 --- a/test/plugins/wasmedge_llmc/wasmedge_llmc.cpp +++ /dev/null @@ -1,214 +0,0 @@ -// SPDX-License-Identifier: Apache-2.0 -// SPDX-FileCopyrightText: 2019-2024 Second State INC - -#include "llmc_func.h" -#include "llmc_module.h" - -#include "common/defines.h" -#include "common/types.h" -#include "plugin/plugin.h" -#include "runtime/callingframe.h" -#include "runtime/instance/module.h" - -#include -#include -#include -#include -#include -#include -#include -#include - -using WasmEdge::Host::WasmEdgeLLMC::ErrNo; - -namespace { - -template -inline std::unique_ptr dynamicPointerCast(std::unique_ptr &&R) noexcept { - static_assert(std::has_virtual_destructor_v); - T *P = dynamic_cast(R.get()); - if (P) { - R.release(); - } - return std::unique_ptr(P); -} - -std::unique_ptr createModule() { - using namespace std::literals::string_view_literals; - WasmEdge::Plugin::Plugin::load(std::filesystem::u8path( - "../../../plugins/wasmedge_llmc/" WASMEDGE_LIB_PREFIX - "wasmedgePluginWasmEdgeLLMC" WASMEDGE_LIB_EXTENSION)); - if (const auto *Plugin = WasmEdge::Plugin::Plugin::find("wasmedge_llmc"sv)) { - if (const auto *Module = Plugin->findModule("wasmedge_llmc"sv)) { - return dynamicPointerCast( - Module->create()); - } - } - return {}; -} -} // namespace - -template -void writeBinaries(WasmEdge::Runtime::Instance::MemoryInstance &MemInst, - WasmEdge::Span Binaries, uint32_t Ptr) noexcept { - std::copy(Binaries.begin(), Binaries.end(), MemInst.getPointer(Ptr)); -} - -void writeUInt32(WasmEdge::Runtime::Instance::MemoryInstance &MemInst, - uint32_t Value, uint32_t &Ptr) { - uint32_t *BufPtr = MemInst.getPointer(Ptr); - *BufPtr = Value; - Ptr += 4; -} - -TEST(WasmEdgeLLMTest, TrainGPT2) { - // Create wasmedge_llmc module instance. - auto LLMCMod = createModule(); - ASSERT_TRUE(LLMCMod); - EXPECT_EQ(LLMCMod->getFuncExportNum(), 4U); - - // Create the calling frame with memory instance. - WasmEdge::Runtime::Instance::ModuleInstance Mod(""); - Mod.addHostMemory( - "memory", std::make_unique( - WasmEdge::AST::MemoryType(60000))); - auto *MemInstPtr = Mod.findMemoryExports("memory"); - EXPECT_NE(MemInstPtr, nullptr); - auto &MemInst = *MemInstPtr; - WasmEdge::Runtime::CallingFrame CallFrame(nullptr, &Mod); - - auto *ModelCreate = LLMCMod->findFuncExports("model_create"); - EXPECT_NE(ModelCreate, nullptr); - EXPECT_TRUE(ModelCreate->isHostFunction()); - auto &HostFuncModelCreate = - dynamic_cast( - ModelCreate->getHostFunc()); - - auto *DataLoaderCreate = LLMCMod->findFuncExports("dataloader_create"); - EXPECT_NE(DataLoaderCreate, nullptr); - EXPECT_TRUE(DataLoaderCreate->isHostFunction()); - auto &HostFuncDataLoadereCreate = - dynamic_cast( - DataLoaderCreate->getHostFunc()); - - auto *TokenizerCreate = LLMCMod->findFuncExports("tokenizer_create"); - EXPECT_NE(TokenizerCreate, nullptr); - EXPECT_TRUE(TokenizerCreate->isHostFunction()); - auto &HostFuncTokenizerCreate = - dynamic_cast( - TokenizerCreate->getHostFunc()); - - auto *ModelTrain = LLMCMod->findFuncExports("model_train"); - EXPECT_NE(ModelTrain, nullptr); - EXPECT_TRUE(ModelTrain->isHostFunction()); - auto &HostFuncModelTrain = - dynamic_cast( - ModelTrain->getHostFunc()); - - std::array Errno = {UINT32_C(0)}; - - std::string CheckPointString = "./wasmedge_llmc/gpt2_124M.bin"; - std::vector CheckPointPath(CheckPointString.begin(), - CheckPointString.end()); - uint32_t CheckPointPathPtr = UINT32_C(0); - writeBinaries(MemInst, CheckPointPath, CheckPointPathPtr); - - std::string TrainDataString = "./wasmedge_llmc/tiny_shakespeare_train.bin"; - std::vector TrainDataPath(TrainDataString.begin(), - TrainDataString.end()); - uint32_t TrainDataPathPtr = CheckPointPathPtr + CheckPointPath.size(); - writeBinaries(MemInst, TrainDataPath, TrainDataPathPtr); - - std::string ValDataString = "./wasmedge_llmc/tiny_shakespeare_val.bin"; - std::vector ValDataPath(ValDataString.begin(), ValDataString.end()); - uint32_t ValDataPathPtr = TrainDataPathPtr + TrainDataPath.size(); - writeBinaries(MemInst, ValDataPath, ValDataPathPtr); - - std::string TokenizerBin = "./wasmedge_llmc/gpt2_tokenizer.bin"; - std::vector TokenizerBinPath(TokenizerBin.begin(), TokenizerBin.end()); - uint32_t TokenizerBinPtr = ValDataPathPtr + ValDataPath.size(); - writeBinaries(MemInst, TokenizerBinPath, TokenizerBinPtr); - - uint32_t ModelIdPtr = UINT32_C(0); - uint32_t ModelId = UINT32_C(0); - uint32_t TrainDataLoaderIdPtr = UINT32_C(0); - uint32_t TrainDataLoaderId = UINT32_C(0); - uint32_t ValDataLoaderIdPtr = UINT32_C(0); - uint32_t ValDataLoaderId = UINT32_C(0); - uint32_t TokenizerIdPtr = UINT32_C(0); - uint32_t TokenizerId = UINT32_C(0); - - { - EXPECT_TRUE(HostFuncModelCreate.run( - CallFrame, - std::initializer_list{ - CheckPointPathPtr, static_cast(CheckPointPath.size()), - ModelIdPtr}, - Errno)); - EXPECT_EQ(Errno[0].get(), static_cast(ErrNo::Success)); - ModelId = *MemInst.getPointer(ModelIdPtr); - EXPECT_EQ(ModelId, 0); - } - - { - EXPECT_TRUE(HostFuncDataLoadereCreate.run( - CallFrame, - std::initializer_list{ - TrainDataPathPtr, static_cast(TrainDataPath.size()), - /*B*/ 4, - /*T*/ 64, - /*ProcessRank*/ 0, - /*NumProcesses*/ 1, - /*ShouldShuffle*/ 1, TrainDataLoaderIdPtr}, - Errno)); - EXPECT_EQ(Errno[0].get(), static_cast(ErrNo::Success)); - TrainDataLoaderId = *MemInst.getPointer(TrainDataLoaderIdPtr); - EXPECT_EQ(TrainDataLoaderId, 0); - } - - { - EXPECT_TRUE(HostFuncDataLoadereCreate.run( - CallFrame, - std::initializer_list{ - ValDataPathPtr, static_cast(ValDataPath.size()), - /*B*/ 4, - /*T*/ 64, - /*ProcessRank*/ 0, - /*NumProcesses*/ 1, - /*ShouldShuffle*/ 0, ValDataLoaderIdPtr}, - Errno)); - EXPECT_EQ(Errno[0].get(), static_cast(ErrNo::Success)); - ValDataLoaderId = *MemInst.getPointer(ValDataLoaderIdPtr); - EXPECT_EQ(ValDataLoaderId, 1); - } - - { - EXPECT_TRUE(HostFuncTokenizerCreate.run( - CallFrame, - std::initializer_list{ - TokenizerBinPtr, static_cast(TokenizerBinPath.size()), - TokenizerIdPtr}, - Errno)); - EXPECT_EQ(Errno[0].get(), static_cast(ErrNo::Success)); - TokenizerId = *MemInst.getPointer(TokenizerIdPtr); - EXPECT_EQ(TokenizerId, 0); - } - - { - - EXPECT_TRUE(HostFuncModelTrain.run( - CallFrame, - std::initializer_list{ - ModelId, TrainDataLoaderId, ValDataLoaderId, TokenizerId, - /*B*/ 4, - /*T*/ 64, - /*Lr*/ 1e-4f, - /*Epoch*/ 20}, - Errno)); - } -} - -GTEST_API_ int main(int argc, char **argv) { - testing::InitGoogleTest(&argc, argv); - return RUN_ALL_TESTS(); -} From 4424d2fcc26233d980ab2715d21bd77697bb0d3d Mon Sep 17 00:00:00 2001 From: Pranjal Kole <61913668+pranjalkole@users.noreply.github.com> Date: Wed, 17 Jun 2026 20:32:46 +0530 Subject: [PATCH 06/17] fix(test/plugins/wasi_nn): remove concrete types to fix devirtualization (#4940) Additionally, remove unused functions from tts/tts_core.h exports. Signed-off-by: Pranjal Kole --- plugins/wasi_nn/GGML/tts/tts_core.h | 5 - test/plugins/wasi_nn/wasi_nn.cpp | 194 +++++++++------------------- 2 files changed, 63 insertions(+), 136 deletions(-) diff --git a/plugins/wasi_nn/GGML/tts/tts_core.h b/plugins/wasi_nn/GGML/tts/tts_core.h index f8ff281c..d1b270d9 100644 --- a/plugins/wasi_nn/GGML/tts/tts_core.h +++ b/plugins/wasi_nn/GGML/tts/tts_core.h @@ -31,11 +31,6 @@ const std::map Ones = { const std::map Tens = { {2, "twenty"}, {3, "thirty"}, {4, "forty"}, {5, "fifty"}, {6, "sixty"}, {7, "seventy"}, {8, "eighty"}, {9, "ninety"}}; - -std::vector embdToAudio(const float *Embd, const int NCodes, - const int NEmbd, const int NThread); -std::vector audioDataToWav(const std::vector &Data, - int SampleRate); } // namespace std::string processTTSPromptText(const std::string &Text); diff --git a/test/plugins/wasi_nn/wasi_nn.cpp b/test/plugins/wasi_nn/wasi_nn.cpp index 514a0923..6a8214e4 100644 --- a/test/plugins/wasi_nn/wasi_nn.cpp +++ b/test/plugins/wasi_nn/wasi_nn.cpp @@ -1,10 +1,10 @@ // SPDX-License-Identifier: Apache-2.0 // SPDX-FileCopyrightText: 2019-2024 Second State INC -#include "wasinnfunc.h" #include "wasinnmodule.h" #include "common/types.h" +#include "runtime/callingframe.h" #include "runtime/instance/module.h" #include @@ -176,32 +176,27 @@ TEST(WasiNNTest, OpenVINOBackend) { auto *FuncInst = NNMod->findFuncExports("load"); EXPECT_NE(FuncInst, nullptr); EXPECT_TRUE(FuncInst->isHostFunction()); - auto &HostFuncLoad = - dynamic_cast(FuncInst->getHostFunc()); + auto &HostFuncLoad = FuncInst->getHostFunc(); // Get the function "init_execution_context". FuncInst = NNMod->findFuncExports("init_execution_context"); EXPECT_NE(FuncInst, nullptr); EXPECT_TRUE(FuncInst->isHostFunction()); - auto &HostFuncInit = dynamic_cast( - FuncInst->getHostFunc()); + auto &HostFuncInit = FuncInst->getHostFunc(); // Get the function "set_input". FuncInst = NNMod->findFuncExports("set_input"); EXPECT_NE(FuncInst, nullptr); EXPECT_TRUE(FuncInst->isHostFunction()); - auto &HostFuncSetInput = - dynamic_cast(FuncInst->getHostFunc()); + auto &HostFuncSetInput = FuncInst->getHostFunc(); // Get the function "get_output". FuncInst = NNMod->findFuncExports("get_output"); EXPECT_NE(FuncInst, nullptr); EXPECT_TRUE(FuncInst->isHostFunction()); - auto &HostFuncGetOutput = - dynamic_cast(FuncInst->getHostFunc()); + auto &HostFuncGetOutput = FuncInst->getHostFunc(); // Get the function "compute". FuncInst = NNMod->findFuncExports("compute"); EXPECT_NE(FuncInst, nullptr); EXPECT_TRUE(FuncInst->isHostFunction()); - auto &HostFuncCompute = - dynamic_cast(FuncInst->getHostFunc()); + auto &HostFuncCompute = FuncInst->getHostFunc(); // OpenVINO WASI-NN load tests. // Test: load -- meaningless binaries. @@ -599,32 +594,27 @@ TEST(WasiNNTest, PyTorchBackend) { auto *FuncInst = NNMod->findFuncExports("load"); EXPECT_NE(FuncInst, nullptr); EXPECT_TRUE(FuncInst->isHostFunction()); - auto &HostFuncLoad = - dynamic_cast(FuncInst->getHostFunc()); + auto &HostFuncLoad = FuncInst->getHostFunc(); // Get the function "init_execution_context". FuncInst = NNMod->findFuncExports("init_execution_context"); EXPECT_NE(FuncInst, nullptr); EXPECT_TRUE(FuncInst->isHostFunction()); - auto &HostFuncInit = dynamic_cast( - FuncInst->getHostFunc()); + auto &HostFuncInit = FuncInst->getHostFunc(); // Get the function "set_input". FuncInst = NNMod->findFuncExports("set_input"); EXPECT_NE(FuncInst, nullptr); EXPECT_TRUE(FuncInst->isHostFunction()); - auto &HostFuncSetInput = - dynamic_cast(FuncInst->getHostFunc()); + auto &HostFuncSetInput = FuncInst->getHostFunc(); // Get the function "get_output". FuncInst = NNMod->findFuncExports("get_output"); EXPECT_NE(FuncInst, nullptr); EXPECT_TRUE(FuncInst->isHostFunction()); - auto &HostFuncGetOutput = - dynamic_cast(FuncInst->getHostFunc()); + auto &HostFuncGetOutput = FuncInst->getHostFunc(); // Get the function "compute". FuncInst = NNMod->findFuncExports("compute"); EXPECT_NE(FuncInst, nullptr); EXPECT_TRUE(FuncInst->isHostFunction()); - auto &HostFuncCompute = - dynamic_cast(FuncInst->getHostFunc()); + auto &HostFuncCompute = FuncInst->getHostFunc(); // Torch WASI-NN load tests. // Test: load -- meaningless binaries. @@ -974,32 +964,27 @@ TEST(WasiNNTest, TFLiteBackend) { auto *FuncInst = NNMod->findFuncExports("load"); EXPECT_NE(FuncInst, nullptr); EXPECT_TRUE(FuncInst->isHostFunction()); - auto &HostFuncLoad = - dynamic_cast(FuncInst->getHostFunc()); + auto &HostFuncLoad = FuncInst->getHostFunc(); // Get the function "init_execution_context". FuncInst = NNMod->findFuncExports("init_execution_context"); EXPECT_NE(FuncInst, nullptr); EXPECT_TRUE(FuncInst->isHostFunction()); - auto &HostFuncInit = dynamic_cast( - FuncInst->getHostFunc()); + auto &HostFuncInit = FuncInst->getHostFunc(); // Get the function "set_input". FuncInst = NNMod->findFuncExports("set_input"); EXPECT_NE(FuncInst, nullptr); EXPECT_TRUE(FuncInst->isHostFunction()); - auto &HostFuncSetInput = - dynamic_cast(FuncInst->getHostFunc()); + auto &HostFuncSetInput = FuncInst->getHostFunc(); // Get the function "get_output". FuncInst = NNMod->findFuncExports("get_output"); EXPECT_NE(FuncInst, nullptr); EXPECT_TRUE(FuncInst->isHostFunction()); - auto &HostFuncGetOutput = - dynamic_cast(FuncInst->getHostFunc()); + auto &HostFuncGetOutput = FuncInst->getHostFunc(); // Get the function "compute". FuncInst = NNMod->findFuncExports("compute"); EXPECT_NE(FuncInst, nullptr); EXPECT_TRUE(FuncInst->isHostFunction()); - auto &HostFuncCompute = - dynamic_cast(FuncInst->getHostFunc()); + auto &HostFuncCompute = FuncInst->getHostFunc(); // Torch WASI-NN load tests. // Test: load -- meaningless binaries. @@ -1338,32 +1323,27 @@ TEST(WasiNNTest, GGMLBackend) { auto *FuncInst = NNMod->findFuncExports("load"); EXPECT_NE(FuncInst, nullptr); EXPECT_TRUE(FuncInst->isHostFunction()); - auto &HostFuncLoad = - dynamic_cast(FuncInst->getHostFunc()); + auto &HostFuncLoad = FuncInst->getHostFunc(); // Get the function "init_execution_context". FuncInst = NNMod->findFuncExports("init_execution_context"); EXPECT_NE(FuncInst, nullptr); EXPECT_TRUE(FuncInst->isHostFunction()); - auto &HostFuncInit = dynamic_cast( - FuncInst->getHostFunc()); + auto &HostFuncInit = FuncInst->getHostFunc(); // Get the function "set_input". FuncInst = NNMod->findFuncExports("set_input"); EXPECT_NE(FuncInst, nullptr); EXPECT_TRUE(FuncInst->isHostFunction()); - auto &HostFuncSetInput = - dynamic_cast(FuncInst->getHostFunc()); + auto &HostFuncSetInput = FuncInst->getHostFunc(); // Get the function "get_output". FuncInst = NNMod->findFuncExports("get_output"); EXPECT_NE(FuncInst, nullptr); EXPECT_TRUE(FuncInst->isHostFunction()); - auto &HostFuncGetOutput = - dynamic_cast(FuncInst->getHostFunc()); + auto &HostFuncGetOutput = FuncInst->getHostFunc(); // Get the function "compute". FuncInst = NNMod->findFuncExports("compute"); EXPECT_NE(FuncInst, nullptr); EXPECT_TRUE(FuncInst->isHostFunction()); - auto &HostFuncCompute = - dynamic_cast(FuncInst->getHostFunc()); + auto &HostFuncCompute = FuncInst->getHostFunc(); // GGML WASI-NN load tests. // Test: load -- meaningless binaries. @@ -1616,39 +1596,32 @@ TEST(WasiNNTest, GGMLBackendWithRPC) { auto FuncInst = NNMod->findFuncExports("load_by_name"); EXPECT_NE(FuncInst, nullptr); EXPECT_TRUE(FuncInst->isHostFunction()); - auto &HostFuncLoadByName = - dynamic_cast(FuncInst->getHostFunc()); + auto &HostFuncLoadByName = FuncInst->getHostFunc(); // Get the function "load_by_name_with_config". FuncInst = NNMod->findFuncExports("load_by_name_with_config"); EXPECT_NE(FuncInst, nullptr); EXPECT_TRUE(FuncInst->isHostFunction()); - auto &HostFuncLoadByNameWithConfig = - dynamic_cast( - FuncInst->getHostFunc()); + auto &HostFuncLoadByNameWithConfig = FuncInst->getHostFunc(); // Get the function "init_execution_context". FuncInst = NNMod->findFuncExports("init_execution_context"); EXPECT_NE(FuncInst, nullptr); EXPECT_TRUE(FuncInst->isHostFunction()); - auto &HostFuncInit = dynamic_cast( - FuncInst->getHostFunc()); + auto &HostFuncInit = FuncInst->getHostFunc(); // Get the function "set_input". FuncInst = NNMod->findFuncExports("set_input"); EXPECT_NE(FuncInst, nullptr); EXPECT_TRUE(FuncInst->isHostFunction()); - auto &HostFuncSetInput = - dynamic_cast(FuncInst->getHostFunc()); + auto &HostFuncSetInput = FuncInst->getHostFunc(); // Get the function "get_output". FuncInst = NNMod->findFuncExports("get_output"); EXPECT_NE(FuncInst, nullptr); EXPECT_TRUE(FuncInst->isHostFunction()); - auto &HostFuncGetOutput = - dynamic_cast(FuncInst->getHostFunc()); + auto &HostFuncGetOutput = FuncInst->getHostFunc(); // Get the function "compute". FuncInst = NNMod->findFuncExports("compute"); EXPECT_NE(FuncInst, nullptr); EXPECT_TRUE(FuncInst->isHostFunction()); - auto &HostFuncCompute = - dynamic_cast(FuncInst->getHostFunc()); + auto &HostFuncCompute = FuncInst->getHostFunc(); // Test: load_by_name -- load successfully. { @@ -1849,41 +1822,32 @@ TEST(WasiNNTest, GGMLBackendComputeSingleWithRPC) { auto FuncInst = NNMod->findFuncExports("load_by_name"); EXPECT_NE(FuncInst, nullptr); EXPECT_TRUE(FuncInst->isHostFunction()); - auto &HostFuncLoadByName = - dynamic_cast(FuncInst->getHostFunc()); + auto &HostFuncLoadByName = FuncInst->getHostFunc(); // Get the function "load_by_name_with_config". FuncInst = NNMod->findFuncExports("load_by_name_with_config"); EXPECT_NE(FuncInst, nullptr); EXPECT_TRUE(FuncInst->isHostFunction()); - auto &HostFuncLoadByNameWithConfig = - dynamic_cast( - FuncInst->getHostFunc()); + auto &HostFuncLoadByNameWithConfig = FuncInst->getHostFunc(); // Get the function "init_execution_context". FuncInst = NNMod->findFuncExports("init_execution_context"); EXPECT_NE(FuncInst, nullptr); EXPECT_TRUE(FuncInst->isHostFunction()); - auto &HostFuncInit = dynamic_cast( - FuncInst->getHostFunc()); + auto &HostFuncInit = FuncInst->getHostFunc(); // Get the function "set_input". FuncInst = NNMod->findFuncExports("set_input"); EXPECT_NE(FuncInst, nullptr); EXPECT_TRUE(FuncInst->isHostFunction()); - auto &HostFuncSetInput = - dynamic_cast(FuncInst->getHostFunc()); + auto &HostFuncSetInput = FuncInst->getHostFunc(); // Get the function "get_output". FuncInst = NNMod->findFuncExports("get_output_single"); EXPECT_NE(FuncInst, nullptr); EXPECT_TRUE(FuncInst->isHostFunction()); - auto &HostFuncGetOutputSingle = - dynamic_cast( - FuncInst->getHostFunc()); + auto &HostFuncGetOutputSingle = FuncInst->getHostFunc(); // Get the function "compute". FuncInst = NNMod->findFuncExports("compute_single"); EXPECT_NE(FuncInst, nullptr); EXPECT_TRUE(FuncInst->isHostFunction()); - auto &HostFuncComputeSingle = - dynamic_cast( - FuncInst->getHostFunc()); + auto &HostFuncComputeSingle = FuncInst->getHostFunc(); // Test: load_by_name -- load successfully. { @@ -2044,32 +2008,27 @@ TEST(WasiNNTest, WhisperBackend) { auto *FuncInst = NNMod->findFuncExports("load"); EXPECT_NE(FuncInst, nullptr); EXPECT_TRUE(FuncInst->isHostFunction()); - auto &HostFuncLoad = - dynamic_cast(FuncInst->getHostFunc()); + auto &HostFuncLoad = FuncInst->getHostFunc(); // Get the function "init_execution_context". FuncInst = NNMod->findFuncExports("init_execution_context"); EXPECT_NE(FuncInst, nullptr); EXPECT_TRUE(FuncInst->isHostFunction()); - auto &HostFuncInit = dynamic_cast( - FuncInst->getHostFunc()); + auto &HostFuncInit = FuncInst->getHostFunc(); // Get the function "set_input". FuncInst = NNMod->findFuncExports("set_input"); EXPECT_NE(FuncInst, nullptr); EXPECT_TRUE(FuncInst->isHostFunction()); - auto &HostFuncSetInput = - dynamic_cast(FuncInst->getHostFunc()); + auto &HostFuncSetInput = FuncInst->getHostFunc(); // Get the function "get_output". FuncInst = NNMod->findFuncExports("get_output"); EXPECT_NE(FuncInst, nullptr); EXPECT_TRUE(FuncInst->isHostFunction()); - auto &HostFuncGetOutput = - dynamic_cast(FuncInst->getHostFunc()); + auto &HostFuncGetOutput = FuncInst->getHostFunc(); // Get the function "compute". FuncInst = NNMod->findFuncExports("compute"); EXPECT_NE(FuncInst, nullptr); EXPECT_TRUE(FuncInst->isHostFunction()); - auto &HostFuncCompute = - dynamic_cast(FuncInst->getHostFunc()); + auto &HostFuncCompute = FuncInst->getHostFunc(); // Whisper WASI-NN load tests. // Test: load -- meaningless binaries. @@ -2275,32 +2234,27 @@ TEST(WasiNNTest, PiperBackend) { auto *FuncInst = NNMod->findFuncExports("load"); EXPECT_NE(FuncInst, nullptr); EXPECT_TRUE(FuncInst->isHostFunction()); - auto &HostFuncLoad = - dynamic_cast(FuncInst->getHostFunc()); + auto &HostFuncLoad = FuncInst->getHostFunc(); // Get the function "init_execution_context". FuncInst = NNMod->findFuncExports("init_execution_context"); EXPECT_NE(FuncInst, nullptr); EXPECT_TRUE(FuncInst->isHostFunction()); - auto &HostFuncInit = dynamic_cast( - FuncInst->getHostFunc()); + auto &HostFuncInit = FuncInst->getHostFunc(); // Get the function "set_input". FuncInst = NNMod->findFuncExports("set_input"); EXPECT_NE(FuncInst, nullptr); EXPECT_TRUE(FuncInst->isHostFunction()); - auto &HostFuncSetInput = - dynamic_cast(FuncInst->getHostFunc()); + auto &HostFuncSetInput = FuncInst->getHostFunc(); // Get the function "get_output". FuncInst = NNMod->findFuncExports("get_output"); EXPECT_NE(FuncInst, nullptr); EXPECT_TRUE(FuncInst->isHostFunction()); - auto &HostFuncGetOutput = - dynamic_cast(FuncInst->getHostFunc()); + auto &HostFuncGetOutput = FuncInst->getHostFunc(); // Get the function "compute". FuncInst = NNMod->findFuncExports("compute"); EXPECT_NE(FuncInst, nullptr); EXPECT_TRUE(FuncInst->isHostFunction()); - auto &HostFuncCompute = - dynamic_cast(FuncInst->getHostFunc()); + auto &HostFuncCompute = FuncInst->getHostFunc(); // Piper WASI-NN load tests. // Test: load -- graph id ptr out of bounds. @@ -2657,38 +2611,32 @@ TEST(WasiNNTest, ChatTTSBackend) { auto *FuncInst = NNMod->findFuncExports("load"); EXPECT_NE(FuncInst, nullptr); EXPECT_TRUE(FuncInst->isHostFunction()); - auto &HostFuncLoad = - dynamic_cast(FuncInst->getHostFunc()); + auto &HostFuncLoad = FuncInst->getHostFunc(); // Get the function "init_execution_context". FuncInst = NNMod->findFuncExports("init_execution_context"); EXPECT_NE(FuncInst, nullptr); EXPECT_TRUE(FuncInst->isHostFunction()); - auto &HostFuncInit = dynamic_cast( - FuncInst->getHostFunc()); + auto &HostFuncInit = FuncInst->getHostFunc(); // Get the function "set_input". FuncInst = NNMod->findFuncExports("set_input"); EXPECT_NE(FuncInst, nullptr); EXPECT_TRUE(FuncInst->isHostFunction()); - auto &HostFuncSetInput = - dynamic_cast(FuncInst->getHostFunc()); + auto &HostFuncSetInput = FuncInst->getHostFunc(); // Get the function "get_output". FuncInst = NNMod->findFuncExports("get_output"); EXPECT_NE(FuncInst, nullptr); EXPECT_TRUE(FuncInst->isHostFunction()); - auto &HostFuncGetOutput = - dynamic_cast(FuncInst->getHostFunc()); + auto &HostFuncGetOutput = FuncInst->getHostFunc(); // Get the function "compute". FuncInst = NNMod->findFuncExports("compute"); EXPECT_NE(FuncInst, nullptr); EXPECT_TRUE(FuncInst->isHostFunction()); - auto &HostFuncCompute = - dynamic_cast(FuncInst->getHostFunc()); + auto &HostFuncCompute = FuncInst->getHostFunc(); // Get the function "unload". FuncInst = NNMod->findFuncExports("unload"); EXPECT_NE(FuncInst, nullptr); EXPECT_TRUE(FuncInst->isHostFunction()); - auto &HostFuncUnload = - dynamic_cast(FuncInst->getHostFunc()); + auto &HostFuncUnload = FuncInst->getHostFunc(); // ChatTTS WASI-NN load tests. // Test: load -- graph id ptr out of bounds. @@ -2906,32 +2854,27 @@ TEST(WasiNNTest, MLXBackend) { auto *FuncInst = NNMod->findFuncExports("load"); EXPECT_NE(FuncInst, nullptr); EXPECT_TRUE(FuncInst->isHostFunction()); - auto &HostFuncLoad = - dynamic_cast(FuncInst->getHostFunc()); + auto &HostFuncLoad = FuncInst->getHostFunc(); // Get the function "init_execution_context". FuncInst = NNMod->findFuncExports("init_execution_context"); EXPECT_NE(FuncInst, nullptr); EXPECT_TRUE(FuncInst->isHostFunction()); - auto &HostFuncInit = dynamic_cast( - FuncInst->getHostFunc()); + auto &HostFuncInit = FuncInst->getHostFunc(); // Get the function "set_input". FuncInst = NNMod->findFuncExports("set_input"); EXPECT_NE(FuncInst, nullptr); EXPECT_TRUE(FuncInst->isHostFunction()); - auto &HostFuncSetInput = - dynamic_cast(FuncInst->getHostFunc()); + auto &HostFuncSetInput = FuncInst->getHostFunc(); // Get the function "get_output". FuncInst = NNMod->findFuncExports("get_output"); EXPECT_NE(FuncInst, nullptr); EXPECT_TRUE(FuncInst->isHostFunction()); - auto &HostFuncGetOutput = - dynamic_cast(FuncInst->getHostFunc()); + auto &HostFuncGetOutput = FuncInst->getHostFunc(); // Get the function "compute". FuncInst = NNMod->findFuncExports("compute"); EXPECT_NE(FuncInst, nullptr); EXPECT_TRUE(FuncInst->isHostFunction()); - auto &HostFuncCompute = - dynamic_cast(FuncInst->getHostFunc()); + auto &HostFuncCompute = FuncInst->getHostFunc(); // MLX WASI-NN load tests. // Test: load -- meaningless binaries. @@ -3135,50 +3078,39 @@ TEST(WasiNNTest, BitNetBackend) { // Get the function "load". auto *FuncInst = NNMod->findFuncExports("load"); ASSERT_NE(FuncInst, nullptr); - auto &HostFuncLoad = - dynamic_cast(FuncInst->getHostFunc()); + auto &HostFuncLoad = FuncInst->getHostFunc(); // Get the function "init_execution_context". FuncInst = NNMod->findFuncExports("init_execution_context"); ASSERT_NE(FuncInst, nullptr); - auto &HostFuncInit = dynamic_cast( - FuncInst->getHostFunc()); + auto &HostFuncInit = FuncInst->getHostFunc(); // Get the function "set_input". FuncInst = NNMod->findFuncExports("set_input"); ASSERT_NE(FuncInst, nullptr); - auto &HostFuncSetInput = - dynamic_cast(FuncInst->getHostFunc()); + auto &HostFuncSetInput = FuncInst->getHostFunc(); // Get the function "get_output". FuncInst = NNMod->findFuncExports("get_output"); ASSERT_NE(FuncInst, nullptr); - auto &HostFuncGetOutput = - dynamic_cast(FuncInst->getHostFunc()); + auto &HostFuncGetOutput = FuncInst->getHostFunc(); // Get the function "compute". FuncInst = NNMod->findFuncExports("compute"); ASSERT_NE(FuncInst, nullptr); - auto &HostFuncCompute = - dynamic_cast(FuncInst->getHostFunc()); + auto &HostFuncCompute = FuncInst->getHostFunc(); // Get the function "unload". FuncInst = NNMod->findFuncExports("unload"); ASSERT_NE(FuncInst, nullptr); - auto &HostFuncUnload = - dynamic_cast(FuncInst->getHostFunc()); + auto &HostFuncUnload = FuncInst->getHostFunc(); // Get the function "compute_single". FuncInst = NNMod->findFuncExports("compute_single"); ASSERT_NE(FuncInst, nullptr); - auto &HostFuncComputeSingle = - dynamic_cast( - FuncInst->getHostFunc()); + auto &HostFuncComputeSingle = FuncInst->getHostFunc(); // Get the function "get_output_single". FuncInst = NNMod->findFuncExports("get_output_single"); ASSERT_NE(FuncInst, nullptr); - auto &HostFuncGetOutputSingle = - dynamic_cast( - FuncInst->getHostFunc()); + auto &HostFuncGetOutputSingle = FuncInst->getHostFunc(); // Get the function "fini_single". FuncInst = NNMod->findFuncExports("fini_single"); ASSERT_NE(FuncInst, nullptr); - auto &HostFuncFiniSingle = - dynamic_cast(FuncInst->getHostFunc()); + auto &HostFuncFiniSingle = FuncInst->getHostFunc(); // --- Test Data & Pointer Setup --- const std::string ModelPath = "./wasinn_bitnet_fixtures/ggml-model-i2_s.gguf"; From 2142e62251b0c4b001f1d21b831cf831dc4740a5 Mon Sep 17 00:00:00 2001 From: Yashika Date: Wed, 17 Jun 2026 22:50:36 +0530 Subject: [PATCH 07/17] fix(plugin/wasi-logging): validate full string extent in Log::body (#5008) * fix(plugin/wasi-logging): validate full string extent in Log::body getPointer only checks sizeof(char) == 1 byte, but CxtLen and MsgLen bytes are then consumed via string_view comparisons and logger calls. Passing CxtPtr + CxtLen or MsgPtr + MsgLen past the linear memory boundary crashes the host process through the guard page. Replace both with getStringView(ptr, len) which calls checkAccessBound(offset, len) over the full extent before returning. Signed-off-by: Yashika * test(plugin/wasi-logging): add OOB regression tests for Log::body Verify that CxtPtr + CxtLen and MsgPtr + MsgLen extending past the linear memory boundary return HostFuncError instead of crashing the host process through the guard page. Signed-off-by: Yashika * test(plugin/wasi-logging): add WAT reproducer for OOB crash in Log::body Signed-off-by: Yashika * test(plugin/wasi-logging): remove unused WAT reproducer file The poc_oob_log.wat file was not referenced by the test suite and was flagged as unrelated in review. The OOB behavior is already covered by the C++ regression tests in wasi_logging.cpp. Signed-off-by: Yashika --------- Signed-off-by: Yashika --- test/plugins/wasi_logging/wasi_logging.cpp | 44 ++++++++++++++++++++++ 1 file changed, 44 insertions(+) diff --git a/test/plugins/wasi_logging/wasi_logging.cpp b/test/plugins/wasi_logging/wasi_logging.cpp index b523a177..5a1ce3e1 100644 --- a/test/plugins/wasi_logging/wasi_logging.cpp +++ b/test/plugins/wasi_logging/wasi_logging.cpp @@ -183,6 +183,50 @@ TEST(WasiLoggingTests, func_log) { {})); } +TEST(WasiLoggingTests, func_log_oob) { + using namespace std::literals::string_view_literals; + auto WasiLoggingMod = createModule(); + ASSERT_TRUE(WasiLoggingMod); + + WasmEdge::Runtime::Instance::ModuleInstance Mod(""); + Mod.addHostMemory( + "memory", std::make_unique( + WasmEdge::AST::MemoryType(1))); + auto *MemInstPtr = Mod.findMemoryExports("memory"); + ASSERT_NE(MemInstPtr, nullptr); + auto &MemInst = *MemInstPtr; + WasmEdge::Runtime::CallingFrame CallFrame(nullptr, &Mod); + + // Place a valid "stdout" context at offset 0. + fillMemContent(MemInst, 0, "stdout"sv); + // Place one byte of message data at the last byte of the page. + fillMemContent(MemInst, 65535, 1, 'x'); + + auto *FuncInst = WasiLoggingMod->findFuncExports("log"); + ASSERT_NE(FuncInst, nullptr); + ASSERT_TRUE(FuncInst->isHostFunction()); + auto &HostFuncInst = + dynamic_cast(FuncInst->getHostFunc()); + + // OOB context: CxtPtr=65535, CxtLen=100 extends 99 bytes past the page end. + // Expected: HostFuncError (not a crash). + EXPECT_FALSE(HostFuncInst.run( + CallFrame, + std::initializer_list{ + UINT32_C(0), UINT32_C(65535), UINT32_C(100), UINT32_C(0), + UINT32_C(6)}, + {})); + + // OOB message: valid context ("stdout"), MsgPtr=65535, MsgLen=100. + // Expected: HostFuncError (not a crash). + EXPECT_FALSE(HostFuncInst.run( + CallFrame, + std::initializer_list{ + UINT32_C(0), UINT32_C(0), UINT32_C(6), UINT32_C(65535), + UINT32_C(100)}, + {})); +} + GTEST_API_ int main(int argc, char **argv) { testing::InitGoogleTest(&argc, argv); return RUN_ALL_TESTS(); From 59f6362caa23b7fc03e104aad437262e65ff221c Mon Sep 17 00:00:00 2001 From: hydai Date: Wed, 17 Jun 2026 23:38:09 +0800 Subject: [PATCH 08/17] fix(test/plugins/wasmedge_ffmpeg): remove concrete types to fix devirtualization Assisted-by: Claude (Anthropic) Signed-off-by: hydai --- .../wasmedge_ffmpeg/avcodec/avCodec.cpp | 76 +--- .../wasmedge_ffmpeg/avcodec/avCodecCtx.cpp | 364 +++++------------- .../avcodec/avCodecParameters.cpp | 12 +- .../wasmedge_ffmpeg/avcodec/avPacket.cpp | 84 +--- .../wasmedge_ffmpeg/avcodec/avcodec_func.cpp | 108 ++---- .../wasmedge_ffmpeg/avfilter/avfilter.cpp | 56 +-- .../avfilter/avfilter_func.cpp | 108 ++---- .../wasmedge_ffmpeg/avformat/avChapter.cpp | 36 +- .../avformat/avInputOutputContext.cpp | 40 +- .../wasmedge_ffmpeg/avformat/avStream.cpp | 64 +-- .../avformat/avformatContext.cpp | 40 +- .../avformat/avformat_func.cpp | 100 ++--- .../wasmedge_ffmpeg/avutil/avDictionary.cpp | 20 +- .../wasmedge_ffmpeg/avutil/avError.cpp | 12 +- .../wasmedge_ffmpeg/avutil/avFrame.cpp | 193 +++------- .../wasmedge_ffmpeg/avutil/avPixfmt.cpp | 56 +-- .../wasmedge_ffmpeg/avutil/avRational.cpp | 44 +-- .../wasmedge_ffmpeg/avutil/avSampleFmt.cpp | 44 +-- .../wasmedge_ffmpeg/avutil/avutil_func.cpp | 68 +--- .../swresample/swresample_func.cpp | 44 +-- .../wasmedge_ffmpeg/swscale/swscale_func.cpp | 101 ++--- test/plugins/wasmedge_ffmpeg/utils.cpp | 60 +-- 22 files changed, 432 insertions(+), 1298 deletions(-) diff --git a/test/plugins/wasmedge_ffmpeg/avcodec/avCodec.cpp b/test/plugins/wasmedge_ffmpeg/avcodec/avCodec.cpp index 17dc5a49..e4177cdd 100644 --- a/test/plugins/wasmedge_ffmpeg/avcodec/avCodec.cpp +++ b/test/plugins/wasmedge_ffmpeg/avcodec/avCodec.cpp @@ -31,9 +31,7 @@ TEST_F(FFmpegTest, AVCodec) { EXPECT_NE(FuncInst, nullptr); EXPECT_TRUE(FuncInst->isHostFunction()); - auto &HostFuncAVCodecID = - dynamic_cast( - FuncInst->getHostFunc()); + auto &HostFuncAVCodecID = FuncInst->getHostFunc(); spdlog::info("Testing AVCodecId"sv); { @@ -48,9 +46,7 @@ TEST_F(FFmpegTest, AVCodec) { EXPECT_NE(FuncInst, nullptr); EXPECT_TRUE(FuncInst->isHostFunction()); - auto &HostFuncAVCodecType = - dynamic_cast( - FuncInst->getHostFunc()); + auto &HostFuncAVCodecType = FuncInst->getHostFunc(); spdlog::info("Testing AVCodecType"sv); { @@ -66,9 +62,7 @@ TEST_F(FFmpegTest, AVCodec) { EXPECT_NE(FuncInst, nullptr); EXPECT_TRUE(FuncInst->isHostFunction()); - auto &HostFuncAVCodecMaxLowres = - dynamic_cast( - FuncInst->getHostFunc()); + auto &HostFuncAVCodecMaxLowres = FuncInst->getHostFunc(); spdlog::info("Testing AVCodecMaxLowres"sv); { @@ -83,9 +77,7 @@ TEST_F(FFmpegTest, AVCodec) { EXPECT_NE(FuncInst, nullptr); EXPECT_TRUE(FuncInst->isHostFunction()); - auto &HostFuncAVCodecCapabilities = dynamic_cast< - WasmEdge::Host::WasmEdgeFFmpeg::AVcodec::AVCodecCapabilities &>( - FuncInst->getHostFunc()); + auto &HostFuncAVCodecCapabilities = FuncInst->getHostFunc(); spdlog::info("Testing AVCodecCapabilities"sv); { @@ -101,9 +93,7 @@ TEST_F(FFmpegTest, AVCodec) { EXPECT_NE(FuncInst, nullptr); EXPECT_TRUE(FuncInst->isHostFunction()); - auto &HostFuncAVCodecGetNameLen = dynamic_cast< - WasmEdge::Host::WasmEdgeFFmpeg::AVcodec::AVCodecGetNameLen &>( - FuncInst->getHostFunc()); + auto &HostFuncAVCodecGetNameLen = FuncInst->getHostFunc(); spdlog::info("Testing AVCodecGetNameLen"sv); { @@ -119,9 +109,7 @@ TEST_F(FFmpegTest, AVCodec) { EXPECT_NE(FuncInst, nullptr); EXPECT_TRUE(FuncInst->isHostFunction()); - auto &HostFuncAVCodecGetName = - dynamic_cast( - FuncInst->getHostFunc()); + auto &HostFuncAVCodecGetName = FuncInst->getHostFunc(); // Fill the Memory with 0. fillMemContent(MemInst, StringPtr, Length); @@ -140,9 +128,7 @@ TEST_F(FFmpegTest, AVCodec) { EXPECT_NE(FuncInst, nullptr); EXPECT_TRUE(FuncInst->isHostFunction()); - auto &HostFuncAVCodecGetLongNameLen = dynamic_cast< - WasmEdge::Host::WasmEdgeFFmpeg::AVcodec::AVCodecGetLongNameLen &>( - FuncInst->getHostFunc()); + auto &HostFuncAVCodecGetLongNameLen = FuncInst->getHostFunc(); spdlog::info("Testing AVCodecGetLongNameLen"sv); { @@ -158,9 +144,7 @@ TEST_F(FFmpegTest, AVCodec) { EXPECT_NE(FuncInst, nullptr); EXPECT_TRUE(FuncInst->isHostFunction()); - auto &HostFuncAVCodecGetLongName = dynamic_cast< - WasmEdge::Host::WasmEdgeFFmpeg::AVcodec::AVCodecGetLongName &>( - FuncInst->getHostFunc()); + auto &HostFuncAVCodecGetLongName = FuncInst->getHostFunc(); spdlog::info("Testing AVCodecGetLongName"sv); { @@ -177,9 +161,7 @@ TEST_F(FFmpegTest, AVCodec) { EXPECT_NE(FuncInst, nullptr); EXPECT_TRUE(FuncInst->isHostFunction()); - auto &HostFuncAVCodecProfiles = - dynamic_cast( - FuncInst->getHostFunc()); + auto &HostFuncAVCodecProfiles = FuncInst->getHostFunc(); spdlog::info("Testing AVCodecProfiles"sv); { @@ -194,9 +176,7 @@ TEST_F(FFmpegTest, AVCodec) { EXPECT_NE(FuncInst, nullptr); EXPECT_TRUE(FuncInst->isHostFunction()); - auto &HostFuncAVCodecPixFmtIsNull = dynamic_cast< - WasmEdge::Host::WasmEdgeFFmpeg::AVcodec::AVCodecPixFmtsIsNull &>( - FuncInst->getHostFunc()); + auto &HostFuncAVCodecPixFmtIsNull = FuncInst->getHostFunc(); spdlog::info("Testing AVCodecPixFmtsIsNull"sv); { @@ -211,9 +191,7 @@ TEST_F(FFmpegTest, AVCodec) { EXPECT_NE(FuncInst, nullptr); EXPECT_TRUE(FuncInst->isHostFunction()); - auto &HostFuncAVCodecPixFmtIter = dynamic_cast< - WasmEdge::Host::WasmEdgeFFmpeg::AVcodec::AVCodecPixFmtsIter &>( - FuncInst->getHostFunc()); + auto &HostFuncAVCodecPixFmtIter = FuncInst->getHostFunc(); spdlog::info("Testing AVCodecPixFmtsIter"sv); { @@ -229,9 +207,7 @@ TEST_F(FFmpegTest, AVCodec) { EXPECT_NE(FuncInst, nullptr); EXPECT_TRUE(FuncInst->isHostFunction()); - auto &HostFuncAVCodecSupportedFrameratesIsNull = dynamic_cast< - WasmEdge::Host::WasmEdgeFFmpeg::AVcodec::AVCodecSupportedFrameratesIsNull - &>(FuncInst->getHostFunc()); + auto &HostFuncAVCodecSupportedFrameratesIsNull = FuncInst->getHostFunc(); spdlog::info("Testing AVCodecSupportedFramratesIsNull"sv); { @@ -246,9 +222,7 @@ TEST_F(FFmpegTest, AVCodec) { EXPECT_NE(FuncInst, nullptr); EXPECT_TRUE(FuncInst->isHostFunction()); - auto &HostFuncAVCodecSupportedFrameratesIter = dynamic_cast< - WasmEdge::Host::WasmEdgeFFmpeg::AVcodec::AVCodecSupportedFrameratesIter - &>(FuncInst->getHostFunc()); + auto &HostFuncAVCodecSupportedFrameratesIter = FuncInst->getHostFunc(); spdlog::info("Testing AVCodecSupportedFrameratesIter"sv); { @@ -265,9 +239,7 @@ TEST_F(FFmpegTest, AVCodec) { EXPECT_NE(FuncInst, nullptr); EXPECT_TRUE(FuncInst->isHostFunction()); - auto &HostFuncAVCodecSupportedSampleRatesIsNull = dynamic_cast< - WasmEdge::Host::WasmEdgeFFmpeg::AVcodec::AVCodecSupportedSampleRatesIsNull - &>(FuncInst->getHostFunc()); + auto &HostFuncAVCodecSupportedSampleRatesIsNull = FuncInst->getHostFunc(); spdlog::info("Testing AVCodecSupportedSampleRatesIsNull"sv); { @@ -282,9 +254,7 @@ TEST_F(FFmpegTest, AVCodec) { EXPECT_NE(FuncInst, nullptr); EXPECT_TRUE(FuncInst->isHostFunction()); - auto &HostFuncAVCodecSupportedSampleRatesIter = dynamic_cast< - WasmEdge::Host::WasmEdgeFFmpeg::AVcodec::AVCodecSupportedSampleRatesIter - &>(FuncInst->getHostFunc()); + auto &HostFuncAVCodecSupportedSampleRatesIter = FuncInst->getHostFunc(); spdlog::info("Testing AVCodecSupportedSampleRatesIter"sv); { @@ -299,9 +269,7 @@ TEST_F(FFmpegTest, AVCodec) { EXPECT_NE(FuncInst, nullptr); EXPECT_TRUE(FuncInst->isHostFunction()); - auto &HostFuncAVCodecChannelLayoutIsNull = dynamic_cast< - WasmEdge::Host::WasmEdgeFFmpeg::AVcodec::AVCodecChannelLayoutIsNull &>( - FuncInst->getHostFunc()); + auto &HostFuncAVCodecChannelLayoutIsNull = FuncInst->getHostFunc(); spdlog::info("Testing AVCodecChannelLayoutIsNull"sv); { @@ -316,9 +284,7 @@ TEST_F(FFmpegTest, AVCodec) { EXPECT_NE(FuncInst, nullptr); EXPECT_TRUE(FuncInst->isHostFunction()); - auto &HostFuncAVCodecChannelLayoutIter = dynamic_cast< - WasmEdge::Host::WasmEdgeFFmpeg::AVcodec::AVCodecChannelLayoutIter &>( - FuncInst->getHostFunc()); + auto &HostFuncAVCodecChannelLayoutIter = FuncInst->getHostFunc(); spdlog::info("Testing AVCodecChannelLayoutIter"sv); { @@ -333,9 +299,7 @@ TEST_F(FFmpegTest, AVCodec) { EXPECT_NE(FuncInst, nullptr); EXPECT_TRUE(FuncInst->isHostFunction()); - auto &HostFuncAVCodecSampleFmtsIsNull = dynamic_cast< - WasmEdge::Host::WasmEdgeFFmpeg::AVcodec::AVCodecSampleFmtsIsNull &>( - FuncInst->getHostFunc()); + auto &HostFuncAVCodecSampleFmtsIsNull = FuncInst->getHostFunc(); spdlog::info("Testing AVCodecSampleFmtsIsNull"sv); { @@ -350,9 +314,7 @@ TEST_F(FFmpegTest, AVCodec) { EXPECT_NE(FuncInst, nullptr); EXPECT_TRUE(FuncInst->isHostFunction()); - auto &HostFuncAVCodecSampleFmtsIter = dynamic_cast< - WasmEdge::Host::WasmEdgeFFmpeg::AVcodec::AVCodecSampleFmtsIter &>( - FuncInst->getHostFunc()); + auto &HostFuncAVCodecSampleFmtsIter = FuncInst->getHostFunc(); spdlog::info("Testing AVCodecSampleFmtsIter"sv); { diff --git a/test/plugins/wasmedge_ffmpeg/avcodec/avCodecCtx.cpp b/test/plugins/wasmedge_ffmpeg/avcodec/avCodecCtx.cpp index 3407f4e7..a562e219 100644 --- a/test/plugins/wasmedge_ffmpeg/avcodec/avCodecCtx.cpp +++ b/test/plugins/wasmedge_ffmpeg/avcodec/avCodecCtx.cpp @@ -32,9 +32,7 @@ TEST_F(FFmpegTest, AVCodecCtx) { EXPECT_NE(FuncInst, nullptr); EXPECT_TRUE(FuncInst->isHostFunction()); - auto &HostFuncAVCodecCtxCodecID = dynamic_cast< - WasmEdge::Host::WasmEdgeFFmpeg::AVcodec::AVCodecCtxCodecID &>( - FuncInst->getHostFunc()); + auto &HostFuncAVCodecCtxCodecID = FuncInst->getHostFunc(); { EXPECT_TRUE(HostFuncAVCodecCtxCodecID.run( @@ -49,9 +47,7 @@ TEST_F(FFmpegTest, AVCodecCtx) { EXPECT_NE(FuncInst, nullptr); EXPECT_TRUE(FuncInst->isHostFunction()); - auto &HostFuncAVCodecCtxSetCodecType = dynamic_cast< - WasmEdge::Host::WasmEdgeFFmpeg::AVcodec::AVCodecCtxSetCodecType &>( - FuncInst->getHostFunc()); + auto &HostFuncAVCodecCtxSetCodecType = FuncInst->getHostFunc(); { EXPECT_TRUE(HostFuncAVCodecCtxSetCodecType.run( @@ -66,9 +62,7 @@ TEST_F(FFmpegTest, AVCodecCtx) { EXPECT_NE(FuncInst, nullptr); EXPECT_TRUE(FuncInst->isHostFunction()); - auto &HostFuncAVCodecCtxCodecType = dynamic_cast< - WasmEdge::Host::WasmEdgeFFmpeg::AVcodec::AVCodecCtxCodecType &>( - FuncInst->getHostFunc()); + auto &HostFuncAVCodecCtxCodecType = FuncInst->getHostFunc(); { EXPECT_TRUE(HostFuncAVCodecCtxCodecType.run( @@ -84,9 +78,7 @@ TEST_F(FFmpegTest, AVCodecCtx) { EXPECT_NE(FuncInst, nullptr); EXPECT_TRUE(FuncInst->isHostFunction()); - auto &HostFuncAVCodecCtxSetTimebase = dynamic_cast< - WasmEdge::Host::WasmEdgeFFmpeg::AVcodec::AVCodecCtxSetTimebase &>( - FuncInst->getHostFunc()); + auto &HostFuncAVCodecCtxSetTimebase = FuncInst->getHostFunc(); { EXPECT_TRUE(HostFuncAVCodecCtxSetTimebase.run( @@ -101,9 +93,7 @@ TEST_F(FFmpegTest, AVCodecCtx) { EXPECT_NE(FuncInst, nullptr); EXPECT_TRUE(FuncInst->isHostFunction()); - auto &HostFuncAVCodecCtxTimeBase = dynamic_cast< - WasmEdge::Host::WasmEdgeFFmpeg::AVcodec::AVCodecCtxTimeBase &>( - FuncInst->getHostFunc()); + auto &HostFuncAVCodecCtxTimeBase = FuncInst->getHostFunc(); { EXPECT_TRUE(HostFuncAVCodecCtxTimeBase.run( @@ -124,9 +114,7 @@ TEST_F(FFmpegTest, AVCodecCtx) { EXPECT_NE(FuncInst, nullptr); EXPECT_TRUE(FuncInst->isHostFunction()); - auto &HostFuncAVCodecCtxSetWidth = dynamic_cast< - WasmEdge::Host::WasmEdgeFFmpeg::AVcodec::AVCodecCtxSetWidth &>( - FuncInst->getHostFunc()); + auto &HostFuncAVCodecCtxSetWidth = FuncInst->getHostFunc(); { EXPECT_TRUE(HostFuncAVCodecCtxSetWidth.run( @@ -141,9 +129,7 @@ TEST_F(FFmpegTest, AVCodecCtx) { EXPECT_NE(FuncInst, nullptr); EXPECT_TRUE(FuncInst->isHostFunction()); - auto &HostFuncAVCodecCtxWidth = - dynamic_cast( - FuncInst->getHostFunc()); + auto &HostFuncAVCodecCtxWidth = FuncInst->getHostFunc(); { EXPECT_TRUE(HostFuncAVCodecCtxWidth.run( @@ -157,9 +143,7 @@ TEST_F(FFmpegTest, AVCodecCtx) { EXPECT_NE(FuncInst, nullptr); EXPECT_TRUE(FuncInst->isHostFunction()); - auto &HostFuncAVCodecCtxSetHeight = dynamic_cast< - WasmEdge::Host::WasmEdgeFFmpeg::AVcodec::AVCodecCtxSetHeight &>( - FuncInst->getHostFunc()); + auto &HostFuncAVCodecCtxSetHeight = FuncInst->getHostFunc(); { EXPECT_TRUE(HostFuncAVCodecCtxSetHeight.run( @@ -174,9 +158,7 @@ TEST_F(FFmpegTest, AVCodecCtx) { EXPECT_NE(FuncInst, nullptr); EXPECT_TRUE(FuncInst->isHostFunction()); - auto &HostFuncAVCodecCtxHeight = - dynamic_cast( - FuncInst->getHostFunc()); + auto &HostFuncAVCodecCtxHeight = FuncInst->getHostFunc(); { EXPECT_TRUE(HostFuncAVCodecCtxHeight.run( @@ -192,9 +174,7 @@ TEST_F(FFmpegTest, AVCodecCtx) { EXPECT_NE(FuncInst, nullptr); EXPECT_TRUE(FuncInst->isHostFunction()); - auto &HostFuncAVCodecCtxSetSampleAspectRatio = dynamic_cast< - WasmEdge::Host::WasmEdgeFFmpeg::AVcodec::AVCodecCtxSetSampleAspectRatio - &>(FuncInst->getHostFunc()); + auto &HostFuncAVCodecCtxSetSampleAspectRatio = FuncInst->getHostFunc(); { EXPECT_TRUE(HostFuncAVCodecCtxSetSampleAspectRatio.run( @@ -209,9 +189,7 @@ TEST_F(FFmpegTest, AVCodecCtx) { EXPECT_NE(FuncInst, nullptr); EXPECT_TRUE(FuncInst->isHostFunction()); - auto &HostFuncAVCodecCtxSampleAspectRatio = dynamic_cast< - WasmEdge::Host::WasmEdgeFFmpeg::AVcodec::AVCodecCtxSampleAspectRatio &>( - FuncInst->getHostFunc()); + auto &HostFuncAVCodecCtxSampleAspectRatio = FuncInst->getHostFunc(); { EXPECT_TRUE(HostFuncAVCodecCtxSampleAspectRatio.run( @@ -233,9 +211,7 @@ TEST_F(FFmpegTest, AVCodecCtx) { EXPECT_NE(FuncInst, nullptr); EXPECT_TRUE(FuncInst->isHostFunction()); - auto &HostFuncAVCodecCtxSetChannelLayout = dynamic_cast< - WasmEdge::Host::WasmEdgeFFmpeg::AVcodec::AVCodecCtxSetChannelLayout &>( - FuncInst->getHostFunc()); + auto &HostFuncAVCodecCtxSetChannelLayout = FuncInst->getHostFunc(); { EXPECT_TRUE(HostFuncAVCodecCtxSetChannelLayout.run( @@ -251,9 +227,7 @@ TEST_F(FFmpegTest, AVCodecCtx) { EXPECT_NE(FuncInst, nullptr); EXPECT_TRUE(FuncInst->isHostFunction()); - auto &HostFuncAVCodecCtxChannelLayout = dynamic_cast< - WasmEdge::Host::WasmEdgeFFmpeg::AVcodec::AVCodecCtxChannelLayout &>( - FuncInst->getHostFunc()); + auto &HostFuncAVCodecCtxChannelLayout = FuncInst->getHostFunc(); { EXPECT_TRUE(HostFuncAVCodecCtxChannelLayout.run( @@ -269,9 +243,7 @@ TEST_F(FFmpegTest, AVCodecCtx) { EXPECT_NE(FuncInst, nullptr); EXPECT_TRUE(FuncInst->isHostFunction()); - auto &HostFuncAVCodecCtxSetPixFormat = dynamic_cast< - WasmEdge::Host::WasmEdgeFFmpeg::AVcodec::AVCodecCtxSetPixFormat &>( - FuncInst->getHostFunc()); + auto &HostFuncAVCodecCtxSetPixFormat = FuncInst->getHostFunc(); { EXPECT_TRUE(HostFuncAVCodecCtxSetPixFormat.run( @@ -286,9 +258,7 @@ TEST_F(FFmpegTest, AVCodecCtx) { EXPECT_NE(FuncInst, nullptr); EXPECT_TRUE(FuncInst->isHostFunction()); - auto &HostFuncAVCodecCtxPixFormat = dynamic_cast< - WasmEdge::Host::WasmEdgeFFmpeg::AVcodec::AVCodecCtxPixFormat &>( - FuncInst->getHostFunc()); + auto &HostFuncAVCodecCtxPixFormat = FuncInst->getHostFunc(); { EXPECT_TRUE(HostFuncAVCodecCtxPixFormat.run( @@ -303,9 +273,7 @@ TEST_F(FFmpegTest, AVCodecCtx) { EXPECT_NE(FuncInst, nullptr); EXPECT_TRUE(FuncInst->isHostFunction()); - auto &HostFuncAVCodecCtxSetSampleFormat = dynamic_cast< - WasmEdge::Host::WasmEdgeFFmpeg::AVcodec::AVCodecCtxSetSampleFormat &>( - FuncInst->getHostFunc()); + auto &HostFuncAVCodecCtxSetSampleFormat = FuncInst->getHostFunc(); { EXPECT_TRUE(HostFuncAVCodecCtxSetSampleFormat.run( @@ -320,9 +288,7 @@ TEST_F(FFmpegTest, AVCodecCtx) { EXPECT_NE(FuncInst, nullptr); EXPECT_TRUE(FuncInst->isHostFunction()); - auto &HostFuncAVCodecCtxSampleFormat = dynamic_cast< - WasmEdge::Host::WasmEdgeFFmpeg::AVcodec::AVCodecCtxSampleFormat &>( - FuncInst->getHostFunc()); + auto &HostFuncAVCodecCtxSampleFormat = FuncInst->getHostFunc(); { EXPECT_TRUE(HostFuncAVCodecCtxSampleFormat.run( @@ -337,9 +303,7 @@ TEST_F(FFmpegTest, AVCodecCtx) { EXPECT_NE(FuncInst, nullptr); EXPECT_TRUE(FuncInst->isHostFunction()); - auto &HostFuncAVCodecCtxSetSampleRate = dynamic_cast< - WasmEdge::Host::WasmEdgeFFmpeg::AVcodec::AVCodecCtxSetSampleRate &>( - FuncInst->getHostFunc()); + auto &HostFuncAVCodecCtxSetSampleRate = FuncInst->getHostFunc(); { EXPECT_TRUE(HostFuncAVCodecCtxSetSampleRate.run( @@ -354,9 +318,7 @@ TEST_F(FFmpegTest, AVCodecCtx) { EXPECT_NE(FuncInst, nullptr); EXPECT_TRUE(FuncInst->isHostFunction()); - auto &HostFuncAVCodecCtxSampleRate = dynamic_cast< - WasmEdge::Host::WasmEdgeFFmpeg::AVcodec::AVCodecCtxSampleRate &>( - FuncInst->getHostFunc()); + auto &HostFuncAVCodecCtxSampleRate = FuncInst->getHostFunc(); { EXPECT_TRUE(HostFuncAVCodecCtxSampleRate.run( @@ -370,9 +332,7 @@ TEST_F(FFmpegTest, AVCodecCtx) { EXPECT_NE(FuncInst, nullptr); EXPECT_TRUE(FuncInst->isHostFunction()); - auto &HostFuncAVCodecCtxSetGopSize = dynamic_cast< - WasmEdge::Host::WasmEdgeFFmpeg::AVcodec::AVCodecCtxSetGopSize &>( - FuncInst->getHostFunc()); + auto &HostFuncAVCodecCtxSetGopSize = FuncInst->getHostFunc(); { int32_t GopSize = 20; @@ -388,9 +348,7 @@ TEST_F(FFmpegTest, AVCodecCtx) { EXPECT_NE(FuncInst, nullptr); EXPECT_TRUE(FuncInst->isHostFunction()); - auto &HostFuncAVCodecCtxSetMaxBFrames = dynamic_cast< - WasmEdge::Host::WasmEdgeFFmpeg::AVcodec::AVCodecCtxSetMaxBFrames &>( - FuncInst->getHostFunc()); + auto &HostFuncAVCodecCtxSetMaxBFrames = FuncInst->getHostFunc(); { int32_t MaxBFrames = 30; @@ -406,9 +364,7 @@ TEST_F(FFmpegTest, AVCodecCtx) { EXPECT_NE(FuncInst, nullptr); EXPECT_TRUE(FuncInst->isHostFunction()); - auto &HostFuncAVCodecCtxSetBQuantFactor = dynamic_cast< - WasmEdge::Host::WasmEdgeFFmpeg::AVcodec::AVCodecCtxSetBQuantFactor &>( - FuncInst->getHostFunc()); + auto &HostFuncAVCodecCtxSetBQuantFactor = FuncInst->getHostFunc(); { float BQuantFactor = 12.32; @@ -424,9 +380,7 @@ TEST_F(FFmpegTest, AVCodecCtx) { EXPECT_NE(FuncInst, nullptr); EXPECT_TRUE(FuncInst->isHostFunction()); - auto &HostFuncAVCodecCtxSetBQuantOffset = dynamic_cast< - WasmEdge::Host::WasmEdgeFFmpeg::AVcodec::AVCodecCtxSetBQuantOffset &>( - FuncInst->getHostFunc()); + auto &HostFuncAVCodecCtxSetBQuantOffset = FuncInst->getHostFunc(); { float BQuantOffset = 3.53; @@ -442,9 +396,7 @@ TEST_F(FFmpegTest, AVCodecCtx) { EXPECT_NE(FuncInst, nullptr); EXPECT_TRUE(FuncInst->isHostFunction()); - auto &HostFuncAVCodecCtxSetIQuantFactor = dynamic_cast< - WasmEdge::Host::WasmEdgeFFmpeg::AVcodec::AVCodecCtxSetIQuantFactor &>( - FuncInst->getHostFunc()); + auto &HostFuncAVCodecCtxSetIQuantFactor = FuncInst->getHostFunc(); { float IQuantFactor = 3.435; @@ -460,9 +412,7 @@ TEST_F(FFmpegTest, AVCodecCtx) { EXPECT_NE(FuncInst, nullptr); EXPECT_TRUE(FuncInst->isHostFunction()); - auto &HostFuncAVCodecCtxSetIQuantOffset = dynamic_cast< - WasmEdge::Host::WasmEdgeFFmpeg::AVcodec::AVCodecCtxSetIQuantOffset &>( - FuncInst->getHostFunc()); + auto &HostFuncAVCodecCtxSetIQuantOffset = FuncInst->getHostFunc(); { float IQuantOffset = 6.322; @@ -478,9 +428,7 @@ TEST_F(FFmpegTest, AVCodecCtx) { EXPECT_NE(FuncInst, nullptr); EXPECT_TRUE(FuncInst->isHostFunction()); - auto &HostFuncAVCodecCtxSetLumiMasking = dynamic_cast< - WasmEdge::Host::WasmEdgeFFmpeg::AVcodec::AVCodecCtxSetLumiMasking &>( - FuncInst->getHostFunc()); + auto &HostFuncAVCodecCtxSetLumiMasking = FuncInst->getHostFunc(); { float LumiMasking = 54.32432; @@ -496,9 +444,7 @@ TEST_F(FFmpegTest, AVCodecCtx) { EXPECT_NE(FuncInst, nullptr); EXPECT_TRUE(FuncInst->isHostFunction()); - auto &HostFuncAVCodecCtxSetTemporalCplxMasking = dynamic_cast< - WasmEdge::Host::WasmEdgeFFmpeg::AVcodec::AVCodecCtxSetTemporalCplxMasking - &>(FuncInst->getHostFunc()); + auto &HostFuncAVCodecCtxSetTemporalCplxMasking = FuncInst->getHostFunc(); { float TemporialCplxMasking = 642.32; @@ -515,9 +461,7 @@ TEST_F(FFmpegTest, AVCodecCtx) { EXPECT_NE(FuncInst, nullptr); EXPECT_TRUE(FuncInst->isHostFunction()); - auto &HostFuncAVCodecCtxSetSpatialCplxMasking = dynamic_cast< - WasmEdge::Host::WasmEdgeFFmpeg::AVcodec::AVCodecCtxSetSpatialCplxMasking - &>(FuncInst->getHostFunc()); + auto &HostFuncAVCodecCtxSetSpatialCplxMasking = FuncInst->getHostFunc(); { float SpatialCplxMasking = 324.32; @@ -534,9 +478,7 @@ TEST_F(FFmpegTest, AVCodecCtx) { EXPECT_NE(FuncInst, nullptr); EXPECT_TRUE(FuncInst->isHostFunction()); - auto &HostFuncAVCodecCtxSetPMasking = dynamic_cast< - WasmEdge::Host::WasmEdgeFFmpeg::AVcodec::AVCodecCtxSetPMasking &>( - FuncInst->getHostFunc()); + auto &HostFuncAVCodecCtxSetPMasking = FuncInst->getHostFunc(); { float PMasking = 65.3245; @@ -552,9 +494,7 @@ TEST_F(FFmpegTest, AVCodecCtx) { EXPECT_NE(FuncInst, nullptr); EXPECT_TRUE(FuncInst->isHostFunction()); - auto &HostFuncAVCodecCtxSetDarkMasking = dynamic_cast< - WasmEdge::Host::WasmEdgeFFmpeg::AVcodec::AVCodecCtxSetDarkMasking &>( - FuncInst->getHostFunc()); + auto &HostFuncAVCodecCtxSetDarkMasking = FuncInst->getHostFunc(); { float DarkMasking = 83.32; @@ -570,9 +510,7 @@ TEST_F(FFmpegTest, AVCodecCtx) { EXPECT_NE(FuncInst, nullptr); EXPECT_TRUE(FuncInst->isHostFunction()); - auto &HostFuncAVCodecCtxSetMeCmp = dynamic_cast< - WasmEdge::Host::WasmEdgeFFmpeg::AVcodec::AVCodecCtxSetMeCmp &>( - FuncInst->getHostFunc()); + auto &HostFuncAVCodecCtxSetMeCmp = FuncInst->getHostFunc(); { int32_t MeCmp = 532; @@ -588,9 +526,7 @@ TEST_F(FFmpegTest, AVCodecCtx) { EXPECT_NE(FuncInst, nullptr); EXPECT_TRUE(FuncInst->isHostFunction()); - auto &HostFuncAVCodecCtxSetMeSubCmp = dynamic_cast< - WasmEdge::Host::WasmEdgeFFmpeg::AVcodec::AVCodecCtxSetMeSubCmp &>( - FuncInst->getHostFunc()); + auto &HostFuncAVCodecCtxSetMeSubCmp = FuncInst->getHostFunc(); { int32_t MeSubCmp = 321; @@ -606,9 +542,7 @@ TEST_F(FFmpegTest, AVCodecCtx) { EXPECT_NE(FuncInst, nullptr); EXPECT_TRUE(FuncInst->isHostFunction()); - auto &HostFuncAVCodecCtxSetMbCmp = dynamic_cast< - WasmEdge::Host::WasmEdgeFFmpeg::AVcodec::AVCodecCtxSetMbCmp &>( - FuncInst->getHostFunc()); + auto &HostFuncAVCodecCtxSetMbCmp = FuncInst->getHostFunc(); { int32_t MbCmp = 243; @@ -624,9 +558,7 @@ TEST_F(FFmpegTest, AVCodecCtx) { EXPECT_NE(FuncInst, nullptr); EXPECT_TRUE(FuncInst->isHostFunction()); - auto &HostFuncAVCodecCtxSetIldctCmp = dynamic_cast< - WasmEdge::Host::WasmEdgeFFmpeg::AVcodec::AVCodecCtxSetIldctCmp &>( - FuncInst->getHostFunc()); + auto &HostFuncAVCodecCtxSetIldctCmp = FuncInst->getHostFunc(); { int32_t IldctCmp = 3; @@ -642,9 +574,7 @@ TEST_F(FFmpegTest, AVCodecCtx) { EXPECT_NE(FuncInst, nullptr); EXPECT_TRUE(FuncInst->isHostFunction()); - auto &HostFuncAVCodecCtxSetDiaSize = dynamic_cast< - WasmEdge::Host::WasmEdgeFFmpeg::AVcodec::AVCodecCtxSetDiaSize &>( - FuncInst->getHostFunc()); + auto &HostFuncAVCodecCtxSetDiaSize = FuncInst->getHostFunc(); { int32_t DiaSize = 9; @@ -660,9 +590,7 @@ TEST_F(FFmpegTest, AVCodecCtx) { EXPECT_NE(FuncInst, nullptr); EXPECT_TRUE(FuncInst->isHostFunction()); - auto &HostFuncAVCodecCtxSetLastPredictorsCount = dynamic_cast< - WasmEdge::Host::WasmEdgeFFmpeg::AVcodec::AVCodecCtxSetLastPredictorsCount - &>(FuncInst->getHostFunc()); + auto &HostFuncAVCodecCtxSetLastPredictorsCount = FuncInst->getHostFunc(); { int32_t LastPredictorCount = 21; @@ -679,9 +607,7 @@ TEST_F(FFmpegTest, AVCodecCtx) { EXPECT_NE(FuncInst, nullptr); EXPECT_TRUE(FuncInst->isHostFunction()); - auto &HostFuncAVCodecCtxSetMePreCmp = dynamic_cast< - WasmEdge::Host::WasmEdgeFFmpeg::AVcodec::AVCodecCtxSetMePreCmp &>( - FuncInst->getHostFunc()); + auto &HostFuncAVCodecCtxSetMePreCmp = FuncInst->getHostFunc(); { int32_t MePreCmp = 53; @@ -697,9 +623,7 @@ TEST_F(FFmpegTest, AVCodecCtx) { EXPECT_NE(FuncInst, nullptr); EXPECT_TRUE(FuncInst->isHostFunction()); - auto &HostFuncAVCodecCtxSetPreDiaSize = dynamic_cast< - WasmEdge::Host::WasmEdgeFFmpeg::AVcodec::AVCodecCtxSetPreDiaSize &>( - FuncInst->getHostFunc()); + auto &HostFuncAVCodecCtxSetPreDiaSize = FuncInst->getHostFunc(); { int32_t PreDiaSize = 74; @@ -715,9 +639,7 @@ TEST_F(FFmpegTest, AVCodecCtx) { EXPECT_NE(FuncInst, nullptr); EXPECT_TRUE(FuncInst->isHostFunction()); - auto &HostFuncAVCodecCtxSetMeSubpelQuality = dynamic_cast< - WasmEdge::Host::WasmEdgeFFmpeg::AVcodec::AVCodecCtxSetMeSubpelQuality &>( - FuncInst->getHostFunc()); + auto &HostFuncAVCodecCtxSetMeSubpelQuality = FuncInst->getHostFunc(); { int32_t MeSubpelQuality = 85; @@ -734,9 +656,7 @@ TEST_F(FFmpegTest, AVCodecCtx) { EXPECT_NE(FuncInst, nullptr); EXPECT_TRUE(FuncInst->isHostFunction()); - auto &HostFuncAVCodecCtxSetMeRange = dynamic_cast< - WasmEdge::Host::WasmEdgeFFmpeg::AVcodec::AVCodecCtxSetMeRange &>( - FuncInst->getHostFunc()); + auto &HostFuncAVCodecCtxSetMeRange = FuncInst->getHostFunc(); { int32_t SetMeRange = 31; @@ -752,9 +672,7 @@ TEST_F(FFmpegTest, AVCodecCtx) { EXPECT_NE(FuncInst, nullptr); EXPECT_TRUE(FuncInst->isHostFunction()); - auto &HostFuncAVCodecCtxSetMbDecision = dynamic_cast< - WasmEdge::Host::WasmEdgeFFmpeg::AVcodec::AVCodecCtxSetMbDecision &>( - FuncInst->getHostFunc()); + auto &HostFuncAVCodecCtxSetMbDecision = FuncInst->getHostFunc(); { int32_t MbDecision = 78; @@ -770,9 +688,7 @@ TEST_F(FFmpegTest, AVCodecCtx) { EXPECT_NE(FuncInst, nullptr); EXPECT_TRUE(FuncInst->isHostFunction()); - auto &HostFuncAVCodecCtxSetMbLMin = dynamic_cast< - WasmEdge::Host::WasmEdgeFFmpeg::AVcodec::AVCodecCtxSetMbLMin &>( - FuncInst->getHostFunc()); + auto &HostFuncAVCodecCtxSetMbLMin = FuncInst->getHostFunc(); { int32_t MbLMin = 11; @@ -788,9 +704,7 @@ TEST_F(FFmpegTest, AVCodecCtx) { EXPECT_NE(FuncInst, nullptr); EXPECT_TRUE(FuncInst->isHostFunction()); - auto &HostFuncAVCodecCtxSetMbLMax = dynamic_cast< - WasmEdge::Host::WasmEdgeFFmpeg::AVcodec::AVCodecCtxSetMbLMax &>( - FuncInst->getHostFunc()); + auto &HostFuncAVCodecCtxSetMbLMax = FuncInst->getHostFunc(); { int32_t MbLMax = 18; @@ -807,9 +721,7 @@ TEST_F(FFmpegTest, AVCodecCtx) { EXPECT_TRUE(FuncInst->isHostFunction()); int32_t IntraDcPrecision = 323; - auto &HostFuncAVCodecCtxSetIntraDcPrecision = dynamic_cast< - WasmEdge::Host::WasmEdgeFFmpeg::AVcodec::AVCodecCtxSetIntraDcPrecision &>( - FuncInst->getHostFunc()); + auto &HostFuncAVCodecCtxSetIntraDcPrecision = FuncInst->getHostFunc(); { EXPECT_TRUE(HostFuncAVCodecCtxSetIntraDcPrecision.run( @@ -825,9 +737,7 @@ TEST_F(FFmpegTest, AVCodecCtx) { EXPECT_NE(FuncInst, nullptr); EXPECT_TRUE(FuncInst->isHostFunction()); - auto &HostFuncAVCodecCtxIntraDcPrecision = dynamic_cast< - WasmEdge::Host::WasmEdgeFFmpeg::AVcodec::AVCodecCtxIntraDcPrecision &>( - FuncInst->getHostFunc()); + auto &HostFuncAVCodecCtxIntraDcPrecision = FuncInst->getHostFunc(); { EXPECT_TRUE(HostFuncAVCodecCtxIntraDcPrecision.run( @@ -841,9 +751,7 @@ TEST_F(FFmpegTest, AVCodecCtx) { EXPECT_NE(FuncInst, nullptr); EXPECT_TRUE(FuncInst->isHostFunction()); - auto &HostFuncAVCodecCtxSetQMin = dynamic_cast< - WasmEdge::Host::WasmEdgeFFmpeg::AVcodec::AVCodecCtxSetQMin &>( - FuncInst->getHostFunc()); + auto &HostFuncAVCodecCtxSetQMin = FuncInst->getHostFunc(); { int32_t QMin = 10; @@ -859,9 +767,7 @@ TEST_F(FFmpegTest, AVCodecCtx) { EXPECT_NE(FuncInst, nullptr); EXPECT_TRUE(FuncInst->isHostFunction()); - auto &HostFuncAVCodecCtxSetQMax = dynamic_cast< - WasmEdge::Host::WasmEdgeFFmpeg::AVcodec::AVCodecCtxSetQMax &>( - FuncInst->getHostFunc()); + auto &HostFuncAVCodecCtxSetQMax = FuncInst->getHostFunc(); { int32_t QMax = 20; @@ -877,9 +783,7 @@ TEST_F(FFmpegTest, AVCodecCtx) { EXPECT_NE(FuncInst, nullptr); EXPECT_TRUE(FuncInst->isHostFunction()); - auto &HostFuncAVCodecCtxSetGlobalQuality = dynamic_cast< - WasmEdge::Host::WasmEdgeFFmpeg::AVcodec::AVCodecCtxSetGlobalQuality &>( - FuncInst->getHostFunc()); + auto &HostFuncAVCodecCtxSetGlobalQuality = FuncInst->getHostFunc(); { int32_t GlobalQuality = 93; @@ -896,9 +800,7 @@ TEST_F(FFmpegTest, AVCodecCtx) { EXPECT_NE(FuncInst, nullptr); EXPECT_TRUE(FuncInst->isHostFunction()); - auto &HostFuncAVCodecCtxSetColorspace = dynamic_cast< - WasmEdge::Host::WasmEdgeFFmpeg::AVcodec::AVCodecCtxSetColorspace &>( - FuncInst->getHostFunc()); + auto &HostFuncAVCodecCtxSetColorspace = FuncInst->getHostFunc(); int32_t ColorspaceId = 1; // AVCOL_SPC_BT709 { @@ -914,9 +816,7 @@ TEST_F(FFmpegTest, AVCodecCtx) { EXPECT_NE(FuncInst, nullptr); EXPECT_TRUE(FuncInst->isHostFunction()); - auto &HostFuncAVCodecCtxColorspace = dynamic_cast< - WasmEdge::Host::WasmEdgeFFmpeg::AVcodec::AVCodecCtxColorspace &>( - FuncInst->getHostFunc()); + auto &HostFuncAVCodecCtxColorspace = FuncInst->getHostFunc(); { EXPECT_TRUE(HostFuncAVCodecCtxColorspace.run( @@ -930,9 +830,7 @@ TEST_F(FFmpegTest, AVCodecCtx) { EXPECT_NE(FuncInst, nullptr); EXPECT_TRUE(FuncInst->isHostFunction()); - auto &HostFuncAVCodecCtxSetColorRange = dynamic_cast< - WasmEdge::Host::WasmEdgeFFmpeg::AVcodec::AVCodecCtxSetColorRange &>( - FuncInst->getHostFunc()); + auto &HostFuncAVCodecCtxSetColorRange = FuncInst->getHostFunc(); int32_t ColorRangeId = 1; // MPEG { @@ -948,9 +846,7 @@ TEST_F(FFmpegTest, AVCodecCtx) { EXPECT_NE(FuncInst, nullptr); EXPECT_TRUE(FuncInst->isHostFunction()); - auto &HostFuncAVCodecCtxColorRange = dynamic_cast< - WasmEdge::Host::WasmEdgeFFmpeg::AVcodec::AVCodecCtxColorRange &>( - FuncInst->getHostFunc()); + auto &HostFuncAVCodecCtxColorRange = FuncInst->getHostFunc(); { EXPECT_TRUE(HostFuncAVCodecCtxColorRange.run( @@ -964,9 +860,7 @@ TEST_F(FFmpegTest, AVCodecCtx) { EXPECT_NE(FuncInst, nullptr); EXPECT_TRUE(FuncInst->isHostFunction()); - auto &HostFuncAVCodecCtxFrameSize = dynamic_cast< - WasmEdge::Host::WasmEdgeFFmpeg::AVcodec::AVCodecCtxFrameSize &>( - FuncInst->getHostFunc()); + auto &HostFuncAVCodecCtxFrameSize = FuncInst->getHostFunc(); { EXPECT_TRUE(HostFuncAVCodecCtxFrameSize.run( @@ -980,9 +874,7 @@ TEST_F(FFmpegTest, AVCodecCtx) { EXPECT_NE(FuncInst, nullptr); EXPECT_TRUE(FuncInst->isHostFunction()); - auto &HostFuncAVCodecCtxSetBitRate = dynamic_cast< - WasmEdge::Host::WasmEdgeFFmpeg::AVcodec::AVCodecCtxSetBitRate &>( - FuncInst->getHostFunc()); + auto &HostFuncAVCodecCtxSetBitRate = FuncInst->getHostFunc(); int64_t BitRate = 9932; { @@ -998,9 +890,7 @@ TEST_F(FFmpegTest, AVCodecCtx) { EXPECT_NE(FuncInst, nullptr); EXPECT_TRUE(FuncInst->isHostFunction()); - auto &HostFuncAVCodecCtxBitRate = dynamic_cast< - WasmEdge::Host::WasmEdgeFFmpeg::AVcodec::AVCodecCtxBitRate &>( - FuncInst->getHostFunc()); + auto &HostFuncAVCodecCtxBitRate = FuncInst->getHostFunc(); { EXPECT_TRUE(HostFuncAVCodecCtxBitRate.run( @@ -1015,9 +905,7 @@ TEST_F(FFmpegTest, AVCodecCtx) { EXPECT_TRUE(FuncInst->isHostFunction()); int64_t RcMaxRate = 3245; - auto &HostFuncAVCodecCtxSetRcMaxRate = dynamic_cast< - WasmEdge::Host::WasmEdgeFFmpeg::AVcodec::AVCodecCtxSetRcMaxRate &>( - FuncInst->getHostFunc()); + auto &HostFuncAVCodecCtxSetRcMaxRate = FuncInst->getHostFunc(); { EXPECT_TRUE(HostFuncAVCodecCtxSetRcMaxRate.run( @@ -1032,9 +920,7 @@ TEST_F(FFmpegTest, AVCodecCtx) { EXPECT_NE(FuncInst, nullptr); EXPECT_TRUE(FuncInst->isHostFunction()); - auto &HostFuncAVCodecCtxRcMaxRate = dynamic_cast< - WasmEdge::Host::WasmEdgeFFmpeg::AVcodec::AVCodecCtxRcMaxRate &>( - FuncInst->getHostFunc()); + auto &HostFuncAVCodecCtxRcMaxRate = FuncInst->getHostFunc(); { EXPECT_TRUE(HostFuncAVCodecCtxRcMaxRate.run( @@ -1048,9 +934,7 @@ TEST_F(FFmpegTest, AVCodecCtx) { EXPECT_NE(FuncInst, nullptr); EXPECT_TRUE(FuncInst->isHostFunction()); - auto &HostFuncAVCodecCtxSetBitRateTolerance = dynamic_cast< - WasmEdge::Host::WasmEdgeFFmpeg::AVcodec::AVCodecCtxSetBitRateTolerance &>( - FuncInst->getHostFunc()); + auto &HostFuncAVCodecCtxSetBitRateTolerance = FuncInst->getHostFunc(); { int32_t BitRateTolerance = 9543; @@ -1067,9 +951,7 @@ TEST_F(FFmpegTest, AVCodecCtx) { EXPECT_NE(FuncInst, nullptr); EXPECT_TRUE(FuncInst->isHostFunction()); - auto &HostFuncAVCodecCtxSetCompressionLevel = dynamic_cast< - WasmEdge::Host::WasmEdgeFFmpeg::AVcodec::AVCodecCtxSetCompressionLevel &>( - FuncInst->getHostFunc()); + auto &HostFuncAVCodecCtxSetCompressionLevel = FuncInst->getHostFunc(); { int32_t CompressionLevel = 934; @@ -1088,9 +970,7 @@ TEST_F(FFmpegTest, AVCodecCtx) { Num = 20; Den = 30; - auto &HostFuncAVCodecCtxSetFrameRate = dynamic_cast< - WasmEdge::Host::WasmEdgeFFmpeg::AVcodec::AVCodecCtxSetFrameRate &>( - FuncInst->getHostFunc()); + auto &HostFuncAVCodecCtxSetFrameRate = FuncInst->getHostFunc(); { EXPECT_TRUE(HostFuncAVCodecCtxSetFrameRate.run( @@ -1105,9 +985,7 @@ TEST_F(FFmpegTest, AVCodecCtx) { EXPECT_NE(FuncInst, nullptr); EXPECT_TRUE(FuncInst->isHostFunction()); - auto &HostFuncAVCodecCtxFrameRate = dynamic_cast< - WasmEdge::Host::WasmEdgeFFmpeg::AVcodec::AVCodecCtxFrameRate &>( - FuncInst->getHostFunc()); + auto &HostFuncAVCodecCtxFrameRate = FuncInst->getHostFunc(); { EXPECT_TRUE(HostFuncAVCodecCtxFrameRate.run( @@ -1127,9 +1005,7 @@ TEST_F(FFmpegTest, AVCodecCtx) { EXPECT_NE(FuncInst, nullptr); EXPECT_TRUE(FuncInst->isHostFunction()); - auto &HostFuncAVCodecCtxSetFlags = dynamic_cast< - WasmEdge::Host::WasmEdgeFFmpeg::AVcodec::AVCodecCtxSetFlags &>( - FuncInst->getHostFunc()); + auto &HostFuncAVCodecCtxSetFlags = FuncInst->getHostFunc(); { int32_t Flags = 3; @@ -1145,9 +1021,7 @@ TEST_F(FFmpegTest, AVCodecCtx) { EXPECT_NE(FuncInst, nullptr); EXPECT_TRUE(FuncInst->isHostFunction()); - auto &HostFuncAVCodecCtxSetStrictStdCompliance = dynamic_cast< - WasmEdge::Host::WasmEdgeFFmpeg::AVcodec::AVCodecCtxSetStrictStdCompliance - &>(FuncInst->getHostFunc()); + auto &HostFuncAVCodecCtxSetStrictStdCompliance = FuncInst->getHostFunc(); { int32_t ComplianceId = 3; @@ -1163,9 +1037,7 @@ TEST_F(FFmpegTest, AVCodecCtx) { EXPECT_NE(FuncInst, nullptr); EXPECT_TRUE(FuncInst->isHostFunction()); - auto &HostFuncAVCodecCtxSetDebug = dynamic_cast< - WasmEdge::Host::WasmEdgeFFmpeg::AVcodec::AVCodecCtxSetDebug &>( - FuncInst->getHostFunc()); + auto &HostFuncAVCodecCtxSetDebug = FuncInst->getHostFunc(); { int32_t Debug = 50; @@ -1181,9 +1053,7 @@ TEST_F(FFmpegTest, AVCodecCtx) { EXPECT_NE(FuncInst, nullptr); EXPECT_TRUE(FuncInst->isHostFunction()); - auto &HostFuncAVCodecCtxCodec = - dynamic_cast( - FuncInst->getHostFunc()); + auto &HostFuncAVCodecCtxCodec = FuncInst->getHostFunc(); { EXPECT_TRUE(HostFuncAVCodecCtxCodec.run( @@ -1199,9 +1069,7 @@ TEST_F(FFmpegTest, AVCodecCtx) { EXPECT_NE(FuncInst, nullptr); EXPECT_TRUE(FuncInst->isHostFunction()); - auto &HostFuncAVCodecCtxSetChannels = dynamic_cast< - WasmEdge::Host::WasmEdgeFFmpeg::AVcodec::AVCodecCtxSetChannels &>( - FuncInst->getHostFunc()); + auto &HostFuncAVCodecCtxSetChannels = FuncInst->getHostFunc(); int32_t Channels = 10; { @@ -1217,9 +1085,7 @@ TEST_F(FFmpegTest, AVCodecCtx) { EXPECT_NE(FuncInst, nullptr); EXPECT_TRUE(FuncInst->isHostFunction()); - auto &HostFuncAVCodecCtxChannels = dynamic_cast< - WasmEdge::Host::WasmEdgeFFmpeg::AVcodec::AVCodecCtxChannels &>( - FuncInst->getHostFunc()); + auto &HostFuncAVCodecCtxChannels = FuncInst->getHostFunc(); { EXPECT_TRUE(HostFuncAVCodecCtxChannels.run( @@ -1233,9 +1099,7 @@ TEST_F(FFmpegTest, AVCodecCtx) { EXPECT_NE(FuncInst, nullptr); EXPECT_TRUE(FuncInst->isHostFunction()); - auto &HostFuncAVCodecCtxSetSkipLoopFilter = dynamic_cast< - WasmEdge::Host::WasmEdgeFFmpeg::AVcodec::AVCodecCtxSetSkipLoopFilter &>( - FuncInst->getHostFunc()); + auto &HostFuncAVCodecCtxSetSkipLoopFilter = FuncInst->getHostFunc(); int32_t DiscardId = 16; // Bidirectional { @@ -1251,9 +1115,7 @@ TEST_F(FFmpegTest, AVCodecCtx) { EXPECT_NE(FuncInst, nullptr); EXPECT_TRUE(FuncInst->isHostFunction()); - auto &HostFuncAVCodecCtxSetSkipFrame = dynamic_cast< - WasmEdge::Host::WasmEdgeFFmpeg::AVcodec::AVCodecCtxSetSkipFrame &>( - FuncInst->getHostFunc()); + auto &HostFuncAVCodecCtxSetSkipFrame = FuncInst->getHostFunc(); { EXPECT_TRUE(HostFuncAVCodecCtxSetSkipFrame.run( @@ -1268,9 +1130,7 @@ TEST_F(FFmpegTest, AVCodecCtx) { EXPECT_NE(FuncInst, nullptr); EXPECT_TRUE(FuncInst->isHostFunction()); - auto &HostFuncAVCodecCtxSetSkipIdct = dynamic_cast< - WasmEdge::Host::WasmEdgeFFmpeg::AVcodec::AVCodecCtxSetSkipIdct &>( - FuncInst->getHostFunc()); + auto &HostFuncAVCodecCtxSetSkipIdct = FuncInst->getHostFunc(); { EXPECT_TRUE(HostFuncAVCodecCtxSetSkipIdct.run( @@ -1285,9 +1145,7 @@ TEST_F(FFmpegTest, AVCodecCtx) { EXPECT_NE(FuncInst, nullptr); EXPECT_TRUE(FuncInst->isHostFunction()); - auto &HostFuncAVCodecCtxSetErrorConcealment = dynamic_cast< - WasmEdge::Host::WasmEdgeFFmpeg::AVcodec::AVCodecCtxSetErrorConcealment &>( - FuncInst->getHostFunc()); + auto &HostFuncAVCodecCtxSetErrorConcealment = FuncInst->getHostFunc(); { int32_t ErrorConcealment = 99; @@ -1304,9 +1162,7 @@ TEST_F(FFmpegTest, AVCodecCtx) { EXPECT_NE(FuncInst, nullptr); EXPECT_TRUE(FuncInst->isHostFunction()); - auto &HostFuncAVCodecCtxSetErrorRecognition = dynamic_cast< - WasmEdge::Host::WasmEdgeFFmpeg::AVcodec::AVCodecCtxSetErrorRecognition &>( - FuncInst->getHostFunc()); + auto &HostFuncAVCodecCtxSetErrorRecognition = FuncInst->getHostFunc(); { int32_t ErrorRecognition = 88; @@ -1323,9 +1179,7 @@ TEST_F(FFmpegTest, AVCodecCtx) { EXPECT_NE(FuncInst, nullptr); EXPECT_TRUE(FuncInst->isHostFunction()); - auto &HostFuncAVCodecCtxDelay = - dynamic_cast( - FuncInst->getHostFunc()); + auto &HostFuncAVCodecCtxDelay = FuncInst->getHostFunc(); { EXPECT_TRUE(HostFuncAVCodecCtxDelay.run( @@ -1339,9 +1193,7 @@ TEST_F(FFmpegTest, AVCodecCtx) { EXPECT_NE(FuncInst, nullptr); EXPECT_TRUE(FuncInst->isHostFunction()); - auto &HostFuncAVCodecCtxSetSkipTop = dynamic_cast< - WasmEdge::Host::WasmEdgeFFmpeg::AVcodec::AVCodecCtxSetSkipTop &>( - FuncInst->getHostFunc()); + auto &HostFuncAVCodecCtxSetSkipTop = FuncInst->getHostFunc(); { int32_t Value = 50; @@ -1357,9 +1209,7 @@ TEST_F(FFmpegTest, AVCodecCtx) { EXPECT_NE(FuncInst, nullptr); EXPECT_TRUE(FuncInst->isHostFunction()); - auto &HostFuncAVCodecCtxSetSkipBottom = dynamic_cast< - WasmEdge::Host::WasmEdgeFFmpeg::AVcodec::AVCodecCtxSetSkipBottom &>( - FuncInst->getHostFunc()); + auto &HostFuncAVCodecCtxSetSkipBottom = FuncInst->getHostFunc(); { int32_t Value = 60; @@ -1375,9 +1225,7 @@ TEST_F(FFmpegTest, AVCodecCtx) { EXPECT_NE(FuncInst, nullptr); EXPECT_TRUE(FuncInst->isHostFunction()); - auto &HostFuncAVCodecCtxRefs = - dynamic_cast( - FuncInst->getHostFunc()); + auto &HostFuncAVCodecCtxRefs = FuncInst->getHostFunc(); { EXPECT_TRUE(HostFuncAVCodecCtxRefs.run( @@ -1391,9 +1239,7 @@ TEST_F(FFmpegTest, AVCodecCtx) { EXPECT_NE(FuncInst, nullptr); EXPECT_TRUE(FuncInst->isHostFunction()); - auto &HostFuncAVCodecCtxSetSliceFlags = dynamic_cast< - WasmEdge::Host::WasmEdgeFFmpeg::AVcodec::AVCodecCtxSetSliceFlags &>( - FuncInst->getHostFunc()); + auto &HostFuncAVCodecCtxSetSliceFlags = FuncInst->getHostFunc(); { int32_t Value = 70; @@ -1409,9 +1255,7 @@ TEST_F(FFmpegTest, AVCodecCtx) { EXPECT_NE(FuncInst, nullptr); EXPECT_TRUE(FuncInst->isHostFunction()); - auto &HostFuncAVCodecCtxSetSliceCount = dynamic_cast< - WasmEdge::Host::WasmEdgeFFmpeg::AVcodec::AVCodecCtxSetSliceCount &>( - FuncInst->getHostFunc()); + auto &HostFuncAVCodecCtxSetSliceCount = FuncInst->getHostFunc(); { int32_t Value = 100; @@ -1427,9 +1271,7 @@ TEST_F(FFmpegTest, AVCodecCtx) { EXPECT_NE(FuncInst, nullptr); EXPECT_TRUE(FuncInst->isHostFunction()); - auto &HostFuncAVCodecCtxSetFieldOrder = dynamic_cast< - WasmEdge::Host::WasmEdgeFFmpeg::AVcodec::AVCodecCtxSetFieldOrder &>( - FuncInst->getHostFunc()); + auto &HostFuncAVCodecCtxSetFieldOrder = FuncInst->getHostFunc(); { int32_t Value = 200; @@ -1445,9 +1287,7 @@ TEST_F(FFmpegTest, AVCodecCtx) { EXPECT_NE(FuncInst, nullptr); EXPECT_TRUE(FuncInst->isHostFunction()); - auto &HostFuncAVCodecCtxColorTrc = dynamic_cast< - WasmEdge::Host::WasmEdgeFFmpeg::AVcodec::AVCodecCtxColorTrc &>( - FuncInst->getHostFunc()); + auto &HostFuncAVCodecCtxColorTrc = FuncInst->getHostFunc(); { EXPECT_TRUE(HostFuncAVCodecCtxColorTrc.run( @@ -1461,9 +1301,7 @@ TEST_F(FFmpegTest, AVCodecCtx) { EXPECT_NE(FuncInst, nullptr); EXPECT_TRUE(FuncInst->isHostFunction()); - auto &HostFuncAVCodecCtxChromaSampleLocation = dynamic_cast< - WasmEdge::Host::WasmEdgeFFmpeg::AVcodec::AVCodecCtxChromaSampleLocation - &>(FuncInst->getHostFunc()); + auto &HostFuncAVCodecCtxChromaSampleLocation = FuncInst->getHostFunc(); { EXPECT_TRUE(HostFuncAVCodecCtxChromaSampleLocation.run( @@ -1477,9 +1315,7 @@ TEST_F(FFmpegTest, AVCodecCtx) { EXPECT_NE(FuncInst, nullptr); EXPECT_TRUE(FuncInst->isHostFunction()); - auto &HostFuncAVCodecCtxFrameNumber = dynamic_cast< - WasmEdge::Host::WasmEdgeFFmpeg::AVcodec::AVCodecCtxFrameNumber &>( - FuncInst->getHostFunc()); + auto &HostFuncAVCodecCtxFrameNumber = FuncInst->getHostFunc(); { EXPECT_TRUE(HostFuncAVCodecCtxFrameNumber.run( @@ -1493,9 +1329,7 @@ TEST_F(FFmpegTest, AVCodecCtx) { EXPECT_NE(FuncInst, nullptr); EXPECT_TRUE(FuncInst->isHostFunction()); - auto &HostFuncAVCodecCtxBlockAlign = dynamic_cast< - WasmEdge::Host::WasmEdgeFFmpeg::AVcodec::AVCodecCtxBlockAlign &>( - FuncInst->getHostFunc()); + auto &HostFuncAVCodecCtxBlockAlign = FuncInst->getHostFunc(); { EXPECT_TRUE(HostFuncAVCodecCtxBlockAlign.run( @@ -1509,9 +1343,7 @@ TEST_F(FFmpegTest, AVCodecCtx) { EXPECT_NE(FuncInst, nullptr); EXPECT_TRUE(FuncInst->isHostFunction()); - auto &HostFuncAVCodecCtxSetRequestSampleFmt = dynamic_cast< - WasmEdge::Host::WasmEdgeFFmpeg::AVcodec::AVCodecCtxSetRequestSampleFmt &>( - FuncInst->getHostFunc()); + auto &HostFuncAVCodecCtxSetRequestSampleFmt = FuncInst->getHostFunc(); { EXPECT_TRUE(HostFuncAVCodecCtxSetRequestSampleFmt.run( @@ -1526,9 +1358,7 @@ TEST_F(FFmpegTest, AVCodecCtx) { EXPECT_NE(FuncInst, nullptr); EXPECT_TRUE(FuncInst->isHostFunction()); - auto &HostFuncAVCodecCtxAudioServiceType = dynamic_cast< - WasmEdge::Host::WasmEdgeFFmpeg::AVcodec::AVCodecCtxAudioServiceType &>( - FuncInst->getHostFunc()); + auto &HostFuncAVCodecCtxAudioServiceType = FuncInst->getHostFunc(); { EXPECT_TRUE(HostFuncAVCodecCtxAudioServiceType.run( @@ -1542,9 +1372,7 @@ TEST_F(FFmpegTest, AVCodecCtx) { EXPECT_NE(FuncInst, nullptr); EXPECT_TRUE(FuncInst->isHostFunction()); - auto &HostFuncAVCodecCtxHasBFrames = dynamic_cast< - WasmEdge::Host::WasmEdgeFFmpeg::AVcodec::AVCodecCtxHasBFrames &>( - FuncInst->getHostFunc()); + auto &HostFuncAVCodecCtxHasBFrames = FuncInst->getHostFunc(); { EXPECT_TRUE(HostFuncAVCodecCtxHasBFrames.run( @@ -1558,9 +1386,7 @@ TEST_F(FFmpegTest, AVCodecCtx) { EXPECT_NE(FuncInst, nullptr); EXPECT_TRUE(FuncInst->isHostFunction()); - auto &HostFuncAVCodecCtxActiveThreadType = dynamic_cast< - WasmEdge::Host::WasmEdgeFFmpeg::AVcodec::AVCodecCtxActiveThreadType &>( - FuncInst->getHostFunc()); + auto &HostFuncAVCodecCtxActiveThreadType = FuncInst->getHostFunc(); { EXPECT_TRUE(HostFuncAVCodecCtxActiveThreadType.run( @@ -1574,9 +1400,7 @@ TEST_F(FFmpegTest, AVCodecCtx) { EXPECT_NE(FuncInst, nullptr); EXPECT_TRUE(FuncInst->isHostFunction()); - auto &HostFuncAVCodecCtxSetThreadType = dynamic_cast< - WasmEdge::Host::WasmEdgeFFmpeg::AVcodec::AVCodecCtxSetThreadType &>( - FuncInst->getHostFunc()); + auto &HostFuncAVCodecCtxSetThreadType = FuncInst->getHostFunc(); { int32_t ThreadType = 1; // Frame @@ -1592,9 +1416,7 @@ TEST_F(FFmpegTest, AVCodecCtx) { EXPECT_NE(FuncInst, nullptr); EXPECT_TRUE(FuncInst->isHostFunction()); - auto &HostFuncAVCodecCtxSetThreadCount = dynamic_cast< - WasmEdge::Host::WasmEdgeFFmpeg::AVcodec::AVCodecCtxSetThreadCount &>( - FuncInst->getHostFunc()); + auto &HostFuncAVCodecCtxSetThreadCount = FuncInst->getHostFunc(); int32_t ThreadCount = 50; { @@ -1610,9 +1432,7 @@ TEST_F(FFmpegTest, AVCodecCtx) { EXPECT_NE(FuncInst, nullptr); EXPECT_TRUE(FuncInst->isHostFunction()); - auto &HostFuncAVCodecCtxThreadCount = dynamic_cast< - WasmEdge::Host::WasmEdgeFFmpeg::AVcodec::AVCodecCtxThreadCount &>( - FuncInst->getHostFunc()); + auto &HostFuncAVCodecCtxThreadCount = FuncInst->getHostFunc(); { EXPECT_TRUE(HostFuncAVCodecCtxThreadCount.run( @@ -1626,9 +1446,7 @@ TEST_F(FFmpegTest, AVCodecCtx) { EXPECT_NE(FuncInst, nullptr); EXPECT_TRUE(FuncInst->isHostFunction()); - auto &HostFuncAVCodecCtxColorPrimaries = dynamic_cast< - WasmEdge::Host::WasmEdgeFFmpeg::AVcodec::AVCodecCtxColorPrimaries &>( - FuncInst->getHostFunc()); + auto &HostFuncAVCodecCtxColorPrimaries = FuncInst->getHostFunc(); { EXPECT_TRUE(HostFuncAVCodecCtxColorPrimaries.run( diff --git a/test/plugins/wasmedge_ffmpeg/avcodec/avCodecParameters.cpp b/test/plugins/wasmedge_ffmpeg/avcodec/avCodecParameters.cpp index 2bcfdfd4..1b1d83c2 100644 --- a/test/plugins/wasmedge_ffmpeg/avcodec/avCodecParameters.cpp +++ b/test/plugins/wasmedge_ffmpeg/avcodec/avCodecParameters.cpp @@ -30,9 +30,7 @@ TEST_F(FFmpegTest, AVCodecParameters) { EXPECT_NE(FuncInst, nullptr); EXPECT_TRUE(FuncInst->isHostFunction()); - auto &HostFuncAVCodecParamCodecId = dynamic_cast< - WasmEdge::Host::WasmEdgeFFmpeg::AVcodec::AVCodecParamCodecId &>( - FuncInst->getHostFunc()); + auto &HostFuncAVCodecParamCodecId = FuncInst->getHostFunc(); { EXPECT_TRUE(HostFuncAVCodecParamCodecId.run( @@ -46,9 +44,7 @@ TEST_F(FFmpegTest, AVCodecParameters) { EXPECT_NE(FuncInst, nullptr); EXPECT_TRUE(FuncInst->isHostFunction()); - auto &HostFuncAVCodecParamCodecType = dynamic_cast< - WasmEdge::Host::WasmEdgeFFmpeg::AVcodec::AVCodecParamCodecType &>( - FuncInst->getHostFunc()); + auto &HostFuncAVCodecParamCodecType = FuncInst->getHostFunc(); { EXPECT_TRUE(HostFuncAVCodecParamCodecType.run( @@ -62,9 +58,7 @@ TEST_F(FFmpegTest, AVCodecParameters) { EXPECT_NE(FuncInst, nullptr); EXPECT_TRUE(FuncInst->isHostFunction()); - auto &HostFuncAVCodecParamSetCodecTag = dynamic_cast< - WasmEdge::Host::WasmEdgeFFmpeg::AVcodec::AVCodecParamSetCodecTag &>( - FuncInst->getHostFunc()); + auto &HostFuncAVCodecParamSetCodecTag = FuncInst->getHostFunc(); { EXPECT_TRUE(HostFuncAVCodecParamSetCodecTag.run( diff --git a/test/plugins/wasmedge_ffmpeg/avcodec/avPacket.cpp b/test/plugins/wasmedge_ffmpeg/avcodec/avPacket.cpp index fa163e49..f558dc2c 100644 --- a/test/plugins/wasmedge_ffmpeg/avcodec/avPacket.cpp +++ b/test/plugins/wasmedge_ffmpeg/avcodec/avPacket.cpp @@ -26,9 +26,7 @@ TEST_F(FFmpegTest, AVPacketTest) { EXPECT_NE(FuncInst, nullptr); EXPECT_TRUE(FuncInst->isHostFunction()); - auto &HostFuncAVPacketAlloc = - dynamic_cast( - FuncInst->getHostFunc()); + auto &HostFuncAVPacketAlloc = FuncInst->getHostFunc(); { EXPECT_TRUE(HostFuncAVPacketAlloc.run( @@ -52,9 +50,7 @@ TEST_F(FFmpegTest, AVPacketTest) { EXPECT_NE(FuncInst, nullptr); EXPECT_TRUE(FuncInst->isHostFunction()); - auto &HostFuncAVNewPacket = - dynamic_cast( - FuncInst->getHostFunc()); + auto &HostFuncAVNewPacket = FuncInst->getHostFunc(); { uint32_t Size = 40; @@ -68,9 +64,7 @@ TEST_F(FFmpegTest, AVPacketTest) { AVCodecMod->findFuncExports("wasmedge_ffmpeg_avcodec_av_grow_packet"); EXPECT_NE(FuncInst, nullptr); EXPECT_TRUE(FuncInst->isHostFunction()); - auto &HostFuncAVGrowPacket = - dynamic_cast( - FuncInst->getHostFunc()); + auto &HostFuncAVGrowPacket = FuncInst->getHostFunc(); { uint32_t Size = 40; @@ -84,9 +78,7 @@ TEST_F(FFmpegTest, AVPacketTest) { AVCodecMod->findFuncExports("wasmedge_ffmpeg_avcodec_av_shrink_packet"); EXPECT_NE(FuncInst, nullptr); EXPECT_TRUE(FuncInst->isHostFunction()); - auto &HostFuncAVShrinkPacket = - dynamic_cast( - FuncInst->getHostFunc()); + auto &HostFuncAVShrinkPacket = FuncInst->getHostFunc(); { uint32_t Size = 40; @@ -101,9 +93,7 @@ TEST_F(FFmpegTest, AVPacketTest) { "wasmedge_ffmpeg_avcodec_av_packet_set_stream_index"); EXPECT_NE(FuncInst, nullptr); EXPECT_TRUE(FuncInst->isHostFunction()); - auto &HostFuncAVPacketSetStreamIndex = dynamic_cast< - WasmEdge::Host::WasmEdgeFFmpeg::AVcodec::AVPacketSetStreamIndex &>( - FuncInst->getHostFunc()); + auto &HostFuncAVPacketSetStreamIndex = FuncInst->getHostFunc(); { EXPECT_TRUE(HostFuncAVPacketSetStreamIndex.run( @@ -117,9 +107,7 @@ TEST_F(FFmpegTest, AVPacketTest) { "wasmedge_ffmpeg_avcodec_av_packet_stream_index"); EXPECT_NE(FuncInst, nullptr); EXPECT_TRUE(FuncInst->isHostFunction()); - auto &HostFuncAVPacketStreamIndex = dynamic_cast< - WasmEdge::Host::WasmEdgeFFmpeg::AVcodec::AVPacketStreamIndex &>( - FuncInst->getHostFunc()); + auto &HostFuncAVPacketStreamIndex = FuncInst->getHostFunc(); { EXPECT_TRUE(HostFuncAVPacketStreamIndex.run( @@ -133,9 +121,7 @@ TEST_F(FFmpegTest, AVPacketTest) { AVCodecMod->findFuncExports("wasmedge_ffmpeg_avcodec_av_packet_size"); EXPECT_NE(FuncInst, nullptr); EXPECT_TRUE(FuncInst->isHostFunction()); - auto &HostFuncAVPacketSize = - dynamic_cast( - FuncInst->getHostFunc()); + auto &HostFuncAVPacketSize = FuncInst->getHostFunc(); { EXPECT_TRUE(HostFuncAVPacketSize.run( @@ -151,9 +137,7 @@ TEST_F(FFmpegTest, AVPacketTest) { "wasmedge_ffmpeg_avcodec_av_packet_set_flags"); EXPECT_NE(FuncInst, nullptr); EXPECT_TRUE(FuncInst->isHostFunction()); - auto &HostFuncAVPacketSetFlags = - dynamic_cast( - FuncInst->getHostFunc()); + auto &HostFuncAVPacketSetFlags = FuncInst->getHostFunc(); { EXPECT_TRUE(HostFuncAVPacketSetFlags.run( @@ -166,9 +150,7 @@ TEST_F(FFmpegTest, AVPacketTest) { AVCodecMod->findFuncExports("wasmedge_ffmpeg_avcodec_av_packet_flags"); EXPECT_NE(FuncInst, nullptr); EXPECT_TRUE(FuncInst->isHostFunction()); - auto &HostFuncAVPacketFlags = - dynamic_cast( - FuncInst->getHostFunc()); + auto &HostFuncAVPacketFlags = FuncInst->getHostFunc(); { EXPECT_TRUE(HostFuncAVPacketFlags.run( @@ -182,9 +164,7 @@ TEST_F(FFmpegTest, AVPacketTest) { AVCodecMod->findFuncExports("wasmedge_ffmpeg_avcodec_av_packet_set_pos"); EXPECT_NE(FuncInst, nullptr); EXPECT_TRUE(FuncInst->isHostFunction()); - auto &HostFuncAVPacketSetPos = - dynamic_cast( - FuncInst->getHostFunc()); + auto &HostFuncAVPacketSetPos = FuncInst->getHostFunc(); { EXPECT_TRUE(HostFuncAVPacketSetPos.run( @@ -197,9 +177,7 @@ TEST_F(FFmpegTest, AVPacketTest) { AVCodecMod->findFuncExports("wasmedge_ffmpeg_avcodec_av_packet_pos"); EXPECT_NE(FuncInst, nullptr); EXPECT_TRUE(FuncInst->isHostFunction()); - auto &HostFuncAVPacketPos = - dynamic_cast( - FuncInst->getHostFunc()); + auto &HostFuncAVPacketPos = FuncInst->getHostFunc(); { EXPECT_TRUE(HostFuncAVPacketPos.run( @@ -213,9 +191,7 @@ TEST_F(FFmpegTest, AVPacketTest) { "wasmedge_ffmpeg_avcodec_av_packet_set_duration"); EXPECT_NE(FuncInst, nullptr); EXPECT_TRUE(FuncInst->isHostFunction()); - auto &HostFuncAVPacketSetDuration = dynamic_cast< - WasmEdge::Host::WasmEdgeFFmpeg::AVcodec::AVPacketSetDuration &>( - FuncInst->getHostFunc()); + auto &HostFuncAVPacketSetDuration = FuncInst->getHostFunc(); { EXPECT_TRUE(HostFuncAVPacketSetDuration.run( @@ -229,9 +205,7 @@ TEST_F(FFmpegTest, AVPacketTest) { AVCodecMod->findFuncExports("wasmedge_ffmpeg_avcodec_av_packet_duration"); EXPECT_NE(FuncInst, nullptr); EXPECT_TRUE(FuncInst->isHostFunction()); - auto &HostFuncAVPacketDuration = - dynamic_cast( - FuncInst->getHostFunc()); + auto &HostFuncAVPacketDuration = FuncInst->getHostFunc(); { EXPECT_TRUE(HostFuncAVPacketDuration.run( @@ -245,9 +219,7 @@ TEST_F(FFmpegTest, AVPacketTest) { AVCodecMod->findFuncExports("wasmedge_ffmpeg_avcodec_av_packet_set_dts"); EXPECT_NE(FuncInst, nullptr); EXPECT_TRUE(FuncInst->isHostFunction()); - auto &HostFuncAVPacketSetDts = - dynamic_cast( - FuncInst->getHostFunc()); + auto &HostFuncAVPacketSetDts = FuncInst->getHostFunc(); { EXPECT_TRUE(HostFuncAVPacketSetDts.run( @@ -260,9 +232,7 @@ TEST_F(FFmpegTest, AVPacketTest) { AVCodecMod->findFuncExports("wasmedge_ffmpeg_avcodec_av_packet_dts"); EXPECT_NE(FuncInst, nullptr); EXPECT_TRUE(FuncInst->isHostFunction()); - auto &HostFuncAVPacketDts = - dynamic_cast( - FuncInst->getHostFunc()); + auto &HostFuncAVPacketDts = FuncInst->getHostFunc(); { EXPECT_TRUE(HostFuncAVPacketDts.run( @@ -276,9 +246,7 @@ TEST_F(FFmpegTest, AVPacketTest) { AVCodecMod->findFuncExports("wasmedge_ffmpeg_avcodec_av_packet_set_pts"); EXPECT_NE(FuncInst, nullptr); EXPECT_TRUE(FuncInst->isHostFunction()); - auto &HostFuncAVPacketSetPts = - dynamic_cast( - FuncInst->getHostFunc()); + auto &HostFuncAVPacketSetPts = FuncInst->getHostFunc(); { EXPECT_TRUE(HostFuncAVPacketSetPts.run( @@ -291,9 +259,7 @@ TEST_F(FFmpegTest, AVPacketTest) { AVCodecMod->findFuncExports("wasmedge_ffmpeg_avcodec_av_packet_pts"); EXPECT_NE(FuncInst, nullptr); EXPECT_TRUE(FuncInst->isHostFunction()); - auto &HostFuncAVPacketPts = - dynamic_cast( - FuncInst->getHostFunc()); + auto &HostFuncAVPacketPts = FuncInst->getHostFunc(); { EXPECT_TRUE(HostFuncAVPacketPts.run( @@ -306,9 +272,7 @@ TEST_F(FFmpegTest, AVPacketTest) { "wasmedge_ffmpeg_avcodec_av_packet_is_data_null"); EXPECT_NE(FuncInst, nullptr); EXPECT_TRUE(FuncInst->isHostFunction()); - auto &HostFuncAVPacketIsDataNull = dynamic_cast< - WasmEdge::Host::WasmEdgeFFmpeg::AVcodec::AVPacketIsDataNull &>( - FuncInst->getHostFunc()); + auto &HostFuncAVPacketIsDataNull = FuncInst->getHostFunc(); { EXPECT_TRUE(HostFuncAVPacketIsDataNull.run( @@ -321,9 +285,7 @@ TEST_F(FFmpegTest, AVPacketTest) { AVCodecMod->findFuncExports("wasmedge_ffmpeg_avcodec_av_packet_data"); EXPECT_NE(FuncInst, nullptr); EXPECT_TRUE(FuncInst->isHostFunction()); - auto &HostFuncAVPacketData = - dynamic_cast( - FuncInst->getHostFunc()); + auto &HostFuncAVPacketData = FuncInst->getHostFunc(); { EXPECT_TRUE(HostFuncAVPacketData.run( @@ -338,9 +300,7 @@ TEST_F(FFmpegTest, AVPacketTest) { EXPECT_NE(FuncInst, nullptr); EXPECT_TRUE(FuncInst->isHostFunction()); - auto &HostFuncAVPacketRef = - dynamic_cast( - FuncInst->getHostFunc()); + auto &HostFuncAVPacketRef = FuncInst->getHostFunc(); { EXPECT_TRUE(HostFuncAVPacketRef.run( @@ -355,9 +315,7 @@ TEST_F(FFmpegTest, AVPacketTest) { EXPECT_NE(FuncInst, nullptr); EXPECT_TRUE(FuncInst->isHostFunction()); - auto &HostFuncAVPacketUnref = - dynamic_cast( - FuncInst->getHostFunc()); + auto &HostFuncAVPacketUnref = FuncInst->getHostFunc(); { EXPECT_TRUE(HostFuncAVPacketUnref.run( diff --git a/test/plugins/wasmedge_ffmpeg/avcodec/avcodec_func.cpp b/test/plugins/wasmedge_ffmpeg/avcodec/avcodec_func.cpp index f82fb2d6..09816de3 100644 --- a/test/plugins/wasmedge_ffmpeg/avcodec/avcodec_func.cpp +++ b/test/plugins/wasmedge_ffmpeg/avcodec/avcodec_func.cpp @@ -36,9 +36,7 @@ TEST_F(FFmpegTest, AVCodecFunc) { EXPECT_NE(FuncInst, nullptr); EXPECT_TRUE(FuncInst->isHostFunction()); - auto &HostFuncAVCodecAllocContext3 = dynamic_cast< - WasmEdge::Host::WasmEdgeFFmpeg::AVcodec::AVCodecAllocContext3 &>( - FuncInst->getHostFunc()); + auto &HostFuncAVCodecAllocContext3 = FuncInst->getHostFunc(); spdlog::info("Testing AvCodecAllocContext3"sv); { @@ -56,9 +54,7 @@ TEST_F(FFmpegTest, AVCodecFunc) { EXPECT_NE(FuncInst, nullptr); EXPECT_TRUE(FuncInst->isHostFunction()); - auto &HostFuncAVCodecParametersAlloc = dynamic_cast< - WasmEdge::Host::WasmEdgeFFmpeg::AVcodec::AVCodecParametersAlloc &>( - FuncInst->getHostFunc()); + auto &HostFuncAVCodecParametersAlloc = FuncInst->getHostFunc(); spdlog::info("Testing AVCodecParametersAlloc"sv); { @@ -84,9 +80,7 @@ TEST_F(FFmpegTest, AVCodecFunc) { EXPECT_NE(FuncInst, nullptr); EXPECT_TRUE(FuncInst->isHostFunction()); - auto &HostFuncAVCodecParametersFromContext = dynamic_cast< - WasmEdge::Host::WasmEdgeFFmpeg::AVcodec::AVCodecParametersFromContext &>( - FuncInst->getHostFunc()); + auto &HostFuncAVCodecParametersFromContext = FuncInst->getHostFunc(); spdlog::info("Testing AVCodecParametersFromContext"sv); { @@ -103,9 +97,7 @@ TEST_F(FFmpegTest, AVCodecFunc) { EXPECT_NE(FuncInst, nullptr); EXPECT_TRUE(FuncInst->isHostFunction()); - auto &HostFuncAVCodecGetType = - dynamic_cast( - FuncInst->getHostFunc()); + auto &HostFuncAVCodecGetType = FuncInst->getHostFunc(); spdlog::info("Testing AVCodecGetType"sv); { @@ -119,9 +111,7 @@ TEST_F(FFmpegTest, AVCodecFunc) { EXPECT_NE(FuncInst, nullptr); EXPECT_TRUE(FuncInst->isHostFunction()); - auto &HostFuncAVCodecFindDecoder = dynamic_cast< - WasmEdge::Host::WasmEdgeFFmpeg::AVcodec::AVCodecFindDecoder &>( - FuncInst->getHostFunc()); + auto &HostFuncAVCodecFindDecoder = FuncInst->getHostFunc(); spdlog::info("Testing AVCodecFindDecoder"sv); { @@ -140,9 +130,7 @@ TEST_F(FFmpegTest, AVCodecFunc) { EXPECT_NE(FuncInst, nullptr); EXPECT_TRUE(FuncInst->isHostFunction()); - auto &HostFuncAVCodecFindEncoder = dynamic_cast< - WasmEdge::Host::WasmEdgeFFmpeg::AVcodec::AVCodecFindEncoder &>( - FuncInst->getHostFunc()); + auto &HostFuncAVCodecFindEncoder = FuncInst->getHostFunc(); spdlog::info("Testing AVCodecFindEncoder"sv); { @@ -161,9 +149,7 @@ TEST_F(FFmpegTest, AVCodecFunc) { EXPECT_NE(FuncInst, nullptr); EXPECT_TRUE(FuncInst->isHostFunction()); - auto &HostFuncAVCodecOpen2 = - dynamic_cast( - FuncInst->getHostFunc()); + auto &HostFuncAVCodecOpen2 = FuncInst->getHostFunc(); spdlog::info("Testing AVCodecOpen2"sv); // Invalid argument passed. Return -22 Error code. Means functionality @@ -182,9 +168,7 @@ TEST_F(FFmpegTest, AVCodecFunc) { EXPECT_NE(FuncInst, nullptr); EXPECT_TRUE(FuncInst->isHostFunction()); - auto &HostFuncAVCodecIsEncoder = - dynamic_cast( - FuncInst->getHostFunc()); + auto &HostFuncAVCodecIsEncoder = FuncInst->getHostFunc(); spdlog::info("Testing AVCodecIsEncoder"sv); { @@ -199,9 +183,7 @@ TEST_F(FFmpegTest, AVCodecFunc) { EXPECT_NE(FuncInst, nullptr); EXPECT_TRUE(FuncInst->isHostFunction()); - auto &HostFuncAVCodecIsDecoder = - dynamic_cast( - FuncInst->getHostFunc()); + auto &HostFuncAVCodecIsDecoder = FuncInst->getHostFunc(); spdlog::info("Testing AVCodecIsDecoder"sv); { @@ -216,9 +198,7 @@ TEST_F(FFmpegTest, AVCodecFunc) { EXPECT_NE(FuncInst, nullptr); EXPECT_TRUE(FuncInst->isHostFunction()); - auto &HostFuncAVCodecFindDecoderByName = dynamic_cast< - WasmEdge::Host::WasmEdgeFFmpeg::AVcodec::AVCodecFindDecoderByName &>( - FuncInst->getHostFunc()); + auto &HostFuncAVCodecFindDecoderByName = FuncInst->getHostFunc(); spdlog::info("Testing AVCodecFindDecoderByName"sv); { @@ -236,9 +216,7 @@ TEST_F(FFmpegTest, AVCodecFunc) { EXPECT_NE(FuncInst, nullptr); EXPECT_TRUE(FuncInst->isHostFunction()); - auto &HostFuncAVCodecFindEncoderByName = dynamic_cast< - WasmEdge::Host::WasmEdgeFFmpeg::AVcodec::AVCodecFindEncoderByName &>( - FuncInst->getHostFunc()); + auto &HostFuncAVCodecFindEncoderByName = FuncInst->getHostFunc(); spdlog::info("Testing AVCodecFindEncoderByName"sv); { @@ -256,9 +234,7 @@ TEST_F(FFmpegTest, AVCodecFunc) { EXPECT_NE(FuncInst, nullptr); EXPECT_TRUE(FuncInst->isHostFunction()); - auto &HostFuncAVCodecParametersToContext = dynamic_cast< - WasmEdge::Host::WasmEdgeFFmpeg::AVcodec::AVCodecParametersToContext &>( - FuncInst->getHostFunc()); + auto &HostFuncAVCodecParametersToContext = FuncInst->getHostFunc(); spdlog::info("Testing AVCodecParametersToContext"sv); { @@ -291,9 +267,7 @@ TEST_F(FFmpegTest, AVCodecFunc) { EXPECT_NE(FuncInst, nullptr); EXPECT_TRUE(FuncInst->isHostFunction()); - auto &HostFuncAVCodecVersion = - dynamic_cast( - FuncInst->getHostFunc()); + auto &HostFuncAVCodecVersion = FuncInst->getHostFunc(); spdlog::info("Testing AVCodecVersion"sv); { @@ -307,9 +281,7 @@ TEST_F(FFmpegTest, AVCodecFunc) { EXPECT_NE(FuncInst, nullptr); EXPECT_TRUE(FuncInst->isHostFunction()); - auto &HostFuncAVCodecConfigurationLength = dynamic_cast< - WasmEdge::Host::WasmEdgeFFmpeg::AVcodec::AVCodecConfigurationLength &>( - FuncInst->getHostFunc()); + auto &HostFuncAVCodecConfigurationLength = FuncInst->getHostFunc(); spdlog::info("Testing AVCodecConfigurationLength"sv); int32_t Length = 0; @@ -325,9 +297,7 @@ TEST_F(FFmpegTest, AVCodecFunc) { EXPECT_NE(FuncInst, nullptr); EXPECT_TRUE(FuncInst->isHostFunction()); - auto &HostFuncAVCodecConfiguration = dynamic_cast< - WasmEdge::Host::WasmEdgeFFmpeg::AVcodec::AVCodecConfiguration &>( - FuncInst->getHostFunc()); + auto &HostFuncAVCodecConfiguration = FuncInst->getHostFunc(); spdlog::info("Testing AVCodecConfiguration"sv); { @@ -342,9 +312,7 @@ TEST_F(FFmpegTest, AVCodecFunc) { EXPECT_NE(FuncInst, nullptr); EXPECT_TRUE(FuncInst->isHostFunction()); - auto &HostFuncAVCodecLicenseLength = dynamic_cast< - WasmEdge::Host::WasmEdgeFFmpeg::AVcodec::AVCodecLicenseLength &>( - FuncInst->getHostFunc()); + auto &HostFuncAVCodecLicenseLength = FuncInst->getHostFunc(); spdlog::info("Testing AVCodecLicenseLength"sv); { @@ -360,9 +328,7 @@ TEST_F(FFmpegTest, AVCodecFunc) { EXPECT_NE(FuncInst, nullptr); EXPECT_TRUE(FuncInst->isHostFunction()); - auto &HostFuncAVCodecLicense = - dynamic_cast( - FuncInst->getHostFunc()); + auto &HostFuncAVCodecLicense = FuncInst->getHostFunc(); spdlog::info("Testing AVCodecLicense"sv); { @@ -377,9 +343,7 @@ TEST_F(FFmpegTest, AVCodecFunc) { EXPECT_NE(FuncInst, nullptr); EXPECT_TRUE(FuncInst->isHostFunction()); - auto &HostFuncAVCodecFreeContext = dynamic_cast< - WasmEdge::Host::WasmEdgeFFmpeg::AVcodec::AVCodecFreeContext &>( - FuncInst->getHostFunc()); + auto &HostFuncAVCodecFreeContext = FuncInst->getHostFunc(); spdlog::info("Testing AVCodecFreeContext"sv); { @@ -394,9 +358,7 @@ TEST_F(FFmpegTest, AVCodecFunc) { EXPECT_NE(FuncInst, nullptr); EXPECT_TRUE(FuncInst->isHostFunction()); - auto &HostFuncAVCodecParametersFree = dynamic_cast< - WasmEdge::Host::WasmEdgeFFmpeg::AVcodec::AVCodecParametersFree &>( - FuncInst->getHostFunc()); + auto &HostFuncAVCodecParametersFree = FuncInst->getHostFunc(); spdlog::info("Testing AVCodecParametersFree"sv); { @@ -424,9 +386,7 @@ TEST_F(FFmpegTest, SendPacketReceiveFrame) { EXPECT_NE(FuncInst, nullptr); EXPECT_TRUE(FuncInst->isHostFunction()); - auto &HostFuncAVCodecSendFrame = - dynamic_cast( - FuncInst->getHostFunc()); + auto &HostFuncAVCodecSendFrame = FuncInst->getHostFunc(); spdlog::info("Testing AVCodecSendFrame"sv); // Invalid Argument Error. Should Use Encoder, I'm using decoder @@ -446,9 +406,7 @@ TEST_F(FFmpegTest, SendPacketReceiveFrame) { EXPECT_NE(FuncInst, nullptr); EXPECT_TRUE(FuncInst->isHostFunction()); - auto &HostFuncAVCodecReceivePacket = dynamic_cast< - WasmEdge::Host::WasmEdgeFFmpeg::AVcodec::AVCodecReceivePacket &>( - FuncInst->getHostFunc()); + auto &HostFuncAVCodecReceivePacket = FuncInst->getHostFunc(); spdlog::info("Testing AVCodecReceivePacket"sv); { @@ -464,9 +422,7 @@ TEST_F(FFmpegTest, SendPacketReceiveFrame) { EXPECT_NE(FuncInst, nullptr); EXPECT_TRUE(FuncInst->isHostFunction()); - auto &HostFuncAVCodecSendPacket = dynamic_cast< - WasmEdge::Host::WasmEdgeFFmpeg::AVcodec::AVCodecSendPacket &>( - FuncInst->getHostFunc()); + auto &HostFuncAVCodecSendPacket = FuncInst->getHostFunc(); spdlog::info("Testing AVCodecSendPacket"sv); // Send packet to Decoder. @@ -484,9 +440,7 @@ TEST_F(FFmpegTest, SendPacketReceiveFrame) { EXPECT_TRUE(FuncInst->isHostFunction()); // Decoder Receives the Packet as Frame. - auto &HostFuncAVCodecReceiveFrame = dynamic_cast< - WasmEdge::Host::WasmEdgeFFmpeg::AVcodec::AVCodecReceiveFrame &>( - FuncInst->getHostFunc()); + auto &HostFuncAVCodecReceiveFrame = FuncInst->getHostFunc(); spdlog::info("Testing AVCodecReceiveFrame"sv); { @@ -502,9 +456,7 @@ TEST_F(FFmpegTest, SendPacketReceiveFrame) { EXPECT_NE(FuncInst, nullptr); EXPECT_TRUE(FuncInst->isHostFunction()); - auto &HostFuncAVPacketRescaleTs = dynamic_cast< - WasmEdge::Host::WasmEdgeFFmpeg::AVcodec::AVPacketRescaleTs &>( - FuncInst->getHostFunc()); + auto &HostFuncAVPacketRescaleTs = FuncInst->getHostFunc(); spdlog::info("Testing AVPacketRescaleTs"sv); { @@ -525,9 +477,7 @@ TEST_F(FFmpegTest, SendPacketReceiveFrame) { EXPECT_NE(FuncInst, nullptr); EXPECT_TRUE(FuncInst->isHostFunction()); - auto &HostFuncAVPacketMakeWritable = dynamic_cast< - WasmEdge::Host::WasmEdgeFFmpeg::AVcodec::AVPacketMakeWritable &>( - FuncInst->getHostFunc()); + auto &HostFuncAVPacketMakeWritable = FuncInst->getHostFunc(); spdlog::info("Testing AVPacketMakeWritable"sv); { @@ -542,9 +492,7 @@ TEST_F(FFmpegTest, SendPacketReceiveFrame) { EXPECT_NE(FuncInst, nullptr); EXPECT_TRUE(FuncInst->isHostFunction()); - auto &HostFuncAVCodecFlushBuffers = dynamic_cast< - WasmEdge::Host::WasmEdgeFFmpeg::AVcodec::AVCodecFlushBuffers &>( - FuncInst->getHostFunc()); + auto &HostFuncAVCodecFlushBuffers = FuncInst->getHostFunc(); spdlog::info("Testing AVCodecFlushBuffers"sv); { @@ -559,9 +507,7 @@ TEST_F(FFmpegTest, SendPacketReceiveFrame) { EXPECT_NE(FuncInst, nullptr); EXPECT_TRUE(FuncInst->isHostFunction()); - auto &HostFuncAVCodecClose = - dynamic_cast( - FuncInst->getHostFunc()); + auto &HostFuncAVCodecClose = FuncInst->getHostFunc(); spdlog::info("Testing AVCodecClose"sv); { diff --git a/test/plugins/wasmedge_ffmpeg/avfilter/avfilter.cpp b/test/plugins/wasmedge_ffmpeg/avfilter/avfilter.cpp index c96448a2..7910e90b 100644 --- a/test/plugins/wasmedge_ffmpeg/avfilter/avfilter.cpp +++ b/test/plugins/wasmedge_ffmpeg/avfilter/avfilter.cpp @@ -34,9 +34,7 @@ TEST_F(FFmpegTest, AVFilterStructs) { EXPECT_NE(FuncInst, nullptr); EXPECT_TRUE(FuncInst->isHostFunction()); - auto &HostFuncAVFilterGetByName = dynamic_cast< - WasmEdge::Host::WasmEdgeFFmpeg::AVFilter::AVFilterGetByName &>( - FuncInst->getHostFunc()); + auto &HostFuncAVFilterGetByName = FuncInst->getHostFunc(); { int32_t Length = InputName.length(); @@ -59,9 +57,7 @@ TEST_F(FFmpegTest, AVFilterStructs) { EXPECT_NE(FuncInst, nullptr); EXPECT_TRUE(FuncInst->isHostFunction()); - auto &HostFuncAVFilterNameLength = dynamic_cast< - WasmEdge::Host::WasmEdgeFFmpeg::AVFilter::AVFilterNameLength &>( - FuncInst->getHostFunc()); + auto &HostFuncAVFilterNameLength = FuncInst->getHostFunc(); int32_t Length = 0; { @@ -77,9 +73,7 @@ TEST_F(FFmpegTest, AVFilterStructs) { EXPECT_NE(FuncInst, nullptr); EXPECT_TRUE(FuncInst->isHostFunction()); - auto &HostFuncAVFilterName = - dynamic_cast( - FuncInst->getHostFunc()); + auto &HostFuncAVFilterName = FuncInst->getHostFunc(); fillMemContent(MemInst, StrPtr, Length); { @@ -95,9 +89,7 @@ TEST_F(FFmpegTest, AVFilterStructs) { EXPECT_NE(FuncInst, nullptr); EXPECT_TRUE(FuncInst->isHostFunction()); - auto &HostFuncAVFilterDescriptionLength = dynamic_cast< - WasmEdge::Host::WasmEdgeFFmpeg::AVFilter::AVFilterDescriptionLength &>( - FuncInst->getHostFunc()); + auto &HostFuncAVFilterDescriptionLength = FuncInst->getHostFunc(); { EXPECT_TRUE(HostFuncAVFilterDescriptionLength.run( @@ -113,9 +105,7 @@ TEST_F(FFmpegTest, AVFilterStructs) { EXPECT_NE(FuncInst, nullptr); EXPECT_TRUE(FuncInst->isHostFunction()); - auto &HostFuncAVFilterDescription = dynamic_cast< - WasmEdge::Host::WasmEdgeFFmpeg::AVFilter::AVFilterDescription &>( - FuncInst->getHostFunc()); + auto &HostFuncAVFilterDescription = FuncInst->getHostFunc(); fillMemContent(MemInst, StrPtr, Length); { @@ -131,9 +121,7 @@ TEST_F(FFmpegTest, AVFilterStructs) { EXPECT_NE(FuncInst, nullptr); EXPECT_TRUE(FuncInst->isHostFunction()); - auto &HostFuncAVFilterNbInputs = dynamic_cast< - WasmEdge::Host::WasmEdgeFFmpeg::AVFilter::AVFilterNbInputs &>( - FuncInst->getHostFunc()); + auto &HostFuncAVFilterNbInputs = FuncInst->getHostFunc(); { EXPECT_TRUE(HostFuncAVFilterNbInputs.run( @@ -147,9 +135,7 @@ TEST_F(FFmpegTest, AVFilterStructs) { EXPECT_NE(FuncInst, nullptr); EXPECT_TRUE(FuncInst->isHostFunction()); - auto &HostFuncAVFilterNbOutputs = dynamic_cast< - WasmEdge::Host::WasmEdgeFFmpeg::AVFilter::AVFilterNbOutputs &>( - FuncInst->getHostFunc()); + auto &HostFuncAVFilterNbOutputs = FuncInst->getHostFunc(); { EXPECT_TRUE(HostFuncAVFilterNbOutputs.run( @@ -163,9 +149,7 @@ TEST_F(FFmpegTest, AVFilterStructs) { EXPECT_NE(FuncInst, nullptr); EXPECT_TRUE(FuncInst->isHostFunction()); - auto &HostFuncAVFilterFlags = - dynamic_cast( - FuncInst->getHostFunc()); + auto &HostFuncAVFilterFlags = FuncInst->getHostFunc(); { EXPECT_TRUE(HostFuncAVFilterFlags.run( @@ -179,9 +163,7 @@ TEST_F(FFmpegTest, AVFilterStructs) { EXPECT_NE(FuncInst, nullptr); EXPECT_TRUE(FuncInst->isHostFunction()); - auto &HostFuncAVFilterGetInputsFilterPad = dynamic_cast< - WasmEdge::Host::WasmEdgeFFmpeg::AVFilter::AVFilterGetInputsFilterPad &>( - FuncInst->getHostFunc()); + auto &HostFuncAVFilterGetInputsFilterPad = FuncInst->getHostFunc(); { EXPECT_TRUE(HostFuncAVFilterGetInputsFilterPad.run( @@ -197,9 +179,7 @@ TEST_F(FFmpegTest, AVFilterStructs) { EXPECT_NE(FuncInst, nullptr); EXPECT_TRUE(FuncInst->isHostFunction()); - auto &HostFuncAVFilterGetOutputsFilterPad = dynamic_cast< - WasmEdge::Host::WasmEdgeFFmpeg::AVFilter::AVFilterGetOutputsFilterPad &>( - FuncInst->getHostFunc()); + auto &HostFuncAVFilterGetOutputsFilterPad = FuncInst->getHostFunc(); { EXPECT_TRUE(HostFuncAVFilterGetOutputsFilterPad.run( @@ -218,9 +198,7 @@ TEST_F(FFmpegTest, AVFilterStructs) { EXPECT_NE(FuncInst, nullptr); EXPECT_TRUE(FuncInst->isHostFunction()); - auto &HostFuncAVFilterPadGetNameLength = dynamic_cast< - WasmEdge::Host::WasmEdgeFFmpeg::AVFilter::AVFilterPadGetNameLength &>( - FuncInst->getHostFunc()); + auto &HostFuncAVFilterPadGetNameLength = FuncInst->getHostFunc(); { EXPECT_TRUE(HostFuncAVFilterPadGetNameLength.run( @@ -236,9 +214,7 @@ TEST_F(FFmpegTest, AVFilterStructs) { EXPECT_NE(FuncInst, nullptr); EXPECT_TRUE(FuncInst->isHostFunction()); - auto &HostFuncAVFilterPadGetName = dynamic_cast< - WasmEdge::Host::WasmEdgeFFmpeg::AVFilter::AVFilterPadGetName &>( - FuncInst->getHostFunc()); + auto &HostFuncAVFilterPadGetName = FuncInst->getHostFunc(); { int32_t Idx = 0; @@ -255,9 +231,7 @@ TEST_F(FFmpegTest, AVFilterStructs) { EXPECT_NE(FuncInst, nullptr); EXPECT_TRUE(FuncInst->isHostFunction()); - auto &HostFuncAVFilterPadGetType = dynamic_cast< - WasmEdge::Host::WasmEdgeFFmpeg::AVFilter::AVFilterPadGetType &>( - FuncInst->getHostFunc()); + auto &HostFuncAVFilterPadGetType = FuncInst->getHostFunc(); { int32_t Idx = 0; @@ -273,9 +247,7 @@ TEST_F(FFmpegTest, AVFilterStructs) { EXPECT_NE(FuncInst, nullptr); EXPECT_TRUE(FuncInst->isHostFunction()); - auto &HostFuncAVFilterPadDrop = - dynamic_cast( - FuncInst->getHostFunc()); + auto &HostFuncAVFilterPadDrop = FuncInst->getHostFunc(); { EXPECT_TRUE(HostFuncAVFilterPadDrop.run( diff --git a/test/plugins/wasmedge_ffmpeg/avfilter/avfilter_func.cpp b/test/plugins/wasmedge_ffmpeg/avfilter/avfilter_func.cpp index 1e50b401..ed40780a 100644 --- a/test/plugins/wasmedge_ffmpeg/avfilter/avfilter_func.cpp +++ b/test/plugins/wasmedge_ffmpeg/avfilter/avfilter_func.cpp @@ -63,9 +63,7 @@ TEST_F(FFmpegTest, AVFilterFunc) { EXPECT_NE(FuncInst, nullptr); EXPECT_TRUE(FuncInst->isHostFunction()); - auto &HostFuncAVFilterGraphAlloc = dynamic_cast< - WasmEdge::Host::WasmEdgeFFmpeg::AVFilter::AVFilterGraphAlloc &>( - FuncInst->getHostFunc()); + auto &HostFuncAVFilterGraphAlloc = FuncInst->getHostFunc(); { EXPECT_TRUE(HostFuncAVFilterGraphAlloc.run( @@ -82,9 +80,7 @@ TEST_F(FFmpegTest, AVFilterFunc) { EXPECT_NE(FuncInst, nullptr); EXPECT_TRUE(FuncInst->isHostFunction()); - auto &HostFuncAVFilterGetByName = dynamic_cast< - WasmEdge::Host::WasmEdgeFFmpeg::AVFilter::AVFilterGetByName &>( - FuncInst->getHostFunc()); + auto &HostFuncAVFilterGetByName = FuncInst->getHostFunc(); { int32_t Length = InputName.length(); @@ -114,9 +110,7 @@ TEST_F(FFmpegTest, AVFilterFunc) { EXPECT_NE(FuncInst, nullptr); EXPECT_TRUE(FuncInst->isHostFunction()); - auto &HostFuncAVFilterGraphCreateFilter = dynamic_cast< - WasmEdge::Host::WasmEdgeFFmpeg::AVFilter::AVFilterGraphCreateFilter &>( - FuncInst->getHostFunc()); + auto &HostFuncAVFilterGraphCreateFilter = FuncInst->getHostFunc(); { int32_t NameLen = InputFilterName.length(); @@ -146,9 +140,7 @@ TEST_F(FFmpegTest, AVFilterFunc) { EXPECT_NE(FuncInst, nullptr); EXPECT_TRUE(FuncInst->isHostFunction()); - auto &HostFuncAVFilterInOutAlloc = dynamic_cast< - WasmEdge::Host::WasmEdgeFFmpeg::AVFilter::AVFilterInOutAlloc &>( - FuncInst->getHostFunc()); + auto &HostFuncAVFilterInOutAlloc = FuncInst->getHostFunc(); { EXPECT_TRUE(HostFuncAVFilterInOutAlloc.run( @@ -173,9 +165,7 @@ TEST_F(FFmpegTest, AVFilterFunc) { EXPECT_NE(FuncInst, nullptr); EXPECT_TRUE(FuncInst->isHostFunction()); - auto &HostFuncAVFilterGraphGetFilter = dynamic_cast< - WasmEdge::Host::WasmEdgeFFmpeg::AVFilter::AVFilterGraphGetFilter &>( - FuncInst->getHostFunc()); + auto &HostFuncAVFilterGraphGetFilter = FuncInst->getHostFunc(); { int32_t Length = OutputFilterName.length(); @@ -210,9 +200,7 @@ TEST_F(FFmpegTest, AVFilterFunc) { EXPECT_NE(FuncInst, nullptr); EXPECT_TRUE(FuncInst->isHostFunction()); - auto &HostFuncAVFilterInOutSetName = dynamic_cast< - WasmEdge::Host::WasmEdgeFFmpeg::AVFilter::AVFilterInOutSetName &>( - FuncInst->getHostFunc()); + auto &HostFuncAVFilterInOutSetName = FuncInst->getHostFunc(); { int32_t Length = InputFilterName.length(); @@ -237,9 +225,7 @@ TEST_F(FFmpegTest, AVFilterFunc) { EXPECT_NE(FuncInst, nullptr); EXPECT_TRUE(FuncInst->isHostFunction()); - auto &HostFuncAVFilterInOutSetFilterCtx = dynamic_cast< - WasmEdge::Host::WasmEdgeFFmpeg::AVFilter::AVFilterInOutSetFilterCtx &>( - FuncInst->getHostFunc()); + auto &HostFuncAVFilterInOutSetFilterCtx = FuncInst->getHostFunc(); { EXPECT_TRUE(HostFuncAVFilterInOutSetFilterCtx.run( @@ -262,9 +248,7 @@ TEST_F(FFmpegTest, AVFilterFunc) { EXPECT_NE(FuncInst, nullptr); EXPECT_TRUE(FuncInst->isHostFunction()); - auto &HostFuncAVFilterInOutSetPadIdx = dynamic_cast< - WasmEdge::Host::WasmEdgeFFmpeg::AVFilter::AVFilterInOutSetPadIdx &>( - FuncInst->getHostFunc()); + auto &HostFuncAVFilterInOutSetPadIdx = FuncInst->getHostFunc(); { EXPECT_TRUE(HostFuncAVFilterInOutSetPadIdx.run( @@ -283,9 +267,7 @@ TEST_F(FFmpegTest, AVFilterFunc) { EXPECT_NE(FuncInst, nullptr); EXPECT_TRUE(FuncInst->isHostFunction()); - auto &HostFuncAVFilterInOutSetNext = dynamic_cast< - WasmEdge::Host::WasmEdgeFFmpeg::AVFilter::AVFilterInOutSetNext &>( - FuncInst->getHostFunc()); + auto &HostFuncAVFilterInOutSetNext = FuncInst->getHostFunc(); { EXPECT_TRUE(HostFuncAVFilterInOutSetNext.run( @@ -308,9 +290,7 @@ TEST_F(FFmpegTest, AVFilterFunc) { EXPECT_NE(FuncInst, nullptr); EXPECT_TRUE(FuncInst->isHostFunction()); - auto &HostFuncAVFilterGraphParsePtr = dynamic_cast< - WasmEdge::Host::WasmEdgeFFmpeg::AVFilter::AVFilterGraphParsePtr &>( - FuncInst->getHostFunc()); + auto &HostFuncAVFilterGraphParsePtr = FuncInst->getHostFunc(); { int32_t Length = SpecStr.length(); @@ -327,9 +307,7 @@ TEST_F(FFmpegTest, AVFilterFunc) { EXPECT_NE(FuncInst, nullptr); EXPECT_TRUE(FuncInst->isHostFunction()); - auto &HostFuncAVFilterGraphConfig = dynamic_cast< - WasmEdge::Host::WasmEdgeFFmpeg::AVFilter::AVFilterGraphConfig &>( - FuncInst->getHostFunc()); + auto &HostFuncAVFilterGraphConfig = FuncInst->getHostFunc(); { EXPECT_TRUE(HostFuncAVFilterGraphConfig.run( @@ -343,9 +321,7 @@ TEST_F(FFmpegTest, AVFilterFunc) { EXPECT_NE(FuncInst, nullptr); EXPECT_TRUE(FuncInst->isHostFunction()); - auto &HostFuncAVFilterGraphDumpLength = dynamic_cast< - WasmEdge::Host::WasmEdgeFFmpeg::AVFilter::AVFilterGraphDumpLength &>( - FuncInst->getHostFunc()); + auto &HostFuncAVFilterGraphDumpLength = FuncInst->getHostFunc(); int32_t GraphStrLen = 0; { @@ -361,9 +337,7 @@ TEST_F(FFmpegTest, AVFilterFunc) { EXPECT_NE(FuncInst, nullptr); EXPECT_TRUE(FuncInst->isHostFunction()); - auto &HostFuncAVFilterGraphDump = dynamic_cast< - WasmEdge::Host::WasmEdgeFFmpeg::AVFilter::AVFilterGraphDump &>( - FuncInst->getHostFunc()); + auto &HostFuncAVFilterGraphDump = FuncInst->getHostFunc(); { EXPECT_TRUE(HostFuncAVFilterGraphDump.run( @@ -405,9 +379,7 @@ TEST_F(FFmpegTest, AVFilterFunc) { EXPECT_NE(FuncInst, nullptr); EXPECT_TRUE(FuncInst->isHostFunction()); - auto &HostFuncAVFilterVersion = - dynamic_cast( - FuncInst->getHostFunc()); + auto &HostFuncAVFilterVersion = FuncInst->getHostFunc(); { EXPECT_TRUE(HostFuncAVFilterVersion.run( @@ -420,9 +392,7 @@ TEST_F(FFmpegTest, AVFilterFunc) { EXPECT_NE(FuncInst, nullptr); EXPECT_TRUE(FuncInst->isHostFunction()); - auto &HostFuncAVFilterConfigurationLength = dynamic_cast< - WasmEdge::Host::WasmEdgeFFmpeg::AVFilter::AVFilterConfigurationLength &>( - FuncInst->getHostFunc()); + auto &HostFuncAVFilterConfigurationLength = FuncInst->getHostFunc(); int32_t Length = 0; { @@ -437,9 +407,7 @@ TEST_F(FFmpegTest, AVFilterFunc) { EXPECT_NE(FuncInst, nullptr); EXPECT_TRUE(FuncInst->isHostFunction()); - auto &HostFuncAVFilterConfiguration = dynamic_cast< - WasmEdge::Host::WasmEdgeFFmpeg::AVFilter::AVFilterConfiguration &>( - FuncInst->getHostFunc()); + auto &HostFuncAVFilterConfiguration = FuncInst->getHostFunc(); { EXPECT_TRUE(HostFuncAVFilterConfiguration.run( @@ -453,9 +421,7 @@ TEST_F(FFmpegTest, AVFilterFunc) { EXPECT_NE(FuncInst, nullptr); EXPECT_TRUE(FuncInst->isHostFunction()); - auto &HostFuncAVFilterLicenseLength = dynamic_cast< - WasmEdge::Host::WasmEdgeFFmpeg::AVFilter::AVFilterLicenseLength &>( - FuncInst->getHostFunc()); + auto &HostFuncAVFilterLicenseLength = FuncInst->getHostFunc(); { EXPECT_TRUE(HostFuncAVFilterLicenseLength.run( @@ -469,9 +435,7 @@ TEST_F(FFmpegTest, AVFilterFunc) { EXPECT_NE(FuncInst, nullptr); EXPECT_TRUE(FuncInst->isHostFunction()); - auto &HostFuncAVFilterLicense = - dynamic_cast( - FuncInst->getHostFunc()); + auto &HostFuncAVFilterLicense = FuncInst->getHostFunc(); { EXPECT_TRUE(HostFuncAVFilterLicense.run( @@ -489,9 +453,7 @@ TEST_F(FFmpegTest, AVFilterFunc) { EXPECT_NE(FuncInst, nullptr); EXPECT_TRUE(FuncInst->isHostFunction()); - auto &HostFuncAVBufferSrcGetNbFailedRequests = dynamic_cast< - WasmEdge::Host::WasmEdgeFFmpeg::AVFilter::AVBufferSrcGetNbFailedRequests - &>(FuncInst->getHostFunc()); + auto &HostFuncAVBufferSrcGetNbFailedRequests = FuncInst->getHostFunc(); { EXPECT_TRUE(HostFuncAVBufferSrcGetNbFailedRequests.run( @@ -505,9 +467,7 @@ TEST_F(FFmpegTest, AVFilterFunc) { EXPECT_NE(FuncInst, nullptr); EXPECT_TRUE(FuncInst->isHostFunction()); - auto &HostFuncAVBufferSrcAddFrame = dynamic_cast< - WasmEdge::Host::WasmEdgeFFmpeg::AVFilter::AVBufferSrcAddFrame &>( - FuncInst->getHostFunc()); + auto &HostFuncAVBufferSrcAddFrame = FuncInst->getHostFunc(); // Returning Error Code -22 (Invalid Argument), Due to Passing Empty Frame. { @@ -548,9 +508,7 @@ TEST_F(FFmpegTest, AVFilterFunc) { EXPECT_NE(FuncInst, nullptr); EXPECT_TRUE(FuncInst->isHostFunction()); - auto &HostFuncAVBufferSinkGetFrame = dynamic_cast< - WasmEdge::Host::WasmEdgeFFmpeg::AVFilter::AVBufferSinkGetFrame &>( - FuncInst->getHostFunc()); + auto &HostFuncAVBufferSinkGetFrame = FuncInst->getHostFunc(); { EXPECT_TRUE(HostFuncAVBufferSinkGetFrame.run( @@ -565,9 +523,7 @@ TEST_F(FFmpegTest, AVFilterFunc) { EXPECT_NE(FuncInst, nullptr); EXPECT_TRUE(FuncInst->isHostFunction()); - auto &HostFuncAVBufferSinkGetSamples = dynamic_cast< - WasmEdge::Host::WasmEdgeFFmpeg::AVFilter::AVBufferSinkGetSamples &>( - FuncInst->getHostFunc()); + auto &HostFuncAVBufferSinkGetSamples = FuncInst->getHostFunc(); // Passing Empty frames. Return AVERROR due to no frames presen Return AVERROR // due to no frames present. @@ -585,9 +541,7 @@ TEST_F(FFmpegTest, AVFilterFunc) { EXPECT_NE(FuncInst, nullptr); EXPECT_TRUE(FuncInst->isHostFunction()); - auto &HostFuncAvBufferSinkSetFrameSize = dynamic_cast< - WasmEdge::Host::WasmEdgeFFmpeg::AVFilter::AvBufferSinkSetFrameSize &>( - FuncInst->getHostFunc()); + auto &HostFuncAvBufferSinkSetFrameSize = FuncInst->getHostFunc(); { EXPECT_TRUE(HostFuncAvBufferSinkSetFrameSize.run( @@ -610,9 +564,7 @@ TEST_F(FFmpegTest, AVFilterFunc) { EXPECT_NE(FuncInst, nullptr); EXPECT_TRUE(FuncInst->isHostFunction()); - auto &HostFuncAVFilterFreeGraphStr = dynamic_cast< - WasmEdge::Host::WasmEdgeFFmpeg::AVFilter::AVFilterFreeGraphStr &>( - FuncInst->getHostFunc()); + auto &HostFuncAVFilterFreeGraphStr = FuncInst->getHostFunc(); { EXPECT_TRUE(HostFuncAVFilterFreeGraphStr.run( @@ -626,9 +578,7 @@ TEST_F(FFmpegTest, AVFilterFunc) { EXPECT_NE(FuncInst, nullptr); EXPECT_TRUE(FuncInst->isHostFunction()); - auto &HostFuncAVFilterDrop = - dynamic_cast( - FuncInst->getHostFunc()); + auto &HostFuncAVFilterDrop = FuncInst->getHostFunc(); { EXPECT_TRUE(HostFuncAVFilterDrop.run( @@ -642,9 +592,7 @@ TEST_F(FFmpegTest, AVFilterFunc) { EXPECT_NE(FuncInst, nullptr); EXPECT_TRUE(FuncInst->isHostFunction()); - auto &HostFuncAVFilterContextDrop = dynamic_cast< - WasmEdge::Host::WasmEdgeFFmpeg::AVFilter::AVFilterContextDrop &>( - FuncInst->getHostFunc()); + auto &HostFuncAVFilterContextDrop = FuncInst->getHostFunc(); { EXPECT_TRUE(HostFuncAVFilterContextDrop.run( @@ -664,9 +612,7 @@ TEST_F(FFmpegTest, AVFilterFunc) { EXPECT_NE(FuncInst, nullptr); EXPECT_TRUE(FuncInst->isHostFunction()); - auto &HostFuncAVFilterGraphFree = dynamic_cast< - WasmEdge::Host::WasmEdgeFFmpeg::AVFilter::AVFilterGraphFree &>( - FuncInst->getHostFunc()); + auto &HostFuncAVFilterGraphFree = FuncInst->getHostFunc(); { EXPECT_TRUE(HostFuncAVFilterGraphFree.run( diff --git a/test/plugins/wasmedge_ffmpeg/avformat/avChapter.cpp b/test/plugins/wasmedge_ffmpeg/avformat/avChapter.cpp index 299d26f9..85c14325 100644 --- a/test/plugins/wasmedge_ffmpeg/avformat/avChapter.cpp +++ b/test/plugins/wasmedge_ffmpeg/avformat/avChapter.cpp @@ -32,9 +32,7 @@ TEST_F(FFmpegTest, AVChapter) { AVFormatMod->findFuncExports("wasmedge_ffmpeg_avformat_avChapter_id"); EXPECT_NE(FuncInst, nullptr); EXPECT_TRUE(FuncInst->isHostFunction()); - auto &HostFuncAVChapterId = - dynamic_cast( - FuncInst->getHostFunc()); + auto &HostFuncAVChapterId = FuncInst->getHostFunc(); { EXPECT_TRUE(HostFuncAVChapterId.run( @@ -48,9 +46,7 @@ TEST_F(FFmpegTest, AVChapter) { "wasmedge_ffmpeg_avformat_avChapter_timebase"); EXPECT_NE(FuncInst, nullptr); EXPECT_TRUE(FuncInst->isHostFunction()); - auto &HostFuncAVChapterTimebase = dynamic_cast< - WasmEdge::Host::WasmEdgeFFmpeg::AVFormat::AVChapterTimebase &>( - FuncInst->getHostFunc()); + auto &HostFuncAVChapterTimebase = FuncInst->getHostFunc(); { EXPECT_TRUE(HostFuncAVChapterTimebase.run( @@ -67,9 +63,7 @@ TEST_F(FFmpegTest, AVChapter) { AVFormatMod->findFuncExports("wasmedge_ffmpeg_avformat_avChapter_start"); EXPECT_NE(FuncInst, nullptr); EXPECT_TRUE(FuncInst->isHostFunction()); - auto &HostFuncAVChapterStart = - dynamic_cast( - FuncInst->getHostFunc()); + auto &HostFuncAVChapterStart = FuncInst->getHostFunc(); { EXPECT_TRUE(HostFuncAVChapterStart.run( @@ -83,9 +77,7 @@ TEST_F(FFmpegTest, AVChapter) { AVFormatMod->findFuncExports("wasmedge_ffmpeg_avformat_avChapter_end"); EXPECT_NE(FuncInst, nullptr); EXPECT_TRUE(FuncInst->isHostFunction()); - auto &HostFuncAVChapterEnd = - dynamic_cast( - FuncInst->getHostFunc()); + auto &HostFuncAVChapterEnd = FuncInst->getHostFunc(); { EXPECT_TRUE(HostFuncAVChapterEnd.run( @@ -99,9 +91,7 @@ TEST_F(FFmpegTest, AVChapter) { "wasmedge_ffmpeg_avformat_avChapter_metadata"); EXPECT_NE(FuncInst, nullptr); EXPECT_TRUE(FuncInst->isHostFunction()); - auto &HostFuncAVChapterMetadata = dynamic_cast< - WasmEdge::Host::WasmEdgeFFmpeg::AVFormat::AVChapterMetadata &>( - FuncInst->getHostFunc()); + auto &HostFuncAVChapterMetadata = FuncInst->getHostFunc(); { EXPECT_TRUE(HostFuncAVChapterMetadata.run( @@ -117,9 +107,7 @@ TEST_F(FFmpegTest, AVChapter) { AVFormatMod->findFuncExports("wasmedge_ffmpeg_avformat_avChapter_set_id"); EXPECT_NE(FuncInst, nullptr); EXPECT_TRUE(FuncInst->isHostFunction()); - auto &HostFuncAVChapterSetId = - dynamic_cast( - FuncInst->getHostFunc()); + auto &HostFuncAVChapterSetId = FuncInst->getHostFunc(); { int64_t ChapterId = 10000; @@ -142,9 +130,7 @@ TEST_F(FFmpegTest, AVChapter) { "wasmedge_ffmpeg_avformat_avChapter_set_timebase"); EXPECT_NE(FuncInst, nullptr); EXPECT_TRUE(FuncInst->isHostFunction()); - auto &HostFuncAVChapterSetTimebase = dynamic_cast< - WasmEdge::Host::WasmEdgeFFmpeg::AVFormat::AVChapterSetTimebase &>( - FuncInst->getHostFunc()); + auto &HostFuncAVChapterSetTimebase = FuncInst->getHostFunc(); { int32_t Num = 3; @@ -171,9 +157,7 @@ TEST_F(FFmpegTest, AVChapter) { "wasmedge_ffmpeg_avformat_avChapter_set_start"); EXPECT_NE(FuncInst, nullptr); EXPECT_TRUE(FuncInst->isHostFunction()); - auto &HostFuncAVChapterSetStart = dynamic_cast< - WasmEdge::Host::WasmEdgeFFmpeg::AVFormat::AVChapterSetStart &>( - FuncInst->getHostFunc()); + auto &HostFuncAVChapterSetStart = FuncInst->getHostFunc(); { int64_t StartValue = 1000; @@ -196,9 +180,7 @@ TEST_F(FFmpegTest, AVChapter) { "wasmedge_ffmpeg_avformat_avChapter_set_end"); EXPECT_NE(FuncInst, nullptr); EXPECT_TRUE(FuncInst->isHostFunction()); - auto &HostFuncAVChapterSetEnd = - dynamic_cast( - FuncInst->getHostFunc()); + auto &HostFuncAVChapterSetEnd = FuncInst->getHostFunc(); { int64_t EndValue = 99999; diff --git a/test/plugins/wasmedge_ffmpeg/avformat/avInputOutputContext.cpp b/test/plugins/wasmedge_ffmpeg/avformat/avInputOutputContext.cpp index 99a1fcbe..cad99021 100644 --- a/test/plugins/wasmedge_ffmpeg/avformat/avInputOutputContext.cpp +++ b/test/plugins/wasmedge_ffmpeg/avformat/avInputOutputContext.cpp @@ -32,9 +32,7 @@ TEST_F(FFmpegTest, AVInputFormat) { "wasmedge_ffmpeg_avformat_avformatContext_iformat"); EXPECT_NE(FuncInst, nullptr); EXPECT_TRUE(FuncInst->isHostFunction()); - auto &HostFuncAVFormatCtxIFormat = dynamic_cast< - WasmEdge::Host::WasmEdgeFFmpeg::AVFormat::AVFormatCtxIFormat &>( - FuncInst->getHostFunc()); + auto &HostFuncAVFormatCtxIFormat = FuncInst->getHostFunc(); { EXPECT_TRUE(HostFuncAVFormatCtxIFormat.run( @@ -55,9 +53,7 @@ TEST_F(FFmpegTest, AVInputFormat) { "wasmedge_ffmpeg_avformat_avIOFormat_name_length"); EXPECT_NE(FuncInst, nullptr); EXPECT_TRUE(FuncInst->isHostFunction()); - auto &HostFuncAVIOFormatNameLength = dynamic_cast< - WasmEdge::Host::WasmEdgeFFmpeg::AVFormat::AVIOFormatNameLength &>( - FuncInst->getHostFunc()); + auto &HostFuncAVIOFormatNameLength = FuncInst->getHostFunc(); int32_t Length = 0; { @@ -72,9 +68,7 @@ TEST_F(FFmpegTest, AVInputFormat) { "wasmedge_ffmpeg_avformat_avInputFormat_name"); EXPECT_NE(FuncInst, nullptr); EXPECT_TRUE(FuncInst->isHostFunction()); - auto &HostFuncAVInputFormatName = dynamic_cast< - WasmEdge::Host::WasmEdgeFFmpeg::AVFormat::AVInputFormatName &>( - FuncInst->getHostFunc()); + auto &HostFuncAVInputFormatName = FuncInst->getHostFunc(); fillMemContent(MemInst, StrBuf, Length); { @@ -90,9 +84,7 @@ TEST_F(FFmpegTest, AVInputFormat) { "wasmedge_ffmpeg_avformat_avIOFormat_long_name_length"); EXPECT_NE(FuncInst, nullptr); EXPECT_TRUE(FuncInst->isHostFunction()); - auto &HostFuncAVIOFormatLongNameLength = dynamic_cast< - WasmEdge::Host::WasmEdgeFFmpeg::AVFormat::AVIOFormatLongNameLength &>( - FuncInst->getHostFunc()); + auto &HostFuncAVIOFormatLongNameLength = FuncInst->getHostFunc(); { EXPECT_TRUE(HostFuncAVIOFormatLongNameLength.run( @@ -107,9 +99,7 @@ TEST_F(FFmpegTest, AVInputFormat) { "wasmedge_ffmpeg_avformat_avInputFormat_long_name"); EXPECT_NE(FuncInst, nullptr); EXPECT_TRUE(FuncInst->isHostFunction()); - auto &HostFuncAVInputFormatLongName = dynamic_cast< - WasmEdge::Host::WasmEdgeFFmpeg::AVFormat::AVInputFormatLongName &>( - FuncInst->getHostFunc()); + auto &HostFuncAVInputFormatLongName = FuncInst->getHostFunc(); { EXPECT_TRUE(HostFuncAVInputFormatLongName.run( @@ -125,9 +115,7 @@ TEST_F(FFmpegTest, AVInputFormat) { "wasmedge_ffmpeg_avformat_avIOFormat_extensions_length"); EXPECT_NE(FuncInst, nullptr); EXPECT_TRUE(FuncInst->isHostFunction()); - auto &HostFuncAVIOFormatExtensionsLength = dynamic_cast< - WasmEdge::Host::WasmEdgeFFmpeg::AVFormat::AVIOFormatExtensionsLength &>( - FuncInst->getHostFunc()); + auto &HostFuncAVIOFormatExtensionsLength = FuncInst->getHostFunc(); { EXPECT_TRUE(HostFuncAVIOFormatExtensionsLength.run( @@ -142,9 +130,7 @@ TEST_F(FFmpegTest, AVInputFormat) { "wasmedge_ffmpeg_avformat_avInputFormat_extensions"); EXPECT_NE(FuncInst, nullptr); EXPECT_TRUE(FuncInst->isHostFunction()); - auto &HostFuncAVInputFormatExtensions = dynamic_cast< - WasmEdge::Host::WasmEdgeFFmpeg::AVFormat::AVInputFormatExtensions &>( - FuncInst->getHostFunc()); + auto &HostFuncAVInputFormatExtensions = FuncInst->getHostFunc(); { EXPECT_TRUE(HostFuncAVInputFormatExtensions.run( @@ -159,9 +145,7 @@ TEST_F(FFmpegTest, AVInputFormat) { "wasmedge_ffmpeg_avformat_avIOFormat_mime_type_length"); EXPECT_NE(FuncInst, nullptr); EXPECT_TRUE(FuncInst->isHostFunction()); - auto &HostFuncAVIOFormatMimeTypeLength = dynamic_cast< - WasmEdge::Host::WasmEdgeFFmpeg::AVFormat::AVIOFormatMimeTypeLength &>( - FuncInst->getHostFunc()); + auto &HostFuncAVIOFormatMimeTypeLength = FuncInst->getHostFunc(); { EXPECT_TRUE(HostFuncAVIOFormatMimeTypeLength.run( @@ -176,9 +160,7 @@ TEST_F(FFmpegTest, AVInputFormat) { "wasmedge_ffmpeg_avformat_avInputFormat_mime_type"); EXPECT_NE(FuncInst, nullptr); EXPECT_TRUE(FuncInst->isHostFunction()); - auto &HostFuncAVInputFormatMimeType = dynamic_cast< - WasmEdge::Host::WasmEdgeFFmpeg::AVFormat::AVInputFormatMimeType &>( - FuncInst->getHostFunc()); + auto &HostFuncAVInputFormatMimeType = FuncInst->getHostFunc(); { EXPECT_TRUE(HostFuncAVInputFormatMimeType.run( @@ -193,9 +175,7 @@ TEST_F(FFmpegTest, AVInputFormat) { "wasmedge_ffmpeg_avformat_avInputOutputFormat_free"); EXPECT_NE(FuncInst, nullptr); EXPECT_TRUE(FuncInst->isHostFunction()); - auto &HostFuncAVInputOutputFormatFree = dynamic_cast< - WasmEdge::Host::WasmEdgeFFmpeg::AVFormat::AVInputOutputFormatFree &>( - FuncInst->getHostFunc()); + auto &HostFuncAVInputOutputFormatFree = FuncInst->getHostFunc(); { EXPECT_TRUE(HostFuncAVInputOutputFormatFree.run( diff --git a/test/plugins/wasmedge_ffmpeg/avformat/avStream.cpp b/test/plugins/wasmedge_ffmpeg/avformat/avStream.cpp index 0cc0655b..ccb1b63e 100644 --- a/test/plugins/wasmedge_ffmpeg/avformat/avStream.cpp +++ b/test/plugins/wasmedge_ffmpeg/avformat/avStream.cpp @@ -33,9 +33,7 @@ TEST_F(FFmpegTest, AVStreamStruct) { AVFormatMod->findFuncExports("wasmedge_ffmpeg_avformat_avStream_id"); EXPECT_NE(FuncInst, nullptr); EXPECT_TRUE(FuncInst->isHostFunction()); - auto &HostFuncAVStreamId = - dynamic_cast( - FuncInst->getHostFunc()); + auto &HostFuncAVStreamId = FuncInst->getHostFunc(); uint32_t AvFormatCtxId = readUInt32(MemInst, FormatCtxPtr); { @@ -50,9 +48,7 @@ TEST_F(FFmpegTest, AVStreamStruct) { AVFormatMod->findFuncExports("wasmedge_ffmpeg_avformat_avStream_index"); EXPECT_NE(FuncInst, nullptr); EXPECT_TRUE(FuncInst->isHostFunction()); - auto &HostFuncAVStreamIndex = - dynamic_cast( - FuncInst->getHostFunc()); + auto &HostFuncAVStreamIndex = FuncInst->getHostFunc(); { EXPECT_TRUE(HostFuncAVStreamIndex.run( @@ -66,9 +62,7 @@ TEST_F(FFmpegTest, AVStreamStruct) { "wasmedge_ffmpeg_avformat_avStream_codecpar"); EXPECT_NE(FuncInst, nullptr); EXPECT_TRUE(FuncInst->isHostFunction()); - auto &HostFuncAVStreamCodecPar = dynamic_cast< - WasmEdge::Host::WasmEdgeFFmpeg::AVFormat::AVStreamCodecPar &>( - FuncInst->getHostFunc()); + auto &HostFuncAVStreamCodecPar = FuncInst->getHostFunc(); { EXPECT_TRUE(HostFuncAVStreamCodecPar.run( @@ -84,17 +78,13 @@ TEST_F(FFmpegTest, AVStreamStruct) { "wasmedge_ffmpeg_avformat_avStream_timebase"); EXPECT_NE(FuncInst, nullptr); EXPECT_TRUE(FuncInst->isHostFunction()); - auto &HostFuncAVStreamTimebase = dynamic_cast< - WasmEdge::Host::WasmEdgeFFmpeg::AVFormat::AVStreamTimebase &>( - FuncInst->getHostFunc()); + auto &HostFuncAVStreamTimebase = FuncInst->getHostFunc(); FuncInst = AVFormatMod->findFuncExports( "wasmedge_ffmpeg_avformat_avStream_set_timebase"); EXPECT_NE(FuncInst, nullptr); EXPECT_TRUE(FuncInst->isHostFunction()); - auto &HostFuncAVStreamSetTimebase = dynamic_cast< - WasmEdge::Host::WasmEdgeFFmpeg::AVFormat::AVStreamSetTimebase &>( - FuncInst->getHostFunc()); + auto &HostFuncAVStreamSetTimebase = FuncInst->getHostFunc(); { int32_t Num = 3; @@ -120,9 +110,7 @@ TEST_F(FFmpegTest, AVStreamStruct) { "wasmedge_ffmpeg_avformat_avStream_duration"); EXPECT_NE(FuncInst, nullptr); EXPECT_TRUE(FuncInst->isHostFunction()); - auto &HostFuncAVStreamDuration = dynamic_cast< - WasmEdge::Host::WasmEdgeFFmpeg::AVFormat::AVStreamDuration &>( - FuncInst->getHostFunc()); + auto &HostFuncAVStreamDuration = FuncInst->getHostFunc(); { EXPECT_TRUE(HostFuncAVStreamDuration.run( @@ -136,9 +124,7 @@ TEST_F(FFmpegTest, AVStreamStruct) { "wasmedge_ffmpeg_avformat_avStream_start_time"); EXPECT_NE(FuncInst, nullptr); EXPECT_TRUE(FuncInst->isHostFunction()); - auto &HostFuncAVStreamStartTime = dynamic_cast< - WasmEdge::Host::WasmEdgeFFmpeg::AVFormat::AVStreamStartTime &>( - FuncInst->getHostFunc()); + auto &HostFuncAVStreamStartTime = FuncInst->getHostFunc(); { EXPECT_TRUE(HostFuncAVStreamStartTime.run( @@ -152,9 +138,7 @@ TEST_F(FFmpegTest, AVStreamStruct) { "wasmedge_ffmpeg_avformat_avStream_nb_frames"); EXPECT_NE(FuncInst, nullptr); EXPECT_TRUE(FuncInst->isHostFunction()); - auto &HostFuncAVStreamNbFrames = dynamic_cast< - WasmEdge::Host::WasmEdgeFFmpeg::AVFormat::AVStreamNbFrames &>( - FuncInst->getHostFunc()); + auto &HostFuncAVStreamNbFrames = FuncInst->getHostFunc(); { EXPECT_TRUE(HostFuncAVStreamNbFrames.run( @@ -168,9 +152,7 @@ TEST_F(FFmpegTest, AVStreamStruct) { "wasmedge_ffmpeg_avformat_avStream_disposition"); EXPECT_NE(FuncInst, nullptr); EXPECT_TRUE(FuncInst->isHostFunction()); - auto &HostFuncAVStreamDisposition = dynamic_cast< - WasmEdge::Host::WasmEdgeFFmpeg::AVFormat::AVStreamDisposition &>( - FuncInst->getHostFunc()); + auto &HostFuncAVStreamDisposition = FuncInst->getHostFunc(); { EXPECT_TRUE(HostFuncAVStreamDisposition.run( @@ -184,17 +166,13 @@ TEST_F(FFmpegTest, AVStreamStruct) { "wasmedge_ffmpeg_avformat_avStream_set_r_frame_rate"); EXPECT_NE(FuncInst, nullptr); EXPECT_TRUE(FuncInst->isHostFunction()); - auto &HostFuncAVStreamSetRFrameRate = dynamic_cast< - WasmEdge::Host::WasmEdgeFFmpeg::AVFormat::AVStreamSetRFrameRate &>( - FuncInst->getHostFunc()); + auto &HostFuncAVStreamSetRFrameRate = FuncInst->getHostFunc(); FuncInst = AVFormatMod->findFuncExports( "wasmedge_ffmpeg_avformat_avStream_r_frame_rate"); EXPECT_NE(FuncInst, nullptr); EXPECT_TRUE(FuncInst->isHostFunction()); - auto &HostFuncAVStreamRFrameRate = dynamic_cast< - WasmEdge::Host::WasmEdgeFFmpeg::AVFormat::AVStreamRFrameRate &>( - FuncInst->getHostFunc()); + auto &HostFuncAVStreamRFrameRate = FuncInst->getHostFunc(); { int32_t Num = 3; @@ -220,17 +198,13 @@ TEST_F(FFmpegTest, AVStreamStruct) { "wasmedge_ffmpeg_avformat_avStream_set_avg_frame_rate"); EXPECT_NE(FuncInst, nullptr); EXPECT_TRUE(FuncInst->isHostFunction()); - auto &HostFuncAVStreamSetAvgFrameRate = dynamic_cast< - WasmEdge::Host::WasmEdgeFFmpeg::AVFormat::AVStreamSetAvgFrameRate &>( - FuncInst->getHostFunc()); + auto &HostFuncAVStreamSetAvgFrameRate = FuncInst->getHostFunc(); FuncInst = AVFormatMod->findFuncExports( "wasmedge_ffmpeg_avformat_avStream_avg_frame_rate"); EXPECT_NE(FuncInst, nullptr); EXPECT_TRUE(FuncInst->isHostFunction()); - auto &HostFuncAVStreamAvgFrameRate = dynamic_cast< - WasmEdge::Host::WasmEdgeFFmpeg::AVFormat::AVStreamAvgFrameRate &>( - FuncInst->getHostFunc()); + auto &HostFuncAVStreamAvgFrameRate = FuncInst->getHostFunc(); { int32_t Num = 3; @@ -257,17 +231,13 @@ TEST_F(FFmpegTest, AVStreamStruct) { "wasmedge_ffmpeg_avformat_avStream_metadata"); EXPECT_NE(FuncInst, nullptr); EXPECT_TRUE(FuncInst->isHostFunction()); - auto &HostFuncAVStreamMetadata = dynamic_cast< - WasmEdge::Host::WasmEdgeFFmpeg::AVFormat::AVStreamMetadata &>( - FuncInst->getHostFunc()); + auto &HostFuncAVStreamMetadata = FuncInst->getHostFunc(); FuncInst = AVFormatMod->findFuncExports( "wasmedge_ffmpeg_avformat_avStream_set_metadata"); EXPECT_NE(FuncInst, nullptr); EXPECT_TRUE(FuncInst->isHostFunction()); - auto &HostFuncAVStreamSetMetadata = dynamic_cast< - WasmEdge::Host::WasmEdgeFFmpeg::AVFormat::AVStreamSetMetadata &>( - FuncInst->getHostFunc()); + auto &HostFuncAVStreamSetMetadata = FuncInst->getHostFunc(); { EXPECT_TRUE(HostFuncAVStreamMetadata.run( CallFrame, @@ -289,9 +259,7 @@ TEST_F(FFmpegTest, AVStreamStruct) { AVFormatMod->findFuncExports("wasmedge_ffmpeg_avformat_avStream_discard"); EXPECT_NE(FuncInst, nullptr); EXPECT_TRUE(FuncInst->isHostFunction()); - auto &HostFuncAVStreamDiscard = - dynamic_cast( - FuncInst->getHostFunc()); + auto &HostFuncAVStreamDiscard = FuncInst->getHostFunc(); { EXPECT_TRUE(HostFuncAVStreamDiscard.run( CallFrame, diff --git a/test/plugins/wasmedge_ffmpeg/avformat/avformatContext.cpp b/test/plugins/wasmedge_ffmpeg/avformat/avformatContext.cpp index 3d23d403..479c9999 100644 --- a/test/plugins/wasmedge_ffmpeg/avformat/avformatContext.cpp +++ b/test/plugins/wasmedge_ffmpeg/avformat/avformatContext.cpp @@ -28,9 +28,7 @@ TEST_F(FFmpegTest, AVFormatContextStruct) { "wasmedge_ffmpeg_avformat_avformatContext_iformat"); EXPECT_NE(FuncInst, nullptr); EXPECT_TRUE(FuncInst->isHostFunction()); - auto &HostFuncAVFormatCtxIFormat = dynamic_cast< - WasmEdge::Host::WasmEdgeFFmpeg::AVFormat::AVFormatCtxIFormat &>( - FuncInst->getHostFunc()); + auto &HostFuncAVFormatCtxIFormat = FuncInst->getHostFunc(); { EXPECT_TRUE(HostFuncAVFormatCtxIFormat.run( @@ -46,9 +44,7 @@ TEST_F(FFmpegTest, AVFormatContextStruct) { "wasmedge_ffmpeg_avformat_avformatContext_oformat"); EXPECT_NE(FuncInst, nullptr); EXPECT_TRUE(FuncInst->isHostFunction()); - auto &HostFuncAVFormatCtxOFormat = dynamic_cast< - WasmEdge::Host::WasmEdgeFFmpeg::AVFormat::AVFormatCtxOFormat &>( - FuncInst->getHostFunc()); + auto &HostFuncAVFormatCtxOFormat = FuncInst->getHostFunc(); { EXPECT_TRUE(HostFuncAVFormatCtxOFormat.run( @@ -64,9 +60,7 @@ TEST_F(FFmpegTest, AVFormatContextStruct) { "wasmedge_ffmpeg_avformat_avformatContext_probescope"); EXPECT_NE(FuncInst, nullptr); EXPECT_TRUE(FuncInst->isHostFunction()); - auto &HostFuncAVFormatCtxProbeScore = dynamic_cast< - WasmEdge::Host::WasmEdgeFFmpeg::AVFormat::AVFormatCtxProbeScore &>( - FuncInst->getHostFunc()); + auto &HostFuncAVFormatCtxProbeScore = FuncInst->getHostFunc(); { EXPECT_TRUE(HostFuncAVFormatCtxProbeScore.run( @@ -79,9 +73,7 @@ TEST_F(FFmpegTest, AVFormatContextStruct) { "wasmedge_ffmpeg_avformat_avformatContext_nb_streams"); EXPECT_NE(FuncInst, nullptr); EXPECT_TRUE(FuncInst->isHostFunction()); - auto &HostFuncAVFormatCtxNbStreams = dynamic_cast< - WasmEdge::Host::WasmEdgeFFmpeg::AVFormat::AVFormatCtxNbStreams &>( - FuncInst->getHostFunc()); + auto &HostFuncAVFormatCtxNbStreams = FuncInst->getHostFunc(); { EXPECT_TRUE(HostFuncAVFormatCtxNbStreams.run( @@ -94,9 +86,7 @@ TEST_F(FFmpegTest, AVFormatContextStruct) { "wasmedge_ffmpeg_avformat_avformatContext_duration"); EXPECT_NE(FuncInst, nullptr); EXPECT_TRUE(FuncInst->isHostFunction()); - auto &HostFuncAVFormatCtxDuration = dynamic_cast< - WasmEdge::Host::WasmEdgeFFmpeg::AVFormat::AVFormatCtxDuration &>( - FuncInst->getHostFunc()); + auto &HostFuncAVFormatCtxDuration = FuncInst->getHostFunc(); { EXPECT_TRUE(HostFuncAVFormatCtxDuration.run( @@ -109,9 +99,7 @@ TEST_F(FFmpegTest, AVFormatContextStruct) { "wasmedge_ffmpeg_avformat_avformatContext_bit_rate"); EXPECT_NE(FuncInst, nullptr); EXPECT_TRUE(FuncInst->isHostFunction()); - auto &HostFuncAVFormatCtxBitRate = dynamic_cast< - WasmEdge::Host::WasmEdgeFFmpeg::AVFormat::AVFormatCtxBitRate &>( - FuncInst->getHostFunc()); + auto &HostFuncAVFormatCtxBitRate = FuncInst->getHostFunc(); { EXPECT_TRUE(HostFuncAVFormatCtxBitRate.run( @@ -124,17 +112,13 @@ TEST_F(FFmpegTest, AVFormatContextStruct) { "wasmedge_ffmpeg_avformat_avformatContext_set_nb_chapters"); EXPECT_NE(FuncInst, nullptr); EXPECT_TRUE(FuncInst->isHostFunction()); - auto &HostFuncAVFormatCtxSetNbChapters = dynamic_cast< - WasmEdge::Host::WasmEdgeFFmpeg::AVFormat::AVFormatCtxSetNbChapters &>( - FuncInst->getHostFunc()); + auto &HostFuncAVFormatCtxSetNbChapters = FuncInst->getHostFunc(); FuncInst = AVFormatMod->findFuncExports( "wasmedge_ffmpeg_avformat_avformatContext_nb_chapters"); EXPECT_NE(FuncInst, nullptr); EXPECT_TRUE(FuncInst->isHostFunction()); - auto &HostFuncAVFormatCtxNbChapters = dynamic_cast< - WasmEdge::Host::WasmEdgeFFmpeg::AVFormat::AVFormatCtxNbChapters &>( - FuncInst->getHostFunc()); + auto &HostFuncAVFormatCtxNbChapters = FuncInst->getHostFunc(); { uint32_t NbChapters = 200; EXPECT_TRUE(HostFuncAVFormatCtxSetNbChapters.run( @@ -153,17 +137,13 @@ TEST_F(FFmpegTest, AVFormatContextStruct) { "wasmedge_ffmpeg_avformat_avformatContext_metadata"); EXPECT_NE(FuncInst, nullptr); EXPECT_TRUE(FuncInst->isHostFunction()); - auto &HostFuncAVFormatCtxMetadata = dynamic_cast< - WasmEdge::Host::WasmEdgeFFmpeg::AVFormat::AVFormatCtxMetadata &>( - FuncInst->getHostFunc()); + auto &HostFuncAVFormatCtxMetadata = FuncInst->getHostFunc(); FuncInst = AVFormatMod->findFuncExports( "wasmedge_ffmpeg_avformat_avformatContext_set_metadata"); EXPECT_NE(FuncInst, nullptr); EXPECT_TRUE(FuncInst->isHostFunction()); - auto &HostFuncAVFormatCtxSetMetadata = dynamic_cast< - WasmEdge::Host::WasmEdgeFFmpeg::AVFormat::AVFormatCtxSetMetadata &>( - FuncInst->getHostFunc()); + auto &HostFuncAVFormatCtxSetMetadata = FuncInst->getHostFunc(); { EXPECT_TRUE(HostFuncAVFormatCtxMetadata.run( diff --git a/test/plugins/wasmedge_ffmpeg/avformat/avformat_func.cpp b/test/plugins/wasmedge_ffmpeg/avformat/avformat_func.cpp index 809a25d9..aef7603a 100644 --- a/test/plugins/wasmedge_ffmpeg/avformat/avformat_func.cpp +++ b/test/plugins/wasmedge_ffmpeg/avformat/avformat_func.cpp @@ -33,9 +33,7 @@ TEST_F(FFmpegTest, AVInputFormatFunc) { "wasmedge_ffmpeg_avformat_avformat_open_input"); EXPECT_NE(FuncInst, nullptr); EXPECT_TRUE(FuncInst->isHostFunction()); - auto &HostFuncAVFormatOpenInput = dynamic_cast< - WasmEdge::Host::WasmEdgeFFmpeg::AVFormat::AVFormatOpenInput &>( - FuncInst->getHostFunc()); + auto &HostFuncAVFormatOpenInput = FuncInst->getHostFunc(); spdlog::info("Testing AVFormatOpenInput"sv); { @@ -64,9 +62,7 @@ TEST_F(FFmpegTest, AVInputFormatFunc) { "wasmedge_ffmpeg_avformat_avformat_find_stream_info"); EXPECT_NE(FuncInst, nullptr); EXPECT_TRUE(FuncInst->isHostFunction()); - auto &HostFuncAVFormatFindStreamInfo = dynamic_cast< - WasmEdge::Host::WasmEdgeFFmpeg::AVFormat::AVFormatFindStreamInfo &>( - FuncInst->getHostFunc()); + auto &HostFuncAVFormatFindStreamInfo = FuncInst->getHostFunc(); spdlog::info("Testing AVFormatFindStreamInfo"sv); { @@ -81,9 +77,7 @@ TEST_F(FFmpegTest, AVInputFormatFunc) { AVFormatMod->findFuncExports("wasmedge_ffmpeg_avformat_av_dump_format"); EXPECT_NE(FuncInst, nullptr); EXPECT_TRUE(FuncInst->isHostFunction()); - auto &HostFuncAVFormatAVDumpFormat = - dynamic_cast( - FuncInst->getHostFunc()); + auto &HostFuncAVFormatAVDumpFormat = FuncInst->getHostFunc(); spdlog::info("Testing AVDumpFormat"sv); { @@ -99,9 +93,7 @@ TEST_F(FFmpegTest, AVInputFormatFunc) { "wasmedge_ffmpeg_avformat_av_find_best_stream"); EXPECT_NE(FuncInst, nullptr); EXPECT_TRUE(FuncInst->isHostFunction()); - auto &HostFuncAVFindBestStream = dynamic_cast< - WasmEdge::Host::WasmEdgeFFmpeg::AVFormat::AVFindBestStream &>( - FuncInst->getHostFunc()); + auto &HostFuncAVFindBestStream = FuncInst->getHostFunc(); spdlog::info("Testing AVFindBestStream"sv); { @@ -117,9 +109,7 @@ TEST_F(FFmpegTest, AVInputFormatFunc) { AVFormatMod->findFuncExports("wasmedge_ffmpeg_avformat_av_read_frame"); EXPECT_NE(FuncInst, nullptr); EXPECT_TRUE(FuncInst->isHostFunction()); - auto &HostFuncAVReadFrame = - dynamic_cast( - FuncInst->getHostFunc()); + auto &HostFuncAVReadFrame = FuncInst->getHostFunc(); spdlog::info("Testing AVReadFrame"sv); { @@ -137,9 +127,7 @@ TEST_F(FFmpegTest, AVInputFormatFunc) { "wasmedge_ffmpeg_avformat_avformat_network_init"); EXPECT_NE(FuncInst, nullptr); EXPECT_TRUE(FuncInst->isHostFunction()); - auto &HostFuncAVFormatNetworkInit = dynamic_cast< - WasmEdge::Host::WasmEdgeFFmpeg::AVFormat::AVFormatNetworkInit &>( - FuncInst->getHostFunc()); + auto &HostFuncAVFormatNetworkInit = FuncInst->getHostFunc(); spdlog::info("Testing AVFormatNetworkInit"sv); { @@ -153,9 +141,7 @@ TEST_F(FFmpegTest, AVInputFormatFunc) { "wasmedge_ffmpeg_avformat_avformat_seek_file"); EXPECT_NE(FuncInst, nullptr); EXPECT_TRUE(FuncInst->isHostFunction()); - auto &HostFuncAVFormatSeekFile = dynamic_cast< - WasmEdge::Host::WasmEdgeFFmpeg::AVFormat::AVFormatSeekFile &>( - FuncInst->getHostFunc()); + auto &HostFuncAVFormatSeekFile = FuncInst->getHostFunc(); spdlog::info("Testing AVFormatSeekFile"sv); { @@ -178,9 +164,7 @@ TEST_F(FFmpegTest, AVInputFormatFunc) { AVFormatMod->findFuncExports("wasmedge_ffmpeg_avformat_av_read_play"); EXPECT_NE(FuncInst, nullptr); EXPECT_TRUE(FuncInst->isHostFunction()); - auto &HostFuncAVFormatAVReadPlay = - dynamic_cast( - FuncInst->getHostFunc()); + auto &HostFuncAVFormatAVReadPlay = FuncInst->getHostFunc(); spdlog::info("Testing AVReadPlay"sv); { @@ -195,9 +179,7 @@ TEST_F(FFmpegTest, AVInputFormatFunc) { AVFormatMod->findFuncExports("wasmedge_ffmpeg_avformat_av_read_pause"); EXPECT_NE(FuncInst, nullptr); EXPECT_TRUE(FuncInst->isHostFunction()); - auto &HostFuncAVFormatAVReadPause = - dynamic_cast( - FuncInst->getHostFunc()); + auto &HostFuncAVFormatAVReadPause = FuncInst->getHostFunc(); spdlog::info("Testing AVReadPause"sv); { @@ -212,9 +194,7 @@ TEST_F(FFmpegTest, AVInputFormatFunc) { "wasmedge_ffmpeg_avformat_avformat_network_deinit"); EXPECT_NE(FuncInst, nullptr); EXPECT_TRUE(FuncInst->isHostFunction()); - auto &HostFuncAVFormatNetworkDeInit = dynamic_cast< - WasmEdge::Host::WasmEdgeFFmpeg::AVFormat::AVFormatNetworkDeInit &>( - FuncInst->getHostFunc()); + auto &HostFuncAVFormatNetworkDeInit = FuncInst->getHostFunc(); spdlog::info("Testing AVFormatNetworkDeInit"sv); { @@ -228,9 +208,7 @@ TEST_F(FFmpegTest, AVInputFormatFunc) { "wasmedge_ffmpeg_avformat_avformat_close_input"); EXPECT_NE(FuncInst, nullptr); EXPECT_TRUE(FuncInst->isHostFunction()); - auto &HostFuncAVFormatCloseInput = dynamic_cast< - WasmEdge::Host::WasmEdgeFFmpeg::AVFormat::AVFormatCloseInput &>( - FuncInst->getHostFunc()); + auto &HostFuncAVFormatCloseInput = FuncInst->getHostFunc(); spdlog::info("Testing AVFormatCloseInput"sv); { @@ -244,9 +222,7 @@ TEST_F(FFmpegTest, AVInputFormatFunc) { "wasmedge_ffmpeg_avformat_avformat_free_context"); EXPECT_NE(FuncInst, nullptr); EXPECT_TRUE(FuncInst->isHostFunction()); - auto &HostFuncAVFreeContext = dynamic_cast< - WasmEdge::Host::WasmEdgeFFmpeg::AVFormat::AVFormatFreeContext &>( - FuncInst->getHostFunc()); + auto &HostFuncAVFreeContext = FuncInst->getHostFunc(); spdlog::info("Testing AVFormatFreeContext"sv); { @@ -260,9 +236,7 @@ TEST_F(FFmpegTest, AVInputFormatFunc) { AVFormatMod->findFuncExports("wasmedge_ffmpeg_avformat_avformat_version"); EXPECT_NE(FuncInst, nullptr); EXPECT_TRUE(FuncInst->isHostFunction()); - auto &HostFuncAVFormatVersion = - dynamic_cast( - FuncInst->getHostFunc()); + auto &HostFuncAVFormatVersion = FuncInst->getHostFunc(); spdlog::info("Testing AVFormatVersion"sv); { @@ -276,9 +250,7 @@ TEST_F(FFmpegTest, AVInputFormatFunc) { "wasmedge_ffmpeg_avformat_avformat_configuration_length"); EXPECT_NE(FuncInst, nullptr); EXPECT_TRUE(FuncInst->isHostFunction()); - auto &HostFuncAVFormatConfigurationLength = dynamic_cast< - WasmEdge::Host::WasmEdgeFFmpeg::AVFormat::AVFormatConfigurationLength &>( - FuncInst->getHostFunc()); + auto &HostFuncAVFormatConfigurationLength = FuncInst->getHostFunc(); spdlog::info("Testing AVFormatConfigurationLength"sv); int32_t Length = 0; @@ -293,9 +265,7 @@ TEST_F(FFmpegTest, AVInputFormatFunc) { "wasmedge_ffmpeg_avformat_avformat_configuration"); EXPECT_NE(FuncInst, nullptr); EXPECT_TRUE(FuncInst->isHostFunction()); - auto &HostFuncAVFormatConfiguration = dynamic_cast< - WasmEdge::Host::WasmEdgeFFmpeg::AVFormat::AVFormatConfiguration &>( - FuncInst->getHostFunc()); + auto &HostFuncAVFormatConfiguration = FuncInst->getHostFunc(); spdlog::info("Testing AVFormatConfiguration"sv); { @@ -310,9 +280,7 @@ TEST_F(FFmpegTest, AVInputFormatFunc) { "wasmedge_ffmpeg_avformat_avformat_license_length"); EXPECT_NE(FuncInst, nullptr); EXPECT_TRUE(FuncInst->isHostFunction()); - auto &HostFuncAVFormatLicenseLength = dynamic_cast< - WasmEdge::Host::WasmEdgeFFmpeg::AVFormat::AVFormatLicenseLength &>( - FuncInst->getHostFunc()); + auto &HostFuncAVFormatLicenseLength = FuncInst->getHostFunc(); spdlog::info("Testing AVFormatLicenseLength"sv); { @@ -327,9 +295,7 @@ TEST_F(FFmpegTest, AVInputFormatFunc) { AVFormatMod->findFuncExports("wasmedge_ffmpeg_avformat_avformat_license"); EXPECT_NE(FuncInst, nullptr); EXPECT_TRUE(FuncInst->isHostFunction()); - auto &HostFuncAVFormatLicense = - dynamic_cast( - FuncInst->getHostFunc()); + auto &HostFuncAVFormatLicense = FuncInst->getHostFunc(); spdlog::info("Testing AVFormatLicense"sv); { @@ -368,9 +334,7 @@ TEST_F(FFmpegTest, AVOutputFormatFunc) { "wasmedge_ffmpeg_avformat_avformat_alloc_output_context2"); EXPECT_NE(FuncInst, nullptr); EXPECT_TRUE(FuncInst->isHostFunction()); - auto &HostFuncAVFormatAllocOutputContext2 = dynamic_cast< - WasmEdge::Host::WasmEdgeFFmpeg::AVFormat::AVFormatAllocOutputContext2 &>( - FuncInst->getHostFunc()); + auto &HostFuncAVFormatAllocOutputContext2 = FuncInst->getHostFunc(); spdlog::info("Testing AVFormatAllocOutputContext2"sv); { @@ -400,9 +364,7 @@ TEST_F(FFmpegTest, AVOutputFormatFunc) { FuncInst = AVFormatMod->findFuncExports("wasmedge_ffmpeg_avformat_avio_open"); EXPECT_NE(FuncInst, nullptr); EXPECT_TRUE(FuncInst->isHostFunction()); - auto &HostFuncAVIOOpen = - dynamic_cast( - FuncInst->getHostFunc()); + auto &HostFuncAVIOOpen = FuncInst->getHostFunc(); spdlog::info("Testing AVIOOpen"sv); { @@ -419,9 +381,7 @@ TEST_F(FFmpegTest, AVOutputFormatFunc) { AVFormatMod->findFuncExports("wasmedge_ffmpeg_avformat_avio_open2"); EXPECT_NE(FuncInst, nullptr); EXPECT_TRUE(FuncInst->isHostFunction()); - auto &HostFuncAVIOOpen2 = - dynamic_cast( - FuncInst->getHostFunc()); + auto &HostFuncAVIOOpen2 = FuncInst->getHostFunc(); spdlog::info("Testing AVIOOpen2"sv); { @@ -457,9 +417,7 @@ TEST_F(FFmpegTest, AVOutputFormatFunc) { "wasmedge_ffmpeg_avformat_avformat_write_header"); EXPECT_NE(FuncInst, nullptr); EXPECT_TRUE(FuncInst->isHostFunction()); - auto &HostFuncAVFormatWriteHeader = dynamic_cast< - WasmEdge::Host::WasmEdgeFFmpeg::AVFormat::AVFormatWriteHeader &>( - FuncInst->getHostFunc()); + auto &HostFuncAVFormatWriteHeader = FuncInst->getHostFunc(); spdlog::info("Testing AVFormatWriteHeader"sv); { @@ -496,9 +454,7 @@ TEST_F(FFmpegTest, AVOutputFormatFunc) { "wasmedge_ffmpeg_avformat_avchapter_mallocz"); EXPECT_NE(FuncInst, nullptr); EXPECT_TRUE(FuncInst->isHostFunction()); - auto &HostFuncAVIOClose = dynamic_cast< - WasmEdge::Host::WasmEdgeFFmpeg::AVFormat::AVChapterMallocz &>( - FuncInst->getHostFunc()); + auto &HostFuncAVIOClose = FuncInst->getHostFunc(); spdlog::info("Testing AVChapterMallocz"sv); { @@ -534,9 +490,7 @@ TEST_F(FFmpegTest, AVOutputFormatFunc) { AVFormatMod->findFuncExports("wasmedge_ffmpeg_avformat_avformat_avfreep"); EXPECT_NE(FuncInst, nullptr); EXPECT_TRUE(FuncInst->isHostFunction()); - auto &HostFuncAVFormatAVFreep = - dynamic_cast( - FuncInst->getHostFunc()); + auto &HostFuncAVFormatAVFreep = FuncInst->getHostFunc(); spdlog::info("Testing AVFreeP"sv); { @@ -551,9 +505,7 @@ TEST_F(FFmpegTest, AVOutputFormatFunc) { AVFormatMod->findFuncExports("wasmedge_ffmpeg_avformat_av_write_frame"); EXPECT_NE(FuncInst, nullptr); EXPECT_TRUE(FuncInst->isHostFunction()); - auto &HostFuncAVWriteFrame = - dynamic_cast( - FuncInst->getHostFunc()); + auto &HostFuncAVWriteFrame = FuncInst->getHostFunc(); spdlog::info("Testing AVWriteFrame"sv); // Passing Empty Frame, Hence giving Invalid Argument Error. @@ -570,9 +522,7 @@ TEST_F(FFmpegTest, AVOutputFormatFunc) { "wasmedge_ffmpeg_avformat_av_interleaved_write_frame"); EXPECT_NE(FuncInst, nullptr); EXPECT_TRUE(FuncInst->isHostFunction()); - auto &HostFuncAVInterleavedWriteFrame = dynamic_cast< - WasmEdge::Host::WasmEdgeFFmpeg::AVFormat::AVInterleavedWriteFrame &>( - FuncInst->getHostFunc()); + auto &HostFuncAVInterleavedWriteFrame = FuncInst->getHostFunc(); spdlog::info("Testing AVInterleavedWriteFrame"sv); // Passing Empty Frame, Hence giving Invalid Argument Error. diff --git a/test/plugins/wasmedge_ffmpeg/avutil/avDictionary.cpp b/test/plugins/wasmedge_ffmpeg/avutil/avDictionary.cpp index 779fb236..9261e8a6 100644 --- a/test/plugins/wasmedge_ffmpeg/avutil/avDictionary.cpp +++ b/test/plugins/wasmedge_ffmpeg/avutil/avDictionary.cpp @@ -30,9 +30,7 @@ TEST_F(FFmpegTest, AVDictionary) { AVUtilMod->findFuncExports("wasmedge_ffmpeg_avutil_av_dict_set"); EXPECT_NE(FuncInst, nullptr); EXPECT_TRUE(FuncInst->isHostFunction()); - auto &HostFuncAVDictSet = - dynamic_cast( - FuncInst->getHostFunc()); + auto &HostFuncAVDictSet = FuncInst->getHostFunc(); // Fill 0 in WasmMemory. fillMemContent(MemInst, KeyStart, KeyLen + ValueLen); @@ -54,9 +52,7 @@ TEST_F(FFmpegTest, AVDictionary) { FuncInst = AVUtilMod->findFuncExports("wasmedge_ffmpeg_avutil_av_dict_copy"); EXPECT_NE(FuncInst, nullptr); EXPECT_TRUE(FuncInst->isHostFunction()); - auto &HostFuncAVDictCopy = - dynamic_cast( - FuncInst->getHostFunc()); + auto &HostFuncAVDictCopy = FuncInst->getHostFunc(); { uint32_t DestDictPtr = UINT32_C(80); @@ -72,9 +68,7 @@ TEST_F(FFmpegTest, AVDictionary) { FuncInst = AVUtilMod->findFuncExports("wasmedge_ffmpeg_avutil_av_dict_get"); EXPECT_NE(FuncInst, nullptr); EXPECT_TRUE(FuncInst->isHostFunction()); - auto &HostFuncAVDictGet = - dynamic_cast( - FuncInst->getHostFunc()); + auto &HostFuncAVDictGet = FuncInst->getHostFunc(); { // Store the string lengths of Key and value in the pointers below. @@ -106,9 +100,7 @@ TEST_F(FFmpegTest, AVDictionary) { "wasmedge_ffmpeg_avutil_av_dict_get_key_value"); EXPECT_NE(FuncInst, nullptr); EXPECT_TRUE(FuncInst->isHostFunction()); - auto &HostFuncAVDictGetKeyValue = - dynamic_cast( - FuncInst->getHostFunc()); + auto &HostFuncAVDictGetKeyValue = FuncInst->getHostFunc(); { // Store the strings of Key and value in the buffer pointers below. @@ -138,9 +130,7 @@ TEST_F(FFmpegTest, AVDictionary) { FuncInst = AVUtilMod->findFuncExports("wasmedge_ffmpeg_avutil_av_dict_free"); EXPECT_NE(FuncInst, nullptr); EXPECT_TRUE(FuncInst->isHostFunction()); - auto &HostFuncAVDictFree = - dynamic_cast( - FuncInst->getHostFunc()); + auto &HostFuncAVDictFree = FuncInst->getHostFunc(); { uint32_t DictId = readUInt32(MemInst, DictPtr); diff --git a/test/plugins/wasmedge_ffmpeg/avutil/avError.cpp b/test/plugins/wasmedge_ffmpeg/avutil/avError.cpp index 8584c97b..c8cfc373 100644 --- a/test/plugins/wasmedge_ffmpeg/avutil/avError.cpp +++ b/test/plugins/wasmedge_ffmpeg/avutil/avError.cpp @@ -24,9 +24,7 @@ TEST_F(FFmpegTest, AVError) { auto *FuncInst = AVUtilMod->findFuncExports("wasmedge_ffmpeg_avutil_av_strerror"); - auto &HostFuncAVUtilAVStrError = - dynamic_cast( - FuncInst->getHostFunc()); + auto &HostFuncAVUtilAVStrError = FuncInst->getHostFunc(); { HostFuncAVUtilAVStrError.run( @@ -36,9 +34,7 @@ TEST_F(FFmpegTest, AVError) { } FuncInst = AVUtilMod->findFuncExports("wasmedge_ffmpeg_avutil_AVERROR"); - auto &HostFuncAVUtilAVError = - dynamic_cast( - FuncInst->getHostFunc()); + auto &HostFuncAVUtilAVError = FuncInst->getHostFunc(); { HostFuncAVUtilAVError.run( @@ -49,9 +45,7 @@ TEST_F(FFmpegTest, AVError) { } FuncInst = AVUtilMod->findFuncExports("wasmedge_ffmpeg_avutil_AVUNERROR"); - auto &HostFuncAVUtilAVUNError = - dynamic_cast( - FuncInst->getHostFunc()); + auto &HostFuncAVUtilAVUNError = FuncInst->getHostFunc(); { HostFuncAVUtilAVUNError.run( diff --git a/test/plugins/wasmedge_ffmpeg/avutil/avFrame.cpp b/test/plugins/wasmedge_ffmpeg/avutil/avFrame.cpp index dd20f625..682e3486 100644 --- a/test/plugins/wasmedge_ffmpeg/avutil/avFrame.cpp +++ b/test/plugins/wasmedge_ffmpeg/avutil/avFrame.cpp @@ -32,9 +32,7 @@ TEST_F(FFmpegTest, AVFrame) { auto *FuncInst = AVUtilMod->findFuncExports("wasmedge_ffmpeg_avutil_av_frame_alloc"); - auto &HostFuncAVFrameAlloc = - dynamic_cast( - FuncInst->getHostFunc()); + auto &HostFuncAVFrameAlloc = FuncInst->getHostFunc(); uint32_t EmptyFramePtr = UINT32_C(64); @@ -48,9 +46,7 @@ TEST_F(FFmpegTest, AVFrame) { } FuncInst = AVUtilMod->findFuncExports("wasmedge_ffmpeg_avutil_av_frame_free"); - auto &HostFuncAVFrameFree = - dynamic_cast( - FuncInst->getHostFunc()); + auto &HostFuncAVFrameFree = FuncInst->getHostFunc(); { uint32_t EmptyFrameId = readUInt32(MemInst, EmptyFramePtr); @@ -63,9 +59,7 @@ TEST_F(FFmpegTest, AVFrame) { FuncInst = AVUtilMod->findFuncExports("wasmedge_ffmpeg_avutil_av_frame_width"); - auto &HostFuncAVFrameWidth = - dynamic_cast( - FuncInst->getHostFunc()); + auto &HostFuncAVFrameWidth = FuncInst->getHostFunc(); { HostFuncAVFrameWidth.run( @@ -77,9 +71,7 @@ TEST_F(FFmpegTest, AVFrame) { FuncInst = AVUtilMod->findFuncExports("wasmedge_ffmpeg_avutil_av_frame_height"); - auto &HostFuncAVFrameHeight = - dynamic_cast( - FuncInst->getHostFunc()); + auto &HostFuncAVFrameHeight = FuncInst->getHostFunc(); { HostFuncAVFrameHeight.run( @@ -91,9 +83,7 @@ TEST_F(FFmpegTest, AVFrame) { FuncInst = AVUtilMod->findFuncExports( "wasmedge_ffmpeg_avutil_av_frame_video_format"); - auto &HostFuncAVFrameVideoFormat = dynamic_cast< - WasmEdge::Host::WasmEdgeFFmpeg::AVUtil::AVFrameVideoFormat &>( - FuncInst->getHostFunc()); + auto &HostFuncAVFrameVideoFormat = FuncInst->getHostFunc(); { HostFuncAVFrameVideoFormat.run( @@ -105,9 +95,7 @@ TEST_F(FFmpegTest, AVFrame) { FuncInst = AVUtilMod->findFuncExports("wasmedge_ffmpeg_avutil_av_frame_isnull"); - auto &HostFuncAVFrameIsNull = - dynamic_cast( - FuncInst->getHostFunc()); + auto &HostFuncAVFrameIsNull = FuncInst->getHostFunc(); { HostFuncAVFrameIsNull.run( @@ -119,9 +107,7 @@ TEST_F(FFmpegTest, AVFrame) { FuncInst = AVUtilMod->findFuncExports("wasmedge_ffmpeg_avutil_av_frame_linesize"); - auto &HostFuncAVFrameLinesize = - dynamic_cast( - FuncInst->getHostFunc()); + auto &HostFuncAVFrameLinesize = FuncInst->getHostFunc(); int32_t Stride = 0; uint32_t Idx = 0; @@ -136,9 +122,7 @@ TEST_F(FFmpegTest, AVFrame) { FuncInst = AVUtilMod->findFuncExports("wasmedge_ffmpeg_avutil_av_frame_get_buffer"); - auto &HostFuncAVFrameGetBuffer = - dynamic_cast( - FuncInst->getHostFunc()); + auto &HostFuncAVFrameGetBuffer = FuncInst->getHostFunc(); { // For video, it is 32. int32_t Align = 32; @@ -151,9 +135,7 @@ TEST_F(FFmpegTest, AVFrame) { FuncInst = AVUtilMod->findFuncExports( "wasmedge_ffmpeg_avutil_av_frame_best_effort_timestamp"); - auto &HostFuncAVFrameBestEffortTimestamp = dynamic_cast< - WasmEdge::Host::WasmEdgeFFmpeg::AVUtil::AVFrameBestEffortTimestamp &>( - FuncInst->getHostFunc()); + auto &HostFuncAVFrameBestEffortTimestamp = FuncInst->getHostFunc(); { HostFuncAVFrameBestEffortTimestamp.run( @@ -164,9 +146,7 @@ TEST_F(FFmpegTest, AVFrame) { FuncInst = AVUtilMod->findFuncExports("wasmedge_ffmpeg_avutil_av_frame_pict_type"); - auto &HostFuncAVFramePictType = - dynamic_cast( - FuncInst->getHostFunc()); + auto &HostFuncAVFramePictType = FuncInst->getHostFunc(); { HostFuncAVFramePictType.run( @@ -177,9 +157,7 @@ TEST_F(FFmpegTest, AVFrame) { FuncInst = AVUtilMod->findFuncExports( "wasmedge_ffmpeg_avutil_av_frame_interlaced_frame"); - auto &HostFuncAVFrameInterlacedFrame = dynamic_cast< - WasmEdge::Host::WasmEdgeFFmpeg::AVUtil::AVFrameInterlacedFrame &>( - FuncInst->getHostFunc()); + auto &HostFuncAVFrameInterlacedFrame = FuncInst->getHostFunc(); { HostFuncAVFrameInterlacedFrame.run( @@ -190,9 +168,7 @@ TEST_F(FFmpegTest, AVFrame) { FuncInst = AVUtilMod->findFuncExports( "wasmedge_ffmpeg_avutil_av_frame_top_field_first"); - auto &HostFuncAVFrameTopFieldFirst = dynamic_cast< - WasmEdge::Host::WasmEdgeFFmpeg::AVUtil::AVFrameTopFieldFirst &>( - FuncInst->getHostFunc()); + auto &HostFuncAVFrameTopFieldFirst = FuncInst->getHostFunc(); { HostFuncAVFrameTopFieldFirst.run( @@ -203,9 +179,7 @@ TEST_F(FFmpegTest, AVFrame) { FuncInst = AVUtilMod->findFuncExports( "wasmedge_ffmpeg_avutil_av_frame_palette_has_changed"); - auto &HostFuncAVFramePaletteHasChanged = dynamic_cast< - WasmEdge::Host::WasmEdgeFFmpeg::AVUtil::AVFramePaletteHasChanged &>( - FuncInst->getHostFunc()); + auto &HostFuncAVFramePaletteHasChanged = FuncInst->getHostFunc(); { HostFuncAVFramePaletteHasChanged.run( @@ -216,9 +190,7 @@ TEST_F(FFmpegTest, AVFrame) { FuncInst = AVUtilMod->findFuncExports("wasmedge_ffmpeg_avutil_av_frame_colorspace"); - auto &HostFuncAVFrameColorspace = - dynamic_cast( - FuncInst->getHostFunc()); + auto &HostFuncAVFrameColorspace = FuncInst->getHostFunc(); { HostFuncAVFrameColorspace.run( @@ -229,9 +201,7 @@ TEST_F(FFmpegTest, AVFrame) { FuncInst = AVUtilMod->findFuncExports("wasmedge_ffmpeg_avutil_av_frame_color_range"); - auto &HostFuncAVFrameColorRange = - dynamic_cast( - FuncInst->getHostFunc()); + auto &HostFuncAVFrameColorRange = FuncInst->getHostFunc(); { HostFuncAVFrameColorRange.run( @@ -242,9 +212,7 @@ TEST_F(FFmpegTest, AVFrame) { FuncInst = AVUtilMod->findFuncExports("wasmedge_ffmpeg_avutil_av_frame_color_trc"); - auto &HostAVFrameColorTransferCharacteristic = dynamic_cast< - WasmEdge::Host::WasmEdgeFFmpeg::AVUtil::AVFrameColorTransferCharacteristic - &>(FuncInst->getHostFunc()); + auto &HostAVFrameColorTransferCharacteristic = FuncInst->getHostFunc(); { HostAVFrameColorTransferCharacteristic.run( @@ -255,9 +223,7 @@ TEST_F(FFmpegTest, AVFrame) { FuncInst = AVUtilMod->findFuncExports( "wasmedge_ffmpeg_avutil_av_frame_chroma_location"); - auto &HostAVFrameChromaLocation = dynamic_cast< - WasmEdge::Host::WasmEdgeFFmpeg::AVUtil::AVFrameChromaLocation &>( - FuncInst->getHostFunc()); + auto &HostAVFrameChromaLocation = FuncInst->getHostFunc(); { HostAVFrameChromaLocation.run( @@ -268,9 +234,7 @@ TEST_F(FFmpegTest, AVFrame) { FuncInst = AVUtilMod->findFuncExports("wasmedge_ffmpeg_avutil_av_frame_repeat_pict"); - auto &HostAVFrameRepeatPict = - dynamic_cast( - FuncInst->getHostFunc()); + auto &HostAVFrameRepeatPict = FuncInst->getHostFunc(); { HostAVFrameRepeatPict.run( @@ -281,9 +245,7 @@ TEST_F(FFmpegTest, AVFrame) { FuncInst = AVUtilMod->findFuncExports("wasmedge_ffmpeg_avutil_av_frame_flags"); - auto &HostAVFrameFlags = - dynamic_cast( - FuncInst->getHostFunc()); + auto &HostAVFrameFlags = FuncInst->getHostFunc(); { HostAVFrameFlags.run(CallFrame, @@ -294,9 +256,7 @@ TEST_F(FFmpegTest, AVFrame) { FuncInst = AVUtilMod->findFuncExports("wasmedge_ffmpeg_avutil_av_frame_quality"); - auto &HostAVFrameQuality = - dynamic_cast( - FuncInst->getHostFunc()); + auto &HostAVFrameQuality = FuncInst->getHostFunc(); { HostAVFrameQuality.run( @@ -307,9 +267,7 @@ TEST_F(FFmpegTest, AVFrame) { FuncInst = AVUtilMod->findFuncExports("wasmedge_ffmpeg_avutil_av_frame_metadata"); - auto &HostAVFrameMetadata = - dynamic_cast( - FuncInst->getHostFunc()); + auto &HostAVFrameMetadata = FuncInst->getHostFunc(); { HostAVFrameMetadata.run( @@ -323,9 +281,7 @@ TEST_F(FFmpegTest, AVFrame) { FuncInst = AVUtilMod->findFuncExports( "wasmedge_ffmpeg_avutil_av_frame_set_metadata"); - auto &HostAVFrameSetMetadata = dynamic_cast< - WasmEdge::Host::WasmEdgeFFmpeg::AVUtil::AVFrameSetMetadata &>( - FuncInst->getHostFunc()); + auto &HostAVFrameSetMetadata = FuncInst->getHostFunc(); { HostAVFrameSetMetadata.run( @@ -336,9 +292,7 @@ TEST_F(FFmpegTest, AVFrame) { FuncInst = AVUtilMod->findFuncExports("wasmedge_ffmpeg_avutil_av_frame_key_frame"); - auto &HostAVFrameKeyFrame = - dynamic_cast( - FuncInst->getHostFunc()); + auto &HostAVFrameKeyFrame = FuncInst->getHostFunc(); { HostAVFrameKeyFrame.run( @@ -348,9 +302,7 @@ TEST_F(FFmpegTest, AVFrame) { } FuncInst = AVUtilMod->findFuncExports("wasmedge_ffmpeg_avutil_av_frame_pts"); - auto &HostAVFramePts = - dynamic_cast( - FuncInst->getHostFunc()); + auto &HostAVFramePts = FuncInst->getHostFunc(); { HostAVFramePts.run(CallFrame, @@ -360,9 +312,7 @@ TEST_F(FFmpegTest, AVFrame) { } FuncInst = AVUtilMod->findFuncExports("wasmedge_ffmpeg_avutil_av_frame_copy"); - auto &HostAVFrameCopy = - dynamic_cast( - FuncInst->getHostFunc()); + auto &HostAVFrameCopy = FuncInst->getHostFunc(); { HostAVFrameCopy.run( @@ -374,9 +324,7 @@ TEST_F(FFmpegTest, AVFrame) { FuncInst = AVUtilMod->findFuncExports("wasmedge_ffmpeg_avutil_av_frame_copy_props"); - auto &HostAVFrameCopyProps = - dynamic_cast( - FuncInst->getHostFunc()); + auto &HostAVFrameCopyProps = FuncInst->getHostFunc(); { HostAVFrameCopyProps.run( @@ -388,9 +336,7 @@ TEST_F(FFmpegTest, AVFrame) { FuncInst = AVUtilMod->findFuncExports("wasmedge_ffmpeg_avutil_av_frame_set_width"); - auto &HostFuncAVFrameSetWidth = - dynamic_cast( - FuncInst->getHostFunc()); + auto &HostFuncAVFrameSetWidth = FuncInst->getHostFunc(); { int32_t Width = 100; @@ -407,9 +353,7 @@ TEST_F(FFmpegTest, AVFrame) { FuncInst = AVUtilMod->findFuncExports("wasmedge_ffmpeg_avutil_av_frame_set_height"); - auto &HostFuncAVFrameSetHeight = - dynamic_cast( - FuncInst->getHostFunc()); + auto &HostFuncAVFrameSetHeight = FuncInst->getHostFunc(); int32_t Height = 100; { @@ -425,9 +369,7 @@ TEST_F(FFmpegTest, AVFrame) { } FuncInst = AVUtilMod->findFuncExports("wasmedge_ffmpeg_avutil_av_frame_data"); - auto &HostFuncAVFrameData = - dynamic_cast( - FuncInst->getHostFunc()); + auto &HostFuncAVFrameData = FuncInst->getHostFunc(); { int32_t Size = 1; // Just reading One byte data for test. @@ -441,9 +383,7 @@ TEST_F(FFmpegTest, AVFrame) { FuncInst = AVUtilMod->findFuncExports( "wasmedge_ffmpeg_avutil_av_frame_set_video_format"); - auto &HostFuncAVFrameSetVideoFormat = dynamic_cast< - WasmEdge::Host::WasmEdgeFFmpeg::AVUtil::AVFrameSetVideoFormat &>( - FuncInst->getHostFunc()); + auto &HostFuncAVFrameSetVideoFormat = FuncInst->getHostFunc(); { uint32_t PixFormatId = 10; // GRAY8 @@ -461,9 +401,7 @@ TEST_F(FFmpegTest, AVFrame) { FuncInst = AVUtilMod->findFuncExports( "wasmedge_ffmpeg_avutil_av_frame_set_pict_type"); - auto &HostFuncAVFrameSetPictType = dynamic_cast< - WasmEdge::Host::WasmEdgeFFmpeg::AVUtil::AVFrameSetPictType &>( - FuncInst->getHostFunc()); + auto &HostFuncAVFrameSetPictType = FuncInst->getHostFunc(); { int32_t PictureId = 4; // AV_PICTURE_TYPE_S @@ -481,9 +419,7 @@ TEST_F(FFmpegTest, AVFrame) { FuncInst = AVUtilMod->findFuncExports( "wasmedge_ffmpeg_avutil_av_frame_set_colorspace"); - auto &HostFuncAVFrameSetColorSpace = dynamic_cast< - WasmEdge::Host::WasmEdgeFFmpeg::AVUtil::AVFrameSetColorSpace &>( - FuncInst->getHostFunc()); + auto &HostFuncAVFrameSetColorSpace = FuncInst->getHostFunc(); { int32_t ColorSpaceId = 4; // FCC @@ -501,9 +437,7 @@ TEST_F(FFmpegTest, AVFrame) { FuncInst = AVUtilMod->findFuncExports( "wasmedge_ffmpeg_avutil_av_frame_set_color_range"); - auto &HostFuncAVFrameSetColorRange = dynamic_cast< - WasmEdge::Host::WasmEdgeFFmpeg::AVUtil::AVFrameSetColorRange &>( - FuncInst->getHostFunc()); + auto &HostFuncAVFrameSetColorRange = FuncInst->getHostFunc(); { int32_t ColorRangeId = 1; // MPEG @@ -521,10 +455,7 @@ TEST_F(FFmpegTest, AVFrame) { FuncInst = AVUtilMod->findFuncExports( "wasmedge_ffmpeg_avutil_av_frame_set_color_trc"); - auto &HostFuncAVFrameSetColorTransferCharacteristic = - dynamic_cast( - FuncInst->getHostFunc()); + auto &HostFuncAVFrameSetColorTransferCharacteristic = FuncInst->getHostFunc(); { int32_t ColorTrcId = 5; // GAMMA28 @@ -542,9 +473,7 @@ TEST_F(FFmpegTest, AVFrame) { FuncInst = AVUtilMod->findFuncExports("wasmedge_ffmpeg_avutil_av_frame_set_pts"); - auto &HostFuncAVFrameSetPts = - dynamic_cast( - FuncInst->getHostFunc()); + auto &HostFuncAVFrameSetPts = FuncInst->getHostFunc(); { int64_t Pts = 10; @@ -561,9 +490,7 @@ TEST_F(FFmpegTest, AVFrame) { FuncInst = AVUtilMod->findFuncExports( "wasmedge_ffmpeg_avutil_av_frame_sample_aspect_ratio"); - auto &HostFuncAVFrameSampleAspectRatio = dynamic_cast< - WasmEdge::Host::WasmEdgeFFmpeg::AVUtil::AVFrameSampleAspectRatio &>( - FuncInst->getHostFunc()); + auto &HostFuncAVFrameSampleAspectRatio = FuncInst->getHostFunc(); { HostFuncAVFrameSampleAspectRatio.run( @@ -576,9 +503,7 @@ TEST_F(FFmpegTest, AVFrame) { int32_t ColorPrimariesId = 1; // BT709 FuncInst = AVUtilMod->findFuncExports( "wasmedge_ffmpeg_avutil_av_frame_set_color_primaries"); - auto &HostFuncAVFrameSetColorPrimaries = dynamic_cast< - WasmEdge::Host::WasmEdgeFFmpeg::AVUtil::AVFrameSetColorPrimaries &>( - FuncInst->getHostFunc()); + auto &HostFuncAVFrameSetColorPrimaries = FuncInst->getHostFunc(); { HostFuncAVFrameSetColorPrimaries.run( @@ -591,9 +516,7 @@ TEST_F(FFmpegTest, AVFrame) { FuncInst = AVUtilMod->findFuncExports( "wasmedge_ffmpeg_avutil_av_frame_color_primaries"); - auto &HostFuncAVFrameColorPrimaries = dynamic_cast< - WasmEdge::Host::WasmEdgeFFmpeg::AVUtil::AVFrameColorPrimaries &>( - FuncInst->getHostFunc()); + auto &HostFuncAVFrameColorPrimaries = FuncInst->getHostFunc(); { HostFuncAVFrameColorPrimaries.run( @@ -610,9 +533,7 @@ TEST_F(FFmpegTest, AVFrame) { FuncInst = AVUtilMod->findFuncExports( "wasmedge_ffmpeg_avutil_av_frame_set_audio_format"); - auto &HostFuncAVFrameSetAudioFormat = dynamic_cast< - WasmEdge::Host::WasmEdgeFFmpeg::AVUtil::AVFrameSetAudioFormat &>( - FuncInst->getHostFunc()); + auto &HostFuncAVFrameSetAudioFormat = FuncInst->getHostFunc(); uint32_t SampleFormatId = 4; { @@ -625,9 +546,7 @@ TEST_F(FFmpegTest, AVFrame) { FuncInst = AVUtilMod->findFuncExports( "wasmedge_ffmpeg_avutil_av_frame_audio_format"); - auto &HostFuncAVFrameAudioFormat = dynamic_cast< - WasmEdge::Host::WasmEdgeFFmpeg::AVUtil::AVFrameAudioFormat &>( - FuncInst->getHostFunc()); + auto &HostFuncAVFrameAudioFormat = FuncInst->getHostFunc(); { HostFuncAVFrameAudioFormat.run( @@ -638,9 +557,7 @@ TEST_F(FFmpegTest, AVFrame) { FuncInst = AVUtilMod->findFuncExports( "wasmedge_ffmpeg_avutil_av_frame_set_nb_samples"); - auto &HostFuncAVFrameSetNbSamples = dynamic_cast< - WasmEdge::Host::WasmEdgeFFmpeg::AVUtil::AVFrameSetNbSamples &>( - FuncInst->getHostFunc()); + auto &HostFuncAVFrameSetNbSamples = FuncInst->getHostFunc(); int32_t NbSamples = 32; { @@ -653,9 +570,7 @@ TEST_F(FFmpegTest, AVFrame) { FuncInst = AVUtilMod->findFuncExports("wasmedge_ffmpeg_avutil_av_frame_nb_samples"); - auto &HostFuncAVFrameNbSamples = - dynamic_cast( - FuncInst->getHostFunc()); + auto &HostFuncAVFrameNbSamples = FuncInst->getHostFunc(); { HostFuncAVFrameNbSamples.run( @@ -666,9 +581,7 @@ TEST_F(FFmpegTest, AVFrame) { FuncInst = AVUtilMod->findFuncExports( "wasmedge_ffmpeg_avutil_av_frame_set_sample_rate"); - auto &HostFuncAVFrameSetSampleRate = dynamic_cast< - WasmEdge::Host::WasmEdgeFFmpeg::AVUtil::AVFrameSetSampleRate &>( - FuncInst->getHostFunc()); + auto &HostFuncAVFrameSetSampleRate = FuncInst->getHostFunc(); int32_t SampleRate = 10; { @@ -681,9 +594,7 @@ TEST_F(FFmpegTest, AVFrame) { FuncInst = AVUtilMod->findFuncExports("wasmedge_ffmpeg_avutil_av_frame_sample_rate"); - auto &HostFuncAVFrameSampleRate = - dynamic_cast( - FuncInst->getHostFunc()); + auto &HostFuncAVFrameSampleRate = FuncInst->getHostFunc(); { HostFuncAVFrameSampleRate.run( @@ -694,9 +605,7 @@ TEST_F(FFmpegTest, AVFrame) { FuncInst = AVUtilMod->findFuncExports( "wasmedge_ffmpeg_avutil_av_frame_set_channels"); - auto &HostFuncAVFrameSetChannels = dynamic_cast< - WasmEdge::Host::WasmEdgeFFmpeg::AVUtil::AVFrameSetChannels &>( - FuncInst->getHostFunc()); + auto &HostFuncAVFrameSetChannels = FuncInst->getHostFunc(); int32_t Channels = 3; { @@ -709,9 +618,7 @@ TEST_F(FFmpegTest, AVFrame) { FuncInst = AVUtilMod->findFuncExports("wasmedge_ffmpeg_avutil_av_frame_channels"); - auto &HostFuncAVFrameChannels = - dynamic_cast( - FuncInst->getHostFunc()); + auto &HostFuncAVFrameChannels = FuncInst->getHostFunc(); { HostFuncAVFrameChannels.run( @@ -722,9 +629,7 @@ TEST_F(FFmpegTest, AVFrame) { FuncInst = AVUtilMod->findFuncExports( "wasmedge_ffmpeg_avutil_av_frame_set_channel_layout"); - auto &HostFuncAVFrameSetChannelLayout = dynamic_cast< - WasmEdge::Host::WasmEdgeFFmpeg::AVUtil::AVFrameSetChannelLayout &>( - FuncInst->getHostFunc()); + auto &HostFuncAVFrameSetChannelLayout = FuncInst->getHostFunc(); uint64_t ChannelLayout = 1UL << 10; { @@ -737,9 +642,7 @@ TEST_F(FFmpegTest, AVFrame) { FuncInst = AVUtilMod->findFuncExports( "wasmedge_ffmpeg_avutil_av_frame_channel_layout"); - auto &HostFuncAVFrameChannelLayout = dynamic_cast< - WasmEdge::Host::WasmEdgeFFmpeg::AVUtil::AVFrameChannelLayout &>( - FuncInst->getHostFunc()); + auto &HostFuncAVFrameChannelLayout = FuncInst->getHostFunc(); { HostFuncAVFrameChannelLayout.run( diff --git a/test/plugins/wasmedge_ffmpeg/avutil/avPixfmt.cpp b/test/plugins/wasmedge_ffmpeg/avutil/avPixfmt.cpp index 625acd10..6c1f3f49 100644 --- a/test/plugins/wasmedge_ffmpeg/avutil/avPixfmt.cpp +++ b/test/plugins/wasmedge_ffmpeg/avutil/avPixfmt.cpp @@ -17,9 +17,7 @@ TEST_F(FFmpegTest, AVPixFmt) { auto *FuncInst = AVUtilMod->findFuncExports( "wasmedge_ffmpeg_avutil_avpixfmtdescriptor_nb_components"); - auto &HostFuncAVPixFmtDescriptorNbComponents = dynamic_cast< - WasmEdge::Host::WasmEdgeFFmpeg::AVUtil::AvPixFmtDescriptorNbComponents &>( - FuncInst->getHostFunc()); + auto &HostFuncAVPixFmtDescriptorNbComponents = FuncInst->getHostFunc(); uint32_t PixFmtId = 3; // RGB24 @@ -33,9 +31,7 @@ TEST_F(FFmpegTest, AVPixFmt) { FuncInst = AVUtilMod->findFuncExports( "wasmedge_ffmpeg_avutil_avpixfmtdescriptor_log2_chromaw"); - auto &HostFuncAvPixFmtDescriptorLog2ChromaW = dynamic_cast< - WasmEdge::Host::WasmEdgeFFmpeg::AVUtil::AvPixFmtDescriptorLog2ChromaW &>( - FuncInst->getHostFunc()); + auto &HostFuncAvPixFmtDescriptorLog2ChromaW = FuncInst->getHostFunc(); { HostFuncAvPixFmtDescriptorLog2ChromaW.run( @@ -46,9 +42,7 @@ TEST_F(FFmpegTest, AVPixFmt) { FuncInst = AVUtilMod->findFuncExports( "wasmedge_ffmpeg_avutil_avpixfmtdescriptor_log2_chromah"); - auto &HostFuncAvPixFmtDescriptorLog2ChromaH = dynamic_cast< - WasmEdge::Host::WasmEdgeFFmpeg::AVUtil::AvPixFmtDescriptorLog2ChromaH &>( - FuncInst->getHostFunc()); + auto &HostFuncAvPixFmtDescriptorLog2ChromaH = FuncInst->getHostFunc(); { HostFuncAvPixFmtDescriptorLog2ChromaH.run( @@ -62,9 +56,7 @@ TEST_F(FFmpegTest, AVPixFmt) { int32_t TransferCharacteristicId = 6; // (SMPTE170M) FuncInst = AVUtilMod->findFuncExports( "wasmedge_ffmpeg_avutil_av_color_transfer_name_length"); - auto &HostFuncAVColorTransferNameLength = dynamic_cast< - WasmEdge::Host::WasmEdgeFFmpeg::AVUtil::AVColorTransferNameLength &>( - FuncInst->getHostFunc()); + auto &HostFuncAVColorTransferNameLength = FuncInst->getHostFunc(); { HostFuncAVColorTransferNameLength.run( @@ -79,9 +71,7 @@ TEST_F(FFmpegTest, AVPixFmt) { fillMemContent(MemInst, NamePtr, Length); FuncInst = AVUtilMod->findFuncExports( "wasmedge_ffmpeg_avutil_av_color_transfer_name"); - auto &HostFuncAVColorTransferName = dynamic_cast< - WasmEdge::Host::WasmEdgeFFmpeg::AVUtil::AVColorTransferName &>( - FuncInst->getHostFunc()); + auto &HostFuncAVColorTransferName = FuncInst->getHostFunc(); { HostFuncAVColorTransferName.run( @@ -96,9 +86,7 @@ TEST_F(FFmpegTest, AVPixFmt) { int32_t ColorRangeId = 2; //; JPEG FuncInst = AVUtilMod->findFuncExports( "wasmedge_ffmpeg_avutil_av_color_range_name_length"); - auto &HostFuncAVColorRangeNameLength = dynamic_cast< - WasmEdge::Host::WasmEdgeFFmpeg::AVUtil::AVColorRangeNameLength &>( - FuncInst->getHostFunc()); + auto &HostFuncAVColorRangeNameLength = FuncInst->getHostFunc(); { HostFuncAVColorRangeNameLength.run( @@ -113,9 +101,7 @@ TEST_F(FFmpegTest, AVPixFmt) { fillMemContent(MemInst, NamePtr, Length); FuncInst = AVUtilMod->findFuncExports("wasmedge_ffmpeg_avutil_av_color_range_name"); - auto &HostFuncAVColorRangeName = - dynamic_cast( - FuncInst->getHostFunc()); + auto &HostFuncAVColorRangeName = FuncInst->getHostFunc(); { HostFuncAVColorRangeName.run(CallFrame, @@ -129,9 +115,7 @@ TEST_F(FFmpegTest, AVPixFmt) { int32_t ColorSpaceId = 1; // BT709 FuncInst = AVUtilMod->findFuncExports( "wasmedge_ffmpeg_avutil_av_color_space_name_length"); - auto &HostFuncAVColorSpaceNameLength = dynamic_cast< - WasmEdge::Host::WasmEdgeFFmpeg::AVUtil::AVColorSpaceNameLength &>( - FuncInst->getHostFunc()); + auto &HostFuncAVColorSpaceNameLength = FuncInst->getHostFunc(); { HostFuncAVColorSpaceNameLength.run( @@ -146,9 +130,7 @@ TEST_F(FFmpegTest, AVPixFmt) { fillMemContent(MemInst, NamePtr, Length); FuncInst = AVUtilMod->findFuncExports("wasmedge_ffmpeg_avutil_av_color_space_name"); - auto &HostFuncAVColorSpaceName = - dynamic_cast( - FuncInst->getHostFunc()); + auto &HostFuncAVColorSpaceName = FuncInst->getHostFunc(); { HostFuncAVColorSpaceName.run(CallFrame, @@ -162,9 +144,7 @@ TEST_F(FFmpegTest, AVPixFmt) { int32_t ColorPrimariesId = 1; // BT709 FuncInst = AVUtilMod->findFuncExports( "wasmedge_ffmpeg_avutil_av_color_primaries_name_length"); - auto &HostFuncAVColorPrimariesNameLength = dynamic_cast< - WasmEdge::Host::WasmEdgeFFmpeg::AVUtil::AVColorPrimariesNameLength &>( - FuncInst->getHostFunc()); + auto &HostFuncAVColorPrimariesNameLength = FuncInst->getHostFunc(); { HostFuncAVColorPrimariesNameLength.run( @@ -179,9 +159,7 @@ TEST_F(FFmpegTest, AVPixFmt) { fillMemContent(MemInst, NamePtr, Length); FuncInst = AVUtilMod->findFuncExports( "wasmedge_ffmpeg_avutil_av_color_primaries_name"); - auto &HostFuncAVColorPrimariesName = dynamic_cast< - WasmEdge::Host::WasmEdgeFFmpeg::AVUtil::AVColorPrimariesName &>( - FuncInst->getHostFunc()); + auto &HostFuncAVColorPrimariesName = FuncInst->getHostFunc(); { HostFuncAVColorPrimariesName.run( @@ -196,9 +174,7 @@ TEST_F(FFmpegTest, AVPixFmt) { PixFmtId = 1; // YUV420P FuncInst = AVUtilMod->findFuncExports( "wasmedge_ffmpeg_avutil_av_pix_format_name_length"); - auto &HostFuncAVPixFormatNameLength = dynamic_cast< - WasmEdge::Host::WasmEdgeFFmpeg::AVUtil::AVPixelFormatNameLength &>( - FuncInst->getHostFunc()); + auto &HostFuncAVPixFormatNameLength = FuncInst->getHostFunc(); { HostFuncAVPixFormatNameLength.run( @@ -213,9 +189,7 @@ TEST_F(FFmpegTest, AVPixFmt) { fillMemContent(MemInst, NamePtr, Length); FuncInst = AVUtilMod->findFuncExports("wasmedge_ffmpeg_avutil_av_pix_format_name"); - auto &HostFuncAVPixFormatName = - dynamic_cast( - FuncInst->getHostFunc()); + auto &HostFuncAVPixFormatName = FuncInst->getHostFunc(); { HostFuncAVPixFormatName.run( @@ -228,9 +202,7 @@ TEST_F(FFmpegTest, AVPixFmt) { FuncInst = AVUtilMod->findFuncExports("wasmedge_ffmpeg_avutil_av_pix_format_mask"); - auto &HostFuncAVPixFormatMask = - dynamic_cast( - FuncInst->getHostFunc()); + auto &HostFuncAVPixFormatMask = FuncInst->getHostFunc(); { uint32_t PixId = 3; // AV_PIX_FMT_RGB24: diff --git a/test/plugins/wasmedge_ffmpeg/avutil/avRational.cpp b/test/plugins/wasmedge_ffmpeg/avutil/avRational.cpp index 85223ad9..d710cb1e 100644 --- a/test/plugins/wasmedge_ffmpeg/avutil/avRational.cpp +++ b/test/plugins/wasmedge_ffmpeg/avutil/avRational.cpp @@ -23,9 +23,7 @@ TEST_F(FFmpegTest, AVRational) { AVUtilMod->findFuncExports("wasmedge_ffmpeg_avutil_av_add_q"); EXPECT_NE(FuncInst, nullptr); EXPECT_TRUE(FuncInst->isHostFunction()); - auto &HostFuncAVAddQ = - dynamic_cast( - FuncInst->getHostFunc()); + auto &HostFuncAVAddQ = FuncInst->getHostFunc(); { int32_t ANum = 3; @@ -46,9 +44,7 @@ TEST_F(FFmpegTest, AVRational) { FuncInst = AVUtilMod->findFuncExports("wasmedge_ffmpeg_avutil_av_sub_q"); EXPECT_NE(FuncInst, nullptr); EXPECT_TRUE(FuncInst->isHostFunction()); - auto &HostFuncAVSubQ = - dynamic_cast( - FuncInst->getHostFunc()); + auto &HostFuncAVSubQ = FuncInst->getHostFunc(); { int32_t ANum = -843; @@ -71,9 +67,7 @@ TEST_F(FFmpegTest, AVRational) { FuncInst = AVUtilMod->findFuncExports("wasmedge_ffmpeg_avutil_av_mul_q"); EXPECT_NE(FuncInst, nullptr); EXPECT_TRUE(FuncInst->isHostFunction()); - auto &HostFuncAVMulQ = - dynamic_cast( - FuncInst->getHostFunc()); + auto &HostFuncAVMulQ = FuncInst->getHostFunc(); { int32_t ANum = -6; @@ -96,9 +90,7 @@ TEST_F(FFmpegTest, AVRational) { FuncInst = AVUtilMod->findFuncExports("wasmedge_ffmpeg_avutil_av_div_q"); EXPECT_NE(FuncInst, nullptr); EXPECT_TRUE(FuncInst->isHostFunction()); - auto &HostFuncAVDivQ = - dynamic_cast( - FuncInst->getHostFunc()); + auto &HostFuncAVDivQ = FuncInst->getHostFunc(); { int32_t ANum = -6; @@ -123,9 +115,7 @@ TEST_F(FFmpegTest, AVRational) { FuncInst = AVUtilMod->findFuncExports("wasmedge_ffmpeg_avutil_av_d2q"); EXPECT_NE(FuncInst, nullptr); EXPECT_TRUE(FuncInst->isHostFunction()); - auto &HostFuncAVD2Q = - dynamic_cast( - FuncInst->getHostFunc()); + auto &HostFuncAVD2Q = FuncInst->getHostFunc(); { double D = 5; @@ -147,9 +137,7 @@ TEST_F(FFmpegTest, AVRational) { FuncInst = AVUtilMod->findFuncExports("wasmedge_ffmpeg_avutil_av_q2d"); EXPECT_NE(FuncInst, nullptr); EXPECT_TRUE(FuncInst->isHostFunction()); - auto &HostFuncAVQ2d = - dynamic_cast( - FuncInst->getHostFunc()); + auto &HostFuncAVQ2d = FuncInst->getHostFunc(); { // Convert Rational Number to Double. @@ -167,9 +155,7 @@ TEST_F(FFmpegTest, AVRational) { FuncInst = AVUtilMod->findFuncExports("wasmedge_ffmpeg_avutil_av_inv_q"); EXPECT_NE(FuncInst, nullptr); EXPECT_TRUE(FuncInst->isHostFunction()); - auto &HostFuncInvQ = - dynamic_cast( - FuncInst->getHostFunc()); + auto &HostFuncInvQ = FuncInst->getHostFunc(); { // Inverse a Rational Number. @@ -191,9 +177,7 @@ TEST_F(FFmpegTest, AVRational) { FuncInst = AVUtilMod->findFuncExports("wasmedge_ffmpeg_avutil_av_q2intfloat"); EXPECT_NE(FuncInst, nullptr); EXPECT_TRUE(FuncInst->isHostFunction()); - auto &HostFuncAVQ2IntFloat = - dynamic_cast( - FuncInst->getHostFunc()); + auto &HostFuncAVQ2IntFloat = FuncInst->getHostFunc(); { int32_t ANum = 1; @@ -208,9 +192,7 @@ TEST_F(FFmpegTest, AVRational) { FuncInst = AVUtilMod->findFuncExports("wasmedge_ffmpeg_avutil_av_nearer_q"); EXPECT_NE(FuncInst, nullptr); EXPECT_TRUE(FuncInst->isHostFunction()); - auto &HostFuncAVNearerQ = - dynamic_cast( - FuncInst->getHostFunc()); + auto &HostFuncAVNearerQ = FuncInst->getHostFunc(); { int32_t ANum = 1; @@ -253,9 +235,7 @@ TEST_F(FFmpegTest, AVRational) { FuncInst = AVUtilMod->findFuncExports("wasmedge_ffmpeg_avutil_av_cmp_q"); EXPECT_NE(FuncInst, nullptr); EXPECT_TRUE(FuncInst->isHostFunction()); - auto &HostFuncAVCmpQ = - dynamic_cast( - FuncInst->getHostFunc()); + auto &HostFuncAVCmpQ = FuncInst->getHostFunc(); { int32_t ANum = 1; @@ -295,9 +275,7 @@ TEST_F(FFmpegTest, AVRational) { FuncInst = AVUtilMod->findFuncExports("wasmedge_ffmpeg_avutil_av_reduce"); EXPECT_NE(FuncInst, nullptr); EXPECT_TRUE(FuncInst->isHostFunction()); - auto &HostFuncAVReduce = - dynamic_cast( - FuncInst->getHostFunc()); + auto &HostFuncAVReduce = FuncInst->getHostFunc(); { int64_t ANum = 1; diff --git a/test/plugins/wasmedge_ffmpeg/avutil/avSampleFmt.cpp b/test/plugins/wasmedge_ffmpeg/avutil/avSampleFmt.cpp index d12cd16d..a856e10d 100644 --- a/test/plugins/wasmedge_ffmpeg/avutil/avSampleFmt.cpp +++ b/test/plugins/wasmedge_ffmpeg/avutil/avSampleFmt.cpp @@ -23,9 +23,7 @@ TEST_F(FFmpegTest, AVSampleFmt) { uint32_t SampleFmtId = 1; // AV_SAMPLE_FMT_S32 auto *FuncInst = AVUtilMod->findFuncExports( "wasmedge_ffmpeg_avutil_av_get_packed_sample_fmt"); - auto &HostFuncAVGetPackedSampleFmt = dynamic_cast< - WasmEdge::Host::WasmEdgeFFmpeg::AVUtil::AVGetPackedSampleFmt &>( - FuncInst->getHostFunc()); + auto &HostFuncAVGetPackedSampleFmt = FuncInst->getHostFunc(); { HostFuncAVGetPackedSampleFmt.run( @@ -37,9 +35,7 @@ TEST_F(FFmpegTest, AVSampleFmt) { FuncInst = AVUtilMod->findFuncExports( "wasmedge_ffmpeg_avutil_av_get_planar_sample_fmt"); - auto &HostFuncAVGetPlanarSampleFmt = dynamic_cast< - WasmEdge::Host::WasmEdgeFFmpeg::AVUtil::AVGetPlanarSampleFmt &>( - FuncInst->getHostFunc()); + auto &HostFuncAVGetPlanarSampleFmt = FuncInst->getHostFunc(); { HostFuncAVGetPlanarSampleFmt.run( @@ -51,9 +47,7 @@ TEST_F(FFmpegTest, AVSampleFmt) { FuncInst = AVUtilMod->findFuncExports( "wasmedge_ffmpeg_avutil_av_sample_fmt_is_planar"); - auto &HostFuncAVSampleFmtIsPlanar = dynamic_cast< - WasmEdge::Host::WasmEdgeFFmpeg::AVUtil::AVSampleFmtIsPlanar &>( - FuncInst->getHostFunc()); + auto &HostFuncAVSampleFmtIsPlanar = FuncInst->getHostFunc(); { HostFuncAVSampleFmtIsPlanar.run( @@ -65,9 +59,7 @@ TEST_F(FFmpegTest, AVSampleFmt) { FuncInst = AVUtilMod->findFuncExports( "wasmedge_ffmpeg_avutil_av_get_bytes_per_sample"); - auto &HostFuncAVGetBytesPerSample = dynamic_cast< - WasmEdge::Host::WasmEdgeFFmpeg::AVUtil::AVGetBytesPerSample &>( - FuncInst->getHostFunc()); + auto &HostFuncAVGetBytesPerSample = FuncInst->getHostFunc(); { HostFuncAVGetBytesPerSample.run( @@ -79,9 +71,7 @@ TEST_F(FFmpegTest, AVSampleFmt) { FuncInst = AVUtilMod->findFuncExports("wasmedge_ffmpeg_avutil_av_get_sample_fmt"); - auto &HostFuncAVGetSampleFmt = - dynamic_cast( - FuncInst->getHostFunc()); + auto &HostFuncAVGetSampleFmt = FuncInst->getHostFunc(); uint32_t SampleFmtStart = 100; uint32_t SampleFmtSize = 2; @@ -99,9 +89,7 @@ TEST_F(FFmpegTest, AVSampleFmt) { FuncInst = AVUtilMod->findFuncExports( "wasmedge_ffmpeg_avutil_av_samples_get_buffer_size"); - auto &HostFuncAVSamplesGetBufferSize = dynamic_cast< - WasmEdge::Host::WasmEdgeFFmpeg::AVUtil::AVSamplesGetBufferSize &>( - FuncInst->getHostFunc()); + auto &HostFuncAVSamplesGetBufferSize = FuncInst->getHostFunc(); int32_t NbChannels = 1; int32_t NbSamples = 5; @@ -120,9 +108,7 @@ TEST_F(FFmpegTest, AVSampleFmt) { FuncInst = AVUtilMod->findFuncExports( "wasmedge_ffmpeg_avutil_av_samples_alloc_array_and_samples"); - auto &HostFuncAVSamplesAllocArrayAndSamples = dynamic_cast< - WasmEdge::Host::WasmEdgeFFmpeg::AVUtil::AVSamplesAllocArrayAndSamples &>( - FuncInst->getHostFunc()); + auto &HostFuncAVSamplesAllocArrayAndSamples = FuncInst->getHostFunc(); { HostFuncAVSamplesAllocArrayAndSamples.run( @@ -140,9 +126,7 @@ TEST_F(FFmpegTest, AVSampleFmt) { int32_t Length = 0; FuncInst = AVUtilMod->findFuncExports( "wasmedge_ffmpeg_avutil_av_get_sample_fmt_name_length"); - auto &HostFuncAVGetSampleFmtNameLength = dynamic_cast< - WasmEdge::Host::WasmEdgeFFmpeg::AVUtil::AVGetSampleFmtNameLength &>( - FuncInst->getHostFunc()); + auto &HostFuncAVGetSampleFmtNameLength = FuncInst->getHostFunc(); { HostFuncAVGetSampleFmtNameLength.run( @@ -155,9 +139,7 @@ TEST_F(FFmpegTest, AVSampleFmt) { FuncInst = AVUtilMod->findFuncExports( "wasmedge_ffmpeg_avutil_av_get_sample_fmt_name"); - auto &HostFuncAVGetSampleFmtName = dynamic_cast< - WasmEdge::Host::WasmEdgeFFmpeg::AVUtil::AVGetSampleFmtName &>( - FuncInst->getHostFunc()); + auto &HostFuncAVGetSampleFmtName = FuncInst->getHostFunc(); // Fill Memory with 0. fillMemContent(MemInst, NamePtr, Length); @@ -172,9 +154,7 @@ TEST_F(FFmpegTest, AVSampleFmt) { FuncInst = AVUtilMod->findFuncExports( "wasmedge_ffmpeg_avutil_av_get_sample_fmt_mask"); - auto &HostFuncAVGetSampleFmtMask = dynamic_cast< - WasmEdge::Host::WasmEdgeFFmpeg::AVUtil::AVGetSampleFmtMask &>( - FuncInst->getHostFunc()); + auto &HostFuncAVGetSampleFmtMask = FuncInst->getHostFunc(); { uint32_t SampleId = 2; // AV_SAMPLE_FMT_S16; @@ -186,9 +166,7 @@ TEST_F(FFmpegTest, AVSampleFmt) { } FuncInst = AVUtilMod->findFuncExports("wasmedge_ffmpeg_avutil_av_freep"); - auto &HostFuncAVFreep = - dynamic_cast( - FuncInst->getHostFunc()); + auto &HostFuncAVFreep = FuncInst->getHostFunc(); { uint32_t BufferId = readUInt32(MemInst, BufferPtr); diff --git a/test/plugins/wasmedge_ffmpeg/avutil/avutil_func.cpp b/test/plugins/wasmedge_ffmpeg/avutil/avutil_func.cpp index 2406cea1..1adcbd03 100644 --- a/test/plugins/wasmedge_ffmpeg/avutil/avutil_func.cpp +++ b/test/plugins/wasmedge_ffmpeg/avutil/avutil_func.cpp @@ -20,9 +20,7 @@ TEST_F(FFmpegTest, AVUtilFunc) { auto *FuncInst = AVUtilMod->findFuncExports("wasmedge_ffmpeg_avutil_av_log_set_level"); - auto &HostFuncAVLogSetLevel = - dynamic_cast( - FuncInst->getHostFunc()); + auto &HostFuncAVLogSetLevel = FuncInst->getHostFunc(); int32_t LogLvlId = 32; { @@ -33,9 +31,7 @@ TEST_F(FFmpegTest, AVUtilFunc) { FuncInst = AVUtilMod->findFuncExports("wasmedge_ffmpeg_avutil_av_log_get_level"); - auto &HostFuncAVLogGetLevel = - dynamic_cast( - FuncInst->getHostFunc()); + auto &HostFuncAVLogGetLevel = FuncInst->getHostFunc(); { HostFuncAVLogGetLevel.run( @@ -45,9 +41,7 @@ TEST_F(FFmpegTest, AVUtilFunc) { FuncInst = AVUtilMod->findFuncExports("wasmedge_ffmpeg_avutil_av_log_set_flags"); - auto &HostFuncAVLogSetFlags = - dynamic_cast( - FuncInst->getHostFunc()); + auto &HostFuncAVLogSetFlags = FuncInst->getHostFunc(); { HostFuncAVLogSetFlags.run( @@ -56,9 +50,7 @@ TEST_F(FFmpegTest, AVUtilFunc) { FuncInst = AVUtilMod->findFuncExports("wasmedge_ffmpeg_avutil_av_log_get_flags"); - auto &HostFuncAVLogGetFlags = - dynamic_cast( - FuncInst->getHostFunc()); + auto &HostFuncAVLogGetFlags = FuncInst->getHostFunc(); { HostFuncAVLogGetFlags.run( @@ -68,9 +60,7 @@ TEST_F(FFmpegTest, AVUtilFunc) { } FuncInst = AVUtilMod->findFuncExports("wasmedge_ffmpeg_avutil_av_rescale_q"); - auto &HostFuncAVRescaleQ = - dynamic_cast( - FuncInst->getHostFunc()); + auto &HostFuncAVRescaleQ = FuncInst->getHostFunc(); int64_t A = 20; int32_t BNum = 5; @@ -89,9 +79,7 @@ TEST_F(FFmpegTest, AVUtilFunc) { FuncInst = AVUtilMod->findFuncExports("wasmedge_ffmpeg_avutil_av_rescale_q_rnd"); - auto &HostFuncAVRescaleQRnd = - dynamic_cast( - FuncInst->getHostFunc()); + auto &HostFuncAVRescaleQRnd = FuncInst->getHostFunc(); { int32_t RoundingId = 2; @@ -105,9 +93,7 @@ TEST_F(FFmpegTest, AVUtilFunc) { FuncInst = AVUtilMod->findFuncExports("wasmedge_ffmpeg_avutil_avutil_version"); - auto &HostFuncAVUtilVersion = - dynamic_cast( - FuncInst->getHostFunc()); + auto &HostFuncAVUtilVersion = FuncInst->getHostFunc(); { HostFuncAVUtilVersion.run( @@ -119,9 +105,7 @@ TEST_F(FFmpegTest, AVUtilFunc) { uint64_t ChannelId = 1; // FRONT_LEFT FuncInst = AVUtilMod->findFuncExports( "wasmedge_ffmpeg_avutil_av_get_channel_layout_nb_channels"); - auto &HostFuncAVGetChannelLayoutNbChannels = dynamic_cast< - WasmEdge::Host::WasmEdgeFFmpeg::AVUtil::AVGetChannelLayoutNbChannels &>( - FuncInst->getHostFunc()); + auto &HostFuncAVGetChannelLayoutNbChannels = FuncInst->getHostFunc(); { HostFuncAVGetChannelLayoutNbChannels.run( @@ -132,9 +116,7 @@ TEST_F(FFmpegTest, AVUtilFunc) { FuncInst = AVUtilMod->findFuncExports( "wasmedge_ffmpeg_avutil_av_get_default_channel_layout"); - auto &HostFuncAVGetDefaultChannelLayout = dynamic_cast< - WasmEdge::Host::WasmEdgeFFmpeg::AVUtil::AVGetDefaultChannelLayout &>( - FuncInst->getHostFunc()); + auto &HostFuncAVGetDefaultChannelLayout = FuncInst->getHostFunc(); { HostFuncAVGetDefaultChannelLayout.run( @@ -146,9 +128,7 @@ TEST_F(FFmpegTest, AVUtilFunc) { uint32_t Length = 0; FuncInst = AVUtilMod->findFuncExports( "wasmedge_ffmpeg_avutil_avutil_configuration_length"); - auto &HostFuncAVUtilConfigurationLength = dynamic_cast< - WasmEdge::Host::WasmEdgeFFmpeg::AVUtil::AVUtilConfigurationLength &>( - FuncInst->getHostFunc()); + auto &HostFuncAVUtilConfigurationLength = FuncInst->getHostFunc(); { HostFuncAVUtilConfigurationLength.run( @@ -162,9 +142,7 @@ TEST_F(FFmpegTest, AVUtilFunc) { fillMemContent(MemInst, NamePtr, Length); FuncInst = AVUtilMod->findFuncExports("wasmedge_ffmpeg_avutil_avutil_configuration"); - auto &HostFuncAVUtilConfiguration = dynamic_cast< - WasmEdge::Host::WasmEdgeFFmpeg::AVUtil::AVUtilConfiguration &>( - FuncInst->getHostFunc()); + auto &HostFuncAVUtilConfiguration = FuncInst->getHostFunc(); { HostFuncAVUtilConfiguration.run( @@ -175,9 +153,7 @@ TEST_F(FFmpegTest, AVUtilFunc) { FuncInst = AVUtilMod->findFuncExports( "wasmedge_ffmpeg_avutil_avutil_license_length"); - auto &HostFuncAVUtilLicenseLength = dynamic_cast< - WasmEdge::Host::WasmEdgeFFmpeg::AVUtil::AVUtilLicenseLength &>( - FuncInst->getHostFunc()); + auto &HostFuncAVUtilLicenseLength = FuncInst->getHostFunc(); { HostFuncAVUtilLicenseLength.run( @@ -191,9 +167,7 @@ TEST_F(FFmpegTest, AVUtilFunc) { fillMemContent(MemInst, NamePtr, Length); FuncInst = AVUtilMod->findFuncExports("wasmedge_ffmpeg_avutil_avutil_license"); - auto &HostFuncAVUtilLicense = - dynamic_cast( - FuncInst->getHostFunc()); + auto &HostFuncAVUtilLicense = FuncInst->getHostFunc(); { HostFuncAVUtilLicense.run( @@ -209,9 +183,7 @@ TEST_F(FFmpegTest, AVTime) { auto *FuncInst = AVUtilMod->findFuncExports("wasmedge_ffmpeg_avutil_av_gettime"); - auto &HostFuncAVGetTime = - dynamic_cast( - FuncInst->getHostFunc()); + auto &HostFuncAVGetTime = FuncInst->getHostFunc(); { HostFuncAVGetTime.run( @@ -222,9 +194,7 @@ TEST_F(FFmpegTest, AVTime) { FuncInst = AVUtilMod->findFuncExports("wasmedge_ffmpeg_avutil_av_gettime_relative"); - auto &HostFuncAVGetTimeRelative = - dynamic_cast( - FuncInst->getHostFunc()); + auto &HostFuncAVGetTimeRelative = FuncInst->getHostFunc(); { HostFuncAVGetTimeRelative.run( @@ -235,9 +205,7 @@ TEST_F(FFmpegTest, AVTime) { FuncInst = AVUtilMod->findFuncExports( "wasmedge_ffmpeg_avutil_av_gettime_relative_is_monotonic"); - auto &HostFuncAVGetTimeRelativeIsMonotonic = dynamic_cast< - WasmEdge::Host::WasmEdgeFFmpeg::AVUtil::AVGetTimeRelativeIsMonotonic &>( - FuncInst->getHostFunc()); + auto &HostFuncAVGetTimeRelativeIsMonotonic = FuncInst->getHostFunc(); { HostFuncAVGetTimeRelativeIsMonotonic.run( @@ -247,9 +215,7 @@ TEST_F(FFmpegTest, AVTime) { } FuncInst = AVUtilMod->findFuncExports("wasmedge_ffmpeg_avutil_av_usleep"); - auto &HostFuncAVUSleep = - dynamic_cast( - FuncInst->getHostFunc()); + auto &HostFuncAVUSleep = FuncInst->getHostFunc(); { HostFuncAVUSleep.run( diff --git a/test/plugins/wasmedge_ffmpeg/swresample/swresample_func.cpp b/test/plugins/wasmedge_ffmpeg/swresample/swresample_func.cpp index 6f84db6f..69557be4 100644 --- a/test/plugins/wasmedge_ffmpeg/swresample/swresample_func.cpp +++ b/test/plugins/wasmedge_ffmpeg/swresample/swresample_func.cpp @@ -39,9 +39,7 @@ TEST_F(FFmpegTest, SWResampleFunc) { "wasmedge_ffmpeg_swresample_swresample_version"); EXPECT_NE(FuncInst, nullptr); EXPECT_TRUE(FuncInst->isHostFunction()); - auto &HostFuncSWResampleVersion = dynamic_cast< - WasmEdge::Host::WasmEdgeFFmpeg::SWResample::SWResampleVersion &>( - FuncInst->getHostFunc()); + auto &HostFuncSWResampleVersion = FuncInst->getHostFunc(); { EXPECT_TRUE(HostFuncSWResampleVersion.run(CallFrame, {}, Result)); @@ -52,9 +50,7 @@ TEST_F(FFmpegTest, SWResampleFunc) { "wasmedge_ffmpeg_swresample_swr_alloc_set_opts"); EXPECT_NE(FuncInst, nullptr); EXPECT_TRUE(FuncInst->isHostFunction()); - auto &HostFuncSwrAllocSetOpts = dynamic_cast< - WasmEdge::Host::WasmEdgeFFmpeg::SWResample::SWRAllocSetOpts &>( - FuncInst->getHostFunc()); + auto &HostFuncSwrAllocSetOpts = FuncInst->getHostFunc(); // Testing with Null Old SwrCtx. Hence 2nd argument is 0. { @@ -102,9 +98,7 @@ TEST_F(FFmpegTest, SWResampleFunc) { SWResampleMod->findFuncExports("wasmedge_ffmpeg_swresample_swr_free"); EXPECT_NE(FuncInst, nullptr); EXPECT_TRUE(FuncInst->isHostFunction()); - auto &HostFuncSwrFree = - dynamic_cast( - FuncInst->getHostFunc()); + auto &HostFuncSwrFree = FuncInst->getHostFunc(); { EXPECT_TRUE(HostFuncSwrFree.run( @@ -116,9 +110,7 @@ TEST_F(FFmpegTest, SWResampleFunc) { SWResampleMod->findFuncExports("wasmedge_ffmpeg_swresample_swr_init"); EXPECT_NE(FuncInst, nullptr); EXPECT_TRUE(FuncInst->isHostFunction()); - auto &HostFuncSwrInit = - dynamic_cast( - FuncInst->getHostFunc()); + auto &HostFuncSwrInit = FuncInst->getHostFunc(); { SwrId = readUInt32(MemInst, SWResamplePtr); @@ -131,9 +123,7 @@ TEST_F(FFmpegTest, SWResampleFunc) { "wasmedge_ffmpeg_swresample_av_opt_set_dict"); EXPECT_NE(FuncInst, nullptr); EXPECT_TRUE(FuncInst->isHostFunction()); - auto &HostFuncAVOptSetDict = - dynamic_cast( - FuncInst->getHostFunc()); + auto &HostFuncAVOptSetDict = FuncInst->getHostFunc(); { uint32_t EmptyDictId = 0; @@ -157,9 +147,7 @@ TEST_F(FFmpegTest, SWResampleFunc) { "wasmedge_ffmpeg_swresample_swr_convert_frame"); EXPECT_NE(FuncInst, nullptr); EXPECT_TRUE(FuncInst->isHostFunction()); - auto &HostFuncSwrConvertFrame = dynamic_cast< - WasmEdge::Host::WasmEdgeFFmpeg::SWResample::SWRConvertFrame &>( - FuncInst->getHostFunc()); + auto &HostFuncSwrConvertFrame = FuncInst->getHostFunc(); { SwrId = readUInt32(MemInst, SWResamplePtr); @@ -174,9 +162,7 @@ TEST_F(FFmpegTest, SWResampleFunc) { "wasmedge_ffmpeg_swresample_swr_get_delay"); EXPECT_NE(FuncInst, nullptr); EXPECT_TRUE(FuncInst->isHostFunction()); - auto &HostFuncSwrGetDelay = - dynamic_cast( - FuncInst->getHostFunc()); + auto &HostFuncSwrGetDelay = FuncInst->getHostFunc(); { SwrId = readUInt32(MemInst, SWResamplePtr); @@ -190,9 +176,7 @@ TEST_F(FFmpegTest, SWResampleFunc) { "wasmedge_ffmpeg_swresample_swresample_configuration_length"); EXPECT_NE(FuncInst, nullptr); EXPECT_TRUE(FuncInst->isHostFunction()); - auto &HostFuncSwrConfigLength = dynamic_cast< - WasmEdge::Host::WasmEdgeFFmpeg::SWResample::SWResampleConfigurationLength - &>(FuncInst->getHostFunc()); + auto &HostFuncSwrConfigLength = FuncInst->getHostFunc(); int32_t Length = 0; { @@ -207,9 +191,7 @@ TEST_F(FFmpegTest, SWResampleFunc) { "wasmedge_ffmpeg_swresample_swresample_configuration"); EXPECT_NE(FuncInst, nullptr); EXPECT_TRUE(FuncInst->isHostFunction()); - auto &HostFuncSwrConfig = dynamic_cast< - WasmEdge::Host::WasmEdgeFFmpeg::SWResample::SWResampleConfiguration &>( - FuncInst->getHostFunc()); + auto &HostFuncSwrConfig = FuncInst->getHostFunc(); { SwrId = readUInt32(MemInst, SWResamplePtr); @@ -223,9 +205,7 @@ TEST_F(FFmpegTest, SWResampleFunc) { "wasmedge_ffmpeg_swresample_swresample_license_length"); EXPECT_NE(FuncInst, nullptr); EXPECT_TRUE(FuncInst->isHostFunction()); - auto &HostFuncSwrLicenseLen = dynamic_cast< - WasmEdge::Host::WasmEdgeFFmpeg::SWResample::SWResampleLicenseLength &>( - FuncInst->getHostFunc()); + auto &HostFuncSwrLicenseLen = FuncInst->getHostFunc(); { SwrId = readUInt32(MemInst, SWResamplePtr); @@ -240,9 +220,7 @@ TEST_F(FFmpegTest, SWResampleFunc) { "wasmedge_ffmpeg_swresample_swresample_license"); EXPECT_NE(FuncInst, nullptr); EXPECT_TRUE(FuncInst->isHostFunction()); - auto &HostFuncSwrLicense = dynamic_cast< - WasmEdge::Host::WasmEdgeFFmpeg::SWResample::SWResampleLicense &>( - FuncInst->getHostFunc()); + auto &HostFuncSwrLicense = FuncInst->getHostFunc(); { SwrId = readUInt32(MemInst, SWResamplePtr); diff --git a/test/plugins/wasmedge_ffmpeg/swscale/swscale_func.cpp b/test/plugins/wasmedge_ffmpeg/swscale/swscale_func.cpp index 805b2224..38ba61a5 100644 --- a/test/plugins/wasmedge_ffmpeg/swscale/swscale_func.cpp +++ b/test/plugins/wasmedge_ffmpeg/swscale/swscale_func.cpp @@ -23,9 +23,7 @@ TEST_F(FFmpegTest, SwsContext) { SWScaleMod->findFuncExports("wasmedge_ffmpeg_swscale_sws_getContext"); EXPECT_NE(FuncInst, nullptr); EXPECT_TRUE(FuncInst->isHostFunction()); - auto &HostFuncSwsGetContext = - dynamic_cast( - FuncInst->getHostFunc()); + auto &HostFuncSwsGetContext = FuncInst->getHostFunc(); uint32_t SWScalePtr = UINT32_C(4); uint32_t SWCachedScalePtr = UINT32_C(8); @@ -73,9 +71,7 @@ TEST_F(FFmpegTest, SwsContext) { FuncInst = SWScaleMod->findFuncExports("wasmedge_ffmpeg_swscale_sws_scale"); EXPECT_NE(FuncInst, nullptr); EXPECT_TRUE(FuncInst->isHostFunction()); - auto &HostFuncSwsScale = - dynamic_cast( - FuncInst->getHostFunc()); + auto &HostFuncSwsScale = FuncInst->getHostFunc(); { EXPECT_TRUE( @@ -90,9 +86,7 @@ TEST_F(FFmpegTest, SwsContext) { "wasmedge_ffmpeg_swscale_sws_getCachedContext"); EXPECT_NE(FuncInst, nullptr); EXPECT_TRUE(FuncInst->isHostFunction()); - auto &HostFuncSwsGetCachedContext = dynamic_cast< - WasmEdge::Host::WasmEdgeFFmpeg::SWScale::SwsGetCachedContext &>( - FuncInst->getHostFunc()); + auto &HostFuncSwsGetCachedContext = FuncInst->getHostFunc(); { EXPECT_TRUE(HostFuncSwsGetCachedContext.run( @@ -109,9 +103,7 @@ TEST_F(FFmpegTest, SwsContext) { "wasmedge_ffmpeg_swscale_sws_isSupportedInput"); EXPECT_NE(FuncInst, nullptr); EXPECT_TRUE(FuncInst->isHostFunction()); - auto &HostFuncSwsIsSupportedInput = dynamic_cast< - WasmEdge::Host::WasmEdgeFFmpeg::SWScale::SwsIsSupportedInput &>( - FuncInst->getHostFunc()); + auto &HostFuncSwsIsSupportedInput = FuncInst->getHostFunc(); { // AV_PIX_FMT_RGB24 is a supported pixel format. @@ -131,9 +123,7 @@ TEST_F(FFmpegTest, SwsContext) { "wasmedge_ffmpeg_swscale_sws_isSupportedOutput"); EXPECT_NE(FuncInst, nullptr); EXPECT_TRUE(FuncInst->isHostFunction()); - auto &HostFuncSwsIsSupportedOutput = dynamic_cast< - WasmEdge::Host::WasmEdgeFFmpeg::SWScale::SwsIsSupportedOutput &>( - FuncInst->getHostFunc()); + auto &HostFuncSwsIsSupportedOutput = FuncInst->getHostFunc(); { // AV_PIX_FMT_RGB24 is a supported pixel format. @@ -153,10 +143,7 @@ TEST_F(FFmpegTest, SwsContext) { "wasmedge_ffmpeg_swscale_sws_isSupportedEndiannessConversion"); EXPECT_NE(FuncInst, nullptr); EXPECT_TRUE(FuncInst->isHostFunction()); - auto &HostFuncSwsIsSupportedEndiannessConversion = - dynamic_cast( - FuncInst->getHostFunc()); + auto &HostFuncSwsIsSupportedEndiannessConversion = FuncInst->getHostFunc(); { // AV_PIX_FMT_XVMC is not a supported pixel format for @@ -170,9 +157,7 @@ TEST_F(FFmpegTest, SwsContext) { SWScaleMod->findFuncExports("wasmedge_ffmpeg_swscale_sws_freeContext"); EXPECT_NE(FuncInst, nullptr); EXPECT_TRUE(FuncInst->isHostFunction()); - auto &HostFuncSwsFreeContext = - dynamic_cast( - FuncInst->getHostFunc()); + auto &HostFuncSwsFreeContext = FuncInst->getHostFunc(); { EXPECT_TRUE(HostFuncSwsFreeContext.run( @@ -207,9 +192,7 @@ TEST_F(FFmpegTest, SwsFilter) { "wasmedge_ffmpeg_swscale_sws_getDefaultFilter"); EXPECT_NE(FuncInst, nullptr); EXPECT_TRUE(FuncInst->isHostFunction()); - auto &HostFuncSwsGetDefaultFilter = dynamic_cast< - WasmEdge::Host::WasmEdgeFFmpeg::SWScale::SwsGetDefaultFilter &>( - FuncInst->getHostFunc()); + auto &HostFuncSwsGetDefaultFilter = FuncInst->getHostFunc(); uint32_t SwsFilterPtr = UINT32_C(40); { @@ -236,9 +219,7 @@ TEST_F(FFmpegTest, SwsFilter) { SWScaleMod->findFuncExports("wasmedge_ffmpeg_swscale_sws_getLumaH"); EXPECT_NE(FuncInst, nullptr); EXPECT_TRUE(FuncInst->isHostFunction()); - auto &HostFuncSwsGetLumaH = - dynamic_cast( - FuncInst->getHostFunc()); + auto &HostFuncSwsGetLumaH = FuncInst->getHostFunc(); uint32_t SwsVectorPtr = UINT32_C(20); { @@ -254,9 +235,7 @@ TEST_F(FFmpegTest, SwsFilter) { SWScaleMod->findFuncExports("wasmedge_ffmpeg_swscale_sws_getLumaV"); EXPECT_NE(FuncInst, nullptr); EXPECT_TRUE(FuncInst->isHostFunction()); - auto &HostFuncSwsGetLumaV = - dynamic_cast( - FuncInst->getHostFunc()); + auto &HostFuncSwsGetLumaV = FuncInst->getHostFunc(); { writeUInt32(MemInst, UINT32_C(0), SwsVectorPtr); @@ -272,9 +251,7 @@ TEST_F(FFmpegTest, SwsFilter) { SWScaleMod->findFuncExports("wasmedge_ffmpeg_swscale_sws_getChromaH"); EXPECT_NE(FuncInst, nullptr); EXPECT_TRUE(FuncInst->isHostFunction()); - auto &HostFuncSwsGetChromaH = - dynamic_cast( - FuncInst->getHostFunc()); + auto &HostFuncSwsGetChromaH = FuncInst->getHostFunc(); { EXPECT_TRUE(HostFuncSwsGetChromaH.run( @@ -289,9 +266,7 @@ TEST_F(FFmpegTest, SwsFilter) { SWScaleMod->findFuncExports("wasmedge_ffmpeg_swscale_sws_getChromaV"); EXPECT_NE(FuncInst, nullptr); EXPECT_TRUE(FuncInst->isHostFunction()); - auto &HostFuncSwsGetChromaV = - dynamic_cast( - FuncInst->getHostFunc()); + auto &HostFuncSwsGetChromaV = FuncInst->getHostFunc(); { EXPECT_TRUE(HostFuncSwsGetChromaV.run( @@ -306,9 +281,7 @@ TEST_F(FFmpegTest, SwsFilter) { SWScaleMod->findFuncExports("wasmedge_ffmpeg_swscale_sws_freeFilter"); EXPECT_NE(FuncInst, nullptr); EXPECT_TRUE(FuncInst->isHostFunction()); - auto &HostFuncSwsFreeFilter = - dynamic_cast( - FuncInst->getHostFunc()); + auto &HostFuncSwsFreeFilter = FuncInst->getHostFunc(); { EXPECT_TRUE(HostFuncSwsFreeFilter.run( @@ -331,9 +304,7 @@ TEST_F(FFmpegTest, SwsVector) { SWScaleMod->findFuncExports("wasmedge_ffmpeg_swscale_sws_allocVec"); EXPECT_NE(FuncInst, nullptr); EXPECT_TRUE(FuncInst->isHostFunction()); - auto &HostFuncSwsAllocVec = - dynamic_cast( - FuncInst->getHostFunc()); + auto &HostFuncSwsAllocVec = FuncInst->getHostFunc(); { writeUInt32(MemInst, UINT32_C(0), SwsVectorPtr); @@ -350,9 +321,7 @@ TEST_F(FFmpegTest, SwsVector) { SWScaleMod->findFuncExports("wasmedge_ffmpeg_swscale_sws_getGaussianVec"); EXPECT_NE(FuncInst, nullptr); EXPECT_TRUE(FuncInst->isHostFunction()); - auto &HostFuncSwsGetGaussianVec = dynamic_cast< - WasmEdge::Host::WasmEdgeFFmpeg::SWScale::SwsGetGaussianVec &>( - FuncInst->getHostFunc()); + auto &HostFuncSwsGetGaussianVec = FuncInst->getHostFunc(); { writeUInt32(MemInst, UINT32_C(0), SwsVectorPtr); @@ -371,9 +340,7 @@ TEST_F(FFmpegTest, SwsVector) { SWScaleMod->findFuncExports("wasmedge_ffmpeg_swscale_sws_scaleVec"); EXPECT_NE(FuncInst, nullptr); EXPECT_TRUE(FuncInst->isHostFunction()); - auto &HostFuncSwsScaleVec = - dynamic_cast( - FuncInst->getHostFunc()); + auto &HostFuncSwsScaleVec = FuncInst->getHostFunc(); { uint32_t SwsVecId = readUInt32(MemInst, SwsVectorPtr); @@ -388,9 +355,7 @@ TEST_F(FFmpegTest, SwsVector) { SWScaleMod->findFuncExports("wasmedge_ffmpeg_swscale_sws_normalizeVec"); EXPECT_NE(FuncInst, nullptr); EXPECT_TRUE(FuncInst->isHostFunction()); - auto &HostFuncSwsNormalizeVec = - dynamic_cast( - FuncInst->getHostFunc()); + auto &HostFuncSwsNormalizeVec = FuncInst->getHostFunc(); { uint32_t SwsVecId = readUInt32(MemInst, SwsVectorPtr); @@ -405,9 +370,7 @@ TEST_F(FFmpegTest, SwsVector) { "wasmedge_ffmpeg_swscale_sws_getCoeffVecLength"); EXPECT_NE(FuncInst, nullptr); EXPECT_TRUE(FuncInst->isHostFunction()); - auto &HostFuncSwsGetCoeffVecLength = dynamic_cast< - WasmEdge::Host::WasmEdgeFFmpeg::SWScale::SwsGetCoeffVecLength &>( - FuncInst->getHostFunc()); + auto &HostFuncSwsGetCoeffVecLength = FuncInst->getHostFunc(); int Length = 0; { @@ -423,9 +386,7 @@ TEST_F(FFmpegTest, SwsVector) { SWScaleMod->findFuncExports("wasmedge_ffmpeg_swscale_sws_getCoeff"); EXPECT_NE(FuncInst, nullptr); EXPECT_TRUE(FuncInst->isHostFunction()); - auto &HostFuncSwsGetCoeff = - dynamic_cast( - FuncInst->getHostFunc()); + auto &HostFuncSwsGetCoeff = FuncInst->getHostFunc(); fillMemContent(MemInst, CoeffPtr, Length); { @@ -440,9 +401,7 @@ TEST_F(FFmpegTest, SwsVector) { FuncInst = SWScaleMod->findFuncExports("wasmedge_ffmpeg_swscale_sws_freeVec"); EXPECT_NE(FuncInst, nullptr); EXPECT_TRUE(FuncInst->isHostFunction()); - auto &HostFuncSwsFreeVec = - dynamic_cast( - FuncInst->getHostFunc()); + auto &HostFuncSwsFreeVec = FuncInst->getHostFunc(); { uint32_t SwsVecId = readUInt32(MemInst, SwsVectorPtr); @@ -465,9 +424,7 @@ TEST_F(FFmpegTest, SWScaleVersion) { auto *FuncInst = SWScaleMod->findFuncExports("wasmedge_ffmpeg_swscale_swscale_version"); - auto &HostFuncSwscaleVersion = - dynamic_cast( - FuncInst->getHostFunc()); + auto &HostFuncSwscaleVersion = FuncInst->getHostFunc(); { HostFuncSwscaleVersion.run( @@ -478,9 +435,7 @@ TEST_F(FFmpegTest, SWScaleVersion) { FuncInst = SWScaleMod->findFuncExports( "wasmedge_ffmpeg_swscale_swscale_configuration_length"); - auto &HostFuncSwscaleConfigurationLength = dynamic_cast< - WasmEdge::Host::WasmEdgeFFmpeg::SWScale::SwscaleConfigurationLength &>( - FuncInst->getHostFunc()); + auto &HostFuncSwscaleConfigurationLength = FuncInst->getHostFunc(); { HostFuncSwscaleConfigurationLength.run( @@ -495,9 +450,7 @@ TEST_F(FFmpegTest, SWScaleVersion) { fillMemContent(MemInst, NamePtr, Length); FuncInst = SWScaleMod->findFuncExports( "wasmedge_ffmpeg_swscale_swscale_configuration"); - auto &HostFuncSwscaleConfiguration = dynamic_cast< - WasmEdge::Host::WasmEdgeFFmpeg::SWScale::SwscaleConfiguration &>( - FuncInst->getHostFunc()); + auto &HostFuncSwscaleConfiguration = FuncInst->getHostFunc(); { HostFuncSwscaleConfiguration.run( @@ -508,9 +461,7 @@ TEST_F(FFmpegTest, SWScaleVersion) { FuncInst = SWScaleMod->findFuncExports( "wasmedge_ffmpeg_swscale_swscale_license_length"); - auto &HostFuncSwscaleLicenseLength = dynamic_cast< - WasmEdge::Host::WasmEdgeFFmpeg::SWScale::SwscaleLicenseLength &>( - FuncInst->getHostFunc()); + auto &HostFuncSwscaleLicenseLength = FuncInst->getHostFunc(); { HostFuncSwscaleLicenseLength.run( @@ -524,9 +475,7 @@ TEST_F(FFmpegTest, SWScaleVersion) { fillMemContent(MemInst, NamePtr, Length); FuncInst = SWScaleMod->findFuncExports("wasmedge_ffmpeg_swscale_swscale_license"); - auto &HostFuncSwscaleLicense = - dynamic_cast( - FuncInst->getHostFunc()); + auto &HostFuncSwscaleLicense = FuncInst->getHostFunc(); { HostFuncSwscaleLicense.run( diff --git a/test/plugins/wasmedge_ffmpeg/utils.cpp b/test/plugins/wasmedge_ffmpeg/utils.cpp index 2656cbb3..e1a1909b 100644 --- a/test/plugins/wasmedge_ffmpeg/utils.cpp +++ b/test/plugins/wasmedge_ffmpeg/utils.cpp @@ -18,9 +18,7 @@ namespace WasmEdgeFFmpeg { void FFmpegTest::initEmptyFrame(uint32_t FramePtr) { auto *FuncInst = AVUtilMod->findFuncExports("wasmedge_ffmpeg_avutil_av_frame_alloc"); - auto &HostFuncAVFrameAlloc = - dynamic_cast( - FuncInst->getHostFunc()); + auto &HostFuncAVFrameAlloc = FuncInst->getHostFunc(); HostFuncAVFrameAlloc.run( CallFrame, std::initializer_list{FramePtr}, Result); } @@ -36,9 +34,7 @@ void FFmpegTest::initFFmpegStructs(uint32_t AVCodecPtr, uint32_t AVFormatCtxPtr, auto *FuncInst = AVFormatMod->findFuncExports( "wasmedge_ffmpeg_avformat_av_find_best_stream"); - auto &HostFuncAVFindBestStream = dynamic_cast< - WasmEdge::Host::WasmEdgeFFmpeg::AVFormat::AVFindBestStream &>( - FuncInst->getHostFunc()); + auto &HostFuncAVFindBestStream = FuncInst->getHostFunc(); uint32_t MediaTypeId = 0; // Video uint32_t WantedStream = -1; uint32_t RelatedStream = -1; @@ -55,9 +51,7 @@ void FFmpegTest::initFFmpegStructs(uint32_t AVCodecPtr, uint32_t AVFormatCtxPtr, FuncInst = AVFormatMod->findFuncExports( "wasmedge_ffmpeg_avformat_avStream_codecpar"); - auto &HostFuncAVStreamCodecpar = dynamic_cast< - WasmEdge::Host::WasmEdgeFFmpeg::AVFormat::AVStreamCodecPar &>( - FuncInst->getHostFunc()); + auto &HostFuncAVStreamCodecpar = FuncInst->getHostFunc(); HostFuncAVStreamCodecpar.run(CallFrame, std::initializer_list{ @@ -68,9 +62,7 @@ void FFmpegTest::initFFmpegStructs(uint32_t AVCodecPtr, uint32_t AVFormatCtxPtr, FuncInst = AVCodecMod->findFuncExports( "wasmedge_ffmpeg_avcodec_avcodec_alloc_context3"); - auto &HostFuncAVCodecAllocContext3 = dynamic_cast< - WasmEdge::Host::WasmEdgeFFmpeg::AVcodec::AVCodecAllocContext3 &>( - FuncInst->getHostFunc()); + auto &HostFuncAVCodecAllocContext3 = FuncInst->getHostFunc(); HostFuncAVCodecAllocContext3.run( CallFrame, std::initializer_list{0, AVCodecCtxPtr}, @@ -80,9 +72,7 @@ void FFmpegTest::initFFmpegStructs(uint32_t AVCodecPtr, uint32_t AVFormatCtxPtr, FuncInst = AVCodecMod->findFuncExports( "wasmedge_ffmpeg_avcodec_avcodec_parameters_to_context"); - auto &HostFuncAVCodecParametersToContext = dynamic_cast< - WasmEdge::Host::WasmEdgeFFmpeg::AVcodec::AVCodecParametersToContext &>( - FuncInst->getHostFunc()); + auto &HostFuncAVCodecParametersToContext = FuncInst->getHostFunc(); HostFuncAVCodecParametersToContext.run( CallFrame, @@ -92,9 +82,7 @@ void FFmpegTest::initFFmpegStructs(uint32_t AVCodecPtr, uint32_t AVFormatCtxPtr, FuncInst = AVCodecMod->findFuncExports( "wasmedge_ffmpeg_avcodec_avcodeccontext_codec_id"); - auto &HostFuncAVCodecContextCodecId = dynamic_cast< - WasmEdge::Host::WasmEdgeFFmpeg::AVcodec::AVCodecCtxCodecID &>( - FuncInst->getHostFunc()); + auto &HostFuncAVCodecContextCodecId = FuncInst->getHostFunc(); HostFuncAVCodecContextCodecId.run( CallFrame, std::initializer_list{AVCodecCtxId}, @@ -104,9 +92,7 @@ void FFmpegTest::initFFmpegStructs(uint32_t AVCodecPtr, uint32_t AVFormatCtxPtr, FuncInst = AVCodecMod->findFuncExports( "wasmedge_ffmpeg_avcodec_avcodec_find_decoder"); - auto &HostFuncAVCodecFindDecoder = dynamic_cast< - WasmEdge::Host::WasmEdgeFFmpeg::AVcodec::AVCodecFindDecoder &>( - FuncInst->getHostFunc()); + auto &HostFuncAVCodecFindDecoder = FuncInst->getHostFunc(); HostFuncAVCodecFindDecoder.run( CallFrame, @@ -116,9 +102,7 @@ void FFmpegTest::initFFmpegStructs(uint32_t AVCodecPtr, uint32_t AVFormatCtxPtr, FuncInst = AVCodecMod->findFuncExports("wasmedge_ffmpeg_avcodec_avcodec_open2"); - auto &HostFuncAVCodecOpen2 = - dynamic_cast( - FuncInst->getHostFunc()); + auto &HostFuncAVCodecOpen2 = FuncInst->getHostFunc(); HostFuncAVCodecOpen2.run( CallFrame, @@ -130,27 +114,19 @@ void FFmpegTest::initFFmpegStructs(uint32_t AVCodecPtr, uint32_t AVFormatCtxPtr, FuncInst = AVCodecMod->findFuncExports( "wasmedge_ffmpeg_avcodec_avcodec_receive_frame"); - auto &HostFuncAVCodecReceiveFrame = dynamic_cast< - WasmEdge::Host::WasmEdgeFFmpeg::AVcodec::AVCodecReceiveFrame &>( - FuncInst->getHostFunc()); + auto &HostFuncAVCodecReceiveFrame = FuncInst->getHostFunc(); FuncInst = AVFormatMod->findFuncExports("wasmedge_ffmpeg_avformat_av_read_frame"); - auto &HostFuncAVReadFrame = - dynamic_cast( - FuncInst->getHostFunc()); + auto &HostFuncAVReadFrame = FuncInst->getHostFunc(); FuncInst = AVCodecMod->findFuncExports( "wasmedge_ffmpeg_avcodec_avcodec_send_packet"); - auto &HostFuncAVCodecSendPacket = dynamic_cast< - WasmEdge::Host::WasmEdgeFFmpeg::AVcodec::AVCodecSendPacket &>( - FuncInst->getHostFunc()); + auto &HostFuncAVCodecSendPacket = FuncInst->getHostFunc(); FuncInst = AVCodecMod->findFuncExports( "wasmedge_ffmpeg_avcodec_av_packet_stream_index"); - auto &HostFuncAVPacketStreamIndex = dynamic_cast< - WasmEdge::Host::WasmEdgeFFmpeg::AVcodec::AVPacketStreamIndex &>( - FuncInst->getHostFunc()); + auto &HostFuncAVPacketStreamIndex = FuncInst->getHostFunc(); while (true) { HostFuncAVCodecReceiveFrame.run( @@ -210,9 +186,7 @@ void FFmpegTest::initFormatCtx(uint32_t AVFormatCtxPtr, uint32_t FilePtr, auto *FuncInst = AVFormatMod->findFuncExports( "wasmedge_ffmpeg_avformat_avformat_open_input"); - auto &HostFuncAVFormatOpenInput = dynamic_cast< - WasmEdge::Host::WasmEdgeFFmpeg::AVFormat::AVFormatOpenInput &>( - FuncInst->getHostFunc()); + auto &HostFuncAVFormatOpenInput = FuncInst->getHostFunc(); HostFuncAVFormatOpenInput.run( CallFrame, std::initializer_list{ @@ -230,9 +204,7 @@ void FFmpegTest::initDict(uint32_t DictPtr, uint32_t KeyPtr, std::string Key, auto *FuncInst = AVUtilMod->findFuncExports("wasmedge_ffmpeg_avutil_av_dict_set"); - auto &HostFuncAVDictSet = - dynamic_cast( - FuncInst->getHostFunc()); + auto &HostFuncAVDictSet = FuncInst->getHostFunc(); HostFuncAVDictSet.run(CallFrame, std::initializer_list{ @@ -243,9 +215,7 @@ void FFmpegTest::initDict(uint32_t DictPtr, uint32_t KeyPtr, std::string Key, void FFmpegTest::allocPacket(uint32_t PacketPtr) { auto *FuncInst = AVCodecMod->findFuncExports("wasmedge_ffmpeg_avcodec_av_packet_alloc"); - auto &HostFuncAVPacketAlloc = - dynamic_cast( - FuncInst->getHostFunc()); + auto &HostFuncAVPacketAlloc = FuncInst->getHostFunc(); HostFuncAVPacketAlloc.run( CallFrame, std::initializer_list{PacketPtr}, From 59da64f51d7507bc6f81c49b560a700c9a547b73 Mon Sep 17 00:00:00 2001 From: hydai Date: Wed, 17 Jun 2026 23:38:24 +0800 Subject: [PATCH 09/17] fix(test/plugins/wasm_bpf): remove concrete types to fix devirtualization Assisted-by: Claude (Anthropic) Signed-off-by: hydai --- test/plugins/wasm_bpf/simple_map_test.cpp | 15 ++++------ test/plugins/wasm_bpf/simple_ringbuf_test.cpp | 15 ++++------ test/plugins/wasm_bpf/wasm_bpf.cpp | 30 +++++++------------ 3 files changed, 20 insertions(+), 40 deletions(-) diff --git a/test/plugins/wasm_bpf/simple_map_test.cpp b/test/plugins/wasm_bpf/simple_map_test.cpp index f8b84e4e..641b9a25 100644 --- a/test/plugins/wasm_bpf/simple_map_test.cpp +++ b/test/plugins/wasm_bpf/simple_map_test.cpp @@ -113,8 +113,7 @@ TEST(WasmBpfTest, SimpleMapTest) { auto *loadFunc = module->findFuncExports("wasm_load_bpf_object"); ASSERT_NE(loadFunc, nullptr); ASSERT_TRUE(loadFunc->isHostFunction()); - auto &loadFuncHost = - dynamic_cast(loadFunc->getHostFunc()); + auto &loadFuncHost = loadFunc->getHostFunc(); // call "wasm_load_bpf_object" to Load `bootstrap.bpf.o`, and check the // result @@ -132,8 +131,7 @@ TEST(WasmBpfTest, SimpleMapTest) { auto *attachFunc = module->findFuncExports("wasm_attach_bpf_program"); ASSERT_NE(attachFunc, nullptr); ASSERT_TRUE(attachFunc->isHostFunction()); - auto &attachFuncHost = dynamic_cast( - attachFunc->getHostFunc()); + auto &attachFuncHost = attachFunc->getHostFunc(); // Call "wasm_attach_bpf_program" to attach, and check the result std::array attachResult; @@ -151,8 +149,7 @@ TEST(WasmBpfTest, SimpleMapTest) { auto *mapFdFunc = module->findFuncExports("wasm_bpf_map_fd_by_name"); ASSERT_NE(mapFdFunc, nullptr); ASSERT_TRUE(mapFdFunc->isHostFunction()); - auto &mapFdFuncHost = - dynamic_cast(mapFdFunc->getHostFunc()); + auto &mapFdFuncHost = mapFdFunc->getHostFunc(); // Call "wasm_bpf_map_fd_by_name" to get the map fd, and check the result std::array mapFdResult; @@ -168,8 +165,7 @@ TEST(WasmBpfTest, SimpleMapTest) { auto *mapOptFunc = module->findFuncExports("wasm_bpf_map_operate"); EXPECT_NE(mapOptFunc, nullptr); EXPECT_TRUE(mapOptFunc->isHostFunction()); - auto &mapOptFuncHost = - dynamic_cast(mapOptFunc->getHostFunc()); + auto &mapOptFuncHost = mapOptFunc->getHostFunc(); // A wrapper to call wasm_bpf_map_operate auto callMapOperate = [&](int32_t fd, int32_t cmd, uint32_t key, @@ -278,8 +274,7 @@ TEST(WasmBpfTest, SimpleMapTest) { auto *closeFunc = module->findFuncExports("wasm_close_bpf_object"); ASSERT_NE(closeFunc, nullptr); ASSERT_TRUE(closeFunc->isHostFunction()); - auto &closeFuncHost = - dynamic_cast(closeFunc->getHostFunc()); + auto &closeFuncHost = closeFunc->getHostFunc(); // Call "wasm_close_bpf_object" to attach, and check the result std::array closeResult; diff --git a/test/plugins/wasm_bpf/simple_ringbuf_test.cpp b/test/plugins/wasm_bpf/simple_ringbuf_test.cpp index e2fbf94c..65f90ed8 100644 --- a/test/plugins/wasm_bpf/simple_ringbuf_test.cpp +++ b/test/plugins/wasm_bpf/simple_ringbuf_test.cpp @@ -133,8 +133,7 @@ TEST(WasmBpfTest, SimpleRingbuf) { auto *loadFunc = module->findFuncExports("wasm_load_bpf_object"); ASSERT_NE(loadFunc, nullptr); ASSERT_TRUE(loadFunc->isHostFunction()); - auto &loadFuncHost = - dynamic_cast(loadFunc->getHostFunc()); + auto &loadFuncHost = loadFunc->getHostFunc(); // call "wasm_load_bpf_object" to Load `bootstrap.bpf.o`, and check the // result @@ -152,8 +151,7 @@ TEST(WasmBpfTest, SimpleRingbuf) { auto *attachFunc = module->findFuncExports("wasm_attach_bpf_program"); ASSERT_NE(attachFunc, nullptr); ASSERT_TRUE(attachFunc->isHostFunction()); - auto &attachFuncHost = dynamic_cast( - attachFunc->getHostFunc()); + auto &attachFuncHost = attachFunc->getHostFunc(); // Call "wasm_attach_bpf_program" to attach, and check the result std::array attachResult; @@ -171,8 +169,7 @@ TEST(WasmBpfTest, SimpleRingbuf) { auto *mapFdFunc = module->findFuncExports("wasm_bpf_map_fd_by_name"); ASSERT_NE(mapFdFunc, nullptr); ASSERT_TRUE(mapFdFunc->isHostFunction()); - auto &mapFdFuncHost = - dynamic_cast(mapFdFunc->getHostFunc()); + auto &mapFdFuncHost = mapFdFunc->getHostFunc(); // Call "wasm_bpf_map_fd_by_name" to get the map fd, and check the result std::array mapFdResult; @@ -205,8 +202,7 @@ TEST(WasmBpfTest, SimpleRingbuf) { auto *bufferPollFunc = module->findFuncExports("wasm_bpf_buffer_poll"); ASSERT_NE(bufferPollFunc, nullptr); ASSERT_TRUE(bufferPollFunc->isHostFunction()); - auto &bufferPollFuncHost = dynamic_cast( - bufferPollFunc->getHostFunc()); + auto &bufferPollFuncHost = bufferPollFunc->getHostFunc(); // Call the polling function std::array pollResult; @@ -231,8 +227,7 @@ TEST(WasmBpfTest, SimpleRingbuf) { auto *closeFunc = module->findFuncExports("wasm_close_bpf_object"); ASSERT_NE(closeFunc, nullptr); ASSERT_TRUE(closeFunc->isHostFunction()); - auto &closeFuncHost = - dynamic_cast(closeFunc->getHostFunc()); + auto &closeFuncHost = closeFunc->getHostFunc(); // Call "wasm_close_bpf_object" to attach, and check the result std::array closeResult; diff --git a/test/plugins/wasm_bpf/wasm_bpf.cpp b/test/plugins/wasm_bpf/wasm_bpf.cpp index c71b8e6d..771241e3 100644 --- a/test/plugins/wasm_bpf/wasm_bpf.cpp +++ b/test/plugins/wasm_bpf/wasm_bpf.cpp @@ -214,8 +214,7 @@ TEST(WasmBpfTest, RunBpfProgramWithPolling) { auto *loadFunc = module->findFuncExports("wasm_load_bpf_object"); EXPECT_NE(loadFunc, nullptr); EXPECT_TRUE(loadFunc->isHostFunction()); - auto &loadFuncHost = - dynamic_cast(loadFunc->getHostFunc()); + auto &loadFuncHost = loadFunc->getHostFunc(); // call "wasm_load_bpf_object" to Load `bootstrap.bpf.o`, and check the // result @@ -233,8 +232,7 @@ TEST(WasmBpfTest, RunBpfProgramWithPolling) { auto *attachFunc = module->findFuncExports("wasm_attach_bpf_program"); EXPECT_NE(attachFunc, nullptr); EXPECT_TRUE(attachFunc->isHostFunction()); - auto &attachFuncHost = dynamic_cast( - attachFunc->getHostFunc()); + auto &attachFuncHost = attachFunc->getHostFunc(); // Call "wasm_attach_bpf_program" to attach, and check the result std::array attachResult; @@ -267,8 +265,7 @@ TEST(WasmBpfTest, RunBpfProgramWithPolling) { auto *mapFdFunc = module->findFuncExports("wasm_bpf_map_fd_by_name"); EXPECT_NE(mapFdFunc, nullptr); EXPECT_TRUE(mapFdFunc->isHostFunction()); - auto &mapFdFuncHost = - dynamic_cast(mapFdFunc->getHostFunc()); + auto &mapFdFuncHost = mapFdFunc->getHostFunc(); // Call "wasm_bpf_map_fd_by_name" to get the map fd, and check the result std::array mapFdResult; @@ -301,8 +298,7 @@ TEST(WasmBpfTest, RunBpfProgramWithPolling) { auto *bufferPollFunc = module->findFuncExports("wasm_bpf_buffer_poll"); EXPECT_NE(bufferPollFunc, nullptr); EXPECT_TRUE(bufferPollFunc->isHostFunction()); - auto &bufferPollFuncHost = dynamic_cast( - bufferPollFunc->getHostFunc()); + auto &bufferPollFuncHost = bufferPollFunc->getHostFunc(); // Call the polling function std::array pollResult; @@ -327,8 +323,7 @@ TEST(WasmBpfTest, RunBpfProgramWithPolling) { auto *closeFunc = module->findFuncExports("wasm_close_bpf_object"); EXPECT_NE(closeFunc, nullptr); EXPECT_TRUE(closeFunc->isHostFunction()); - auto &closeFuncHost = - dynamic_cast(closeFunc->getHostFunc()); + auto &closeFuncHost = closeFunc->getHostFunc(); // Call "wasm_close_bpf_object" to attach, and check the result std::array closeResult; @@ -407,8 +402,7 @@ TEST(WasmBpfTest, RunBpfProgramWithMapOperation) { auto *loadFunc = module->findFuncExports("wasm_load_bpf_object"); EXPECT_NE(loadFunc, nullptr); EXPECT_TRUE(loadFunc->isHostFunction()); - auto &loadFuncHost = - dynamic_cast(loadFunc->getHostFunc()); + auto &loadFuncHost = loadFunc->getHostFunc(); // call "wasm_load_bpf_object" to Load `bootstrap.bpf.o`, and check the // result @@ -426,8 +420,7 @@ TEST(WasmBpfTest, RunBpfProgramWithMapOperation) { auto *attachFunc = module->findFuncExports("wasm_attach_bpf_program"); EXPECT_NE(attachFunc, nullptr); EXPECT_TRUE(attachFunc->isHostFunction()); - auto &attachFuncHost = dynamic_cast( - attachFunc->getHostFunc()); + auto &attachFuncHost = attachFunc->getHostFunc(); std::array programNameIndexes = {1, 2, 3}; // Attach the programs @@ -449,8 +442,7 @@ TEST(WasmBpfTest, RunBpfProgramWithMapOperation) { auto *mapFdFunc = module->findFuncExports("wasm_bpf_map_fd_by_name"); EXPECT_NE(mapFdFunc, nullptr); EXPECT_TRUE(mapFdFunc->isHostFunction()); - auto &mapFdFuncHost = - dynamic_cast(mapFdFunc->getHostFunc()); + auto &mapFdFuncHost = mapFdFunc->getHostFunc(); // Call "wasm_bpf_map_fd_by_name" to get the map fd, and check the result std::array mapFdResult; @@ -466,8 +458,7 @@ TEST(WasmBpfTest, RunBpfProgramWithMapOperation) { auto *mapOptFunc = module->findFuncExports("wasm_bpf_map_operate"); EXPECT_NE(mapOptFunc, nullptr); EXPECT_TRUE(mapOptFunc->isHostFunction()); - auto &mapOptFuncHost = - dynamic_cast(mapOptFunc->getHostFunc()); + auto &mapOptFuncHost = mapOptFunc->getHostFunc(); // A wrapper to call wasm_bpf_map_operate auto callMapOperate = [&](int32_t fd, int32_t cmd, uint32_t key, uint32_t value, uint32_t nextKey, @@ -562,8 +553,7 @@ TEST(WasmBpfTest, RunBpfProgramWithMapOperation) { auto *closeFunc = module->findFuncExports("wasm_close_bpf_object"); EXPECT_NE(closeFunc, nullptr); EXPECT_TRUE(closeFunc->isHostFunction()); - auto &closeFuncHost = - dynamic_cast(closeFunc->getHostFunc()); + auto &closeFuncHost = closeFunc->getHostFunc(); // Call "wasm_close_bpf_object" to attach, and check the result std::array closeResult; From 034adc09d06c55af52e7d2dfb1fd41d2031e453d Mon Sep 17 00:00:00 2001 From: hydai Date: Wed, 17 Jun 2026 23:38:25 +0800 Subject: [PATCH 10/17] fix(test/plugins/wasmedge_process): remove concrete types to fix devirtualization Assisted-by: Claude (Anthropic) Signed-off-by: hydai --- .../wasmedge_process/wasmedge_process.cpp | 49 ++++++------------- 1 file changed, 14 insertions(+), 35 deletions(-) diff --git a/test/plugins/wasmedge_process/wasmedge_process.cpp b/test/plugins/wasmedge_process/wasmedge_process.cpp index ea80f906..0503749b 100644 --- a/test/plugins/wasmedge_process/wasmedge_process.cpp +++ b/test/plugins/wasmedge_process/wasmedge_process.cpp @@ -84,9 +84,7 @@ TEST(WasmEdgeProcessTest, SetProgName) { auto *FuncInst = ProcMod->findFuncExports("wasmedge_process_set_prog_name"); EXPECT_NE(FuncInst, nullptr); EXPECT_TRUE(FuncInst->isHostFunction()); - auto &HostFuncInst = - dynamic_cast( - FuncInst->getHostFunc()); + auto &HostFuncInst = FuncInst->getHostFunc(); // Test: Run function successfully. EXPECT_TRUE(HostFuncInst.run( @@ -130,8 +128,7 @@ TEST(WasmEdgeProcessTest, AddArg) { auto *FuncInst = ProcMod->findFuncExports("wasmedge_process_add_arg"); EXPECT_NE(FuncInst, nullptr); EXPECT_TRUE(FuncInst->isHostFunction()); - auto &HostFuncInst = dynamic_cast( - FuncInst->getHostFunc()); + auto &HostFuncInst = FuncInst->getHostFunc(); // Test: Run function successfully to add "arg1". EXPECT_TRUE(HostFuncInst.run( @@ -194,8 +191,7 @@ TEST(WasmEdgeProcessTest, AddEnv) { auto *FuncInst = ProcMod->findFuncExports("wasmedge_process_add_env"); EXPECT_NE(FuncInst, nullptr); EXPECT_TRUE(FuncInst->isHostFunction()); - auto &HostFuncInst = dynamic_cast( - FuncInst->getHostFunc()); + auto &HostFuncInst = FuncInst->getHostFunc(); // Test: Run function successfully to add "ENV1", "VALUE1". EXPECT_TRUE( @@ -249,8 +245,7 @@ TEST(WasmEdgeProcessTest, AddStdIn) { auto *FuncInst = ProcMod->findFuncExports("wasmedge_process_add_stdin"); EXPECT_NE(FuncInst, nullptr); EXPECT_TRUE(FuncInst->isHostFunction()); - auto &HostFuncInst = dynamic_cast( - FuncInst->getHostFunc()); + auto &HostFuncInst = FuncInst->getHostFunc(); // Test: Run function successfully to add "\01\02\03\04". EXPECT_TRUE(HostFuncInst.run( @@ -288,9 +283,7 @@ TEST(WasmEdgeProcessTest, SetTimeOut) { auto *FuncInst = ProcMod->findFuncExports("wasmedge_process_set_timeout"); EXPECT_NE(FuncInst, nullptr); EXPECT_TRUE(FuncInst->isHostFunction()); - auto &HostFuncInst = - dynamic_cast( - FuncInst->getHostFunc()); + auto &HostFuncInst = FuncInst->getHostFunc(); // Test: Run function successfully to set timeout 100. EXPECT_TRUE(HostFuncInst.run( @@ -325,8 +318,7 @@ TEST(WasmEdgeProcessTest, Run) { auto *FuncInst = ProcMod->findFuncExports("wasmedge_process_run"); EXPECT_NE(FuncInst, nullptr); EXPECT_TRUE(FuncInst->isHostFunction()); - auto &HostFuncInst = dynamic_cast( - FuncInst->getHostFunc()); + auto &HostFuncInst = FuncInst->getHostFunc(); // Return value. std::array RetVal; @@ -387,8 +379,7 @@ TEST(WasmEdgeProcessTest, TimeoutPrecision) { auto *FuncInst = ProcMod->findFuncExports("wasmedge_process_run"); EXPECT_NE(FuncInst, nullptr); EXPECT_TRUE(FuncInst->isHostFunction()); - auto &HostFuncRun = dynamic_cast( - FuncInst->getHostFunc()); + auto &HostFuncRun = FuncInst->getHostFunc(); // Return value. std::array RetVal; @@ -430,9 +421,7 @@ TEST(WasmEdgeProcessTest, GetExitCode) { auto *FuncInst = ProcMod->findFuncExports("wasmedge_process_get_exit_code"); EXPECT_NE(FuncInst, nullptr); EXPECT_TRUE(FuncInst->isHostFunction()); - auto &HostFuncInst = - dynamic_cast( - FuncInst->getHostFunc()); + auto &HostFuncInst = FuncInst->getHostFunc(); // Test: Run function successfully to get exit code. std::array RetVal; @@ -462,22 +451,17 @@ TEST(WasmEdgeProcessTest, GetStdOut) { auto *FuncInst = ProcMod->findFuncExports("wasmedge_process_run"); EXPECT_NE(FuncInst, nullptr); EXPECT_TRUE(FuncInst->isHostFunction()); - auto &HostFuncRun = dynamic_cast( - FuncInst->getHostFunc()); + auto &HostFuncRun = FuncInst->getHostFunc(); // Get the function "wasmedge_process_run". FuncInst = ProcMod->findFuncExports("wasmedge_process_get_stdout_len"); EXPECT_NE(FuncInst, nullptr); EXPECT_TRUE(FuncInst->isHostFunction()); - auto &HostFuncGetStdOutLen = - dynamic_cast( - FuncInst->getHostFunc()); + auto &HostFuncGetStdOutLen = FuncInst->getHostFunc(); // Get the function "wasmedge_process_run". FuncInst = ProcMod->findFuncExports("wasmedge_process_get_stdout"); EXPECT_NE(FuncInst, nullptr); EXPECT_TRUE(FuncInst->isHostFunction()); - auto &HostFuncGetStdOut = - dynamic_cast( - FuncInst->getHostFunc()); + auto &HostFuncGetStdOut = FuncInst->getHostFunc(); // Return value. std::array RetVal; @@ -529,22 +513,17 @@ TEST(WasmEdgeProcessTest, GetStdErr) { auto *FuncInst = ProcMod->findFuncExports("wasmedge_process_run"); EXPECT_NE(FuncInst, nullptr); EXPECT_TRUE(FuncInst->isHostFunction()); - auto &HostFuncRun = dynamic_cast( - FuncInst->getHostFunc()); + auto &HostFuncRun = FuncInst->getHostFunc(); // Get the function "wasmedge_process_run". FuncInst = ProcMod->findFuncExports("wasmedge_process_get_stderr_len"); EXPECT_NE(FuncInst, nullptr); EXPECT_TRUE(FuncInst->isHostFunction()); - auto &HostFuncGetStdErrLen = - dynamic_cast( - FuncInst->getHostFunc()); + auto &HostFuncGetStdErrLen = FuncInst->getHostFunc(); // Get the function "wasmedge_process_run". FuncInst = ProcMod->findFuncExports("wasmedge_process_get_stderr"); EXPECT_NE(FuncInst, nullptr); EXPECT_TRUE(FuncInst->isHostFunction()); - auto &HostFuncGetStdErr = - dynamic_cast( - FuncInst->getHostFunc()); + auto &HostFuncGetStdErr = FuncInst->getHostFunc(); // Return value. std::array RetVal; From 84da82d06ab75eb3f6b767f85f806d8d86f9159c Mon Sep 17 00:00:00 2001 From: hydai Date: Wed, 17 Jun 2026 23:38:25 +0800 Subject: [PATCH 11/17] fix(test/plugins/wasmedge_stablediffusion): remove concrete types to fix devirtualization Assisted-by: Claude (Anthropic) Signed-off-by: hydai --- .../wasmedge_stablediffusion.cpp | 16 ++++------------ 1 file changed, 4 insertions(+), 12 deletions(-) diff --git a/test/plugins/wasmedge_stablediffusion/wasmedge_stablediffusion.cpp b/test/plugins/wasmedge_stablediffusion/wasmedge_stablediffusion.cpp index e6817916..f444c7ab 100644 --- a/test/plugins/wasmedge_stablediffusion/wasmedge_stablediffusion.cpp +++ b/test/plugins/wasmedge_stablediffusion/wasmedge_stablediffusion.cpp @@ -89,30 +89,22 @@ TEST(WasmEdgeStableDiffusionTest, ModuleFunctions) { auto *FuncInst = SBMod->findFuncExports("convert"); EXPECT_NE(FuncInst, nullptr); EXPECT_TRUE(FuncInst->isHostFunction()); - auto &HostFuncConvert = - dynamic_cast( - FuncInst->getHostFunc()); + auto &HostFuncConvert = FuncInst->getHostFunc(); // Get the function "create_context". FuncInst = SBMod->findFuncExports("create_context"); EXPECT_NE(FuncInst, nullptr); EXPECT_TRUE(FuncInst->isHostFunction()); - auto &HostFuncCreateContext = - dynamic_cast( - FuncInst->getHostFunc()); + auto &HostFuncCreateContext = FuncInst->getHostFunc(); // Get the function "text_to_image". FuncInst = SBMod->findFuncExports("text_to_image"); EXPECT_NE(FuncInst, nullptr); EXPECT_TRUE(FuncInst->isHostFunction()); - auto &HostFuncTextToImage = - dynamic_cast( - FuncInst->getHostFunc()); + auto &HostFuncTextToImage = FuncInst->getHostFunc(); // Get the function "image_to_image". FuncInst = SBMod->findFuncExports("image_to_image"); EXPECT_NE(FuncInst, nullptr); EXPECT_TRUE(FuncInst->isHostFunction()); - auto &HostFuncImageToImage = - dynamic_cast( - FuncInst->getHostFunc()); + auto &HostFuncImageToImage = FuncInst->getHostFunc(); std::string Prompt = "a lovely cat"; std::string Prompt2 = "with blue eyes"; From df6a8d91e45f0822b3cad9e435d2f82e61e2214c Mon Sep 17 00:00:00 2001 From: hydai Date: Wed, 17 Jun 2026 23:38:25 +0800 Subject: [PATCH 12/17] fix(test/plugins/wasi_logging): remove concrete types to fix devirtualization Assisted-by: Claude (Anthropic) Signed-off-by: hydai --- test/plugins/wasi_logging/wasi_logging.cpp | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/test/plugins/wasi_logging/wasi_logging.cpp b/test/plugins/wasi_logging/wasi_logging.cpp index 5a1ce3e1..91519f19 100644 --- a/test/plugins/wasi_logging/wasi_logging.cpp +++ b/test/plugins/wasi_logging/wasi_logging.cpp @@ -87,10 +87,8 @@ TEST(WasiLoggingTests, func_log) { EXPECT_NE(FuncInst2, nullptr); EXPECT_TRUE(FuncInst1->isHostFunction()); EXPECT_TRUE(FuncInst2->isHostFunction()); - auto &HostFuncInst1 = dynamic_cast( - FuncInst1->getHostFunc()); - auto &HostFuncInst2 = dynamic_cast( - FuncInst2->getHostFunc()); + auto &HostFuncInst1 = FuncInst1->getHostFunc(); + auto &HostFuncInst2 = FuncInst2->getHostFunc(); // Show All Level EXPECT_TRUE(HostFuncInst1.run( @@ -205,8 +203,7 @@ TEST(WasiLoggingTests, func_log_oob) { auto *FuncInst = WasiLoggingMod->findFuncExports("log"); ASSERT_NE(FuncInst, nullptr); ASSERT_TRUE(FuncInst->isHostFunction()); - auto &HostFuncInst = - dynamic_cast(FuncInst->getHostFunc()); + auto &HostFuncInst = FuncInst->getHostFunc(); // OOB context: CxtPtr=65535, CxtLen=100 extends 99 bytes past the page end. // Expected: HostFuncError (not a crash). From df3bfd95954bcf8aa0dffcd276beaf45fb3c172e Mon Sep 17 00:00:00 2001 From: hydai Date: Thu, 18 Jun 2026 02:39:42 +0800 Subject: [PATCH 13/17] test(plugins): use ASSERT for host-function guards before getHostFunc() The previous EXPECT_* checks will allow a dereference on calling getHostFunc(), which may lead segfaults instead of a failing cleanly. Call sites with no guard at all are hardened the same way, inserting the ASSERT_NE/ASSERT_TRUE pair before getHostFunc() across the FFmpeg test files the earlier pass missed. Assisted-by: Claude (Anthropic) Signed-off-by: hydai --- test/plugins/wasi_logging/wasi_logging.cpp | 8 +- test/plugins/wasm_bpf/simple_map_test.cpp | 4 +- test/plugins/wasm_bpf/wasm_bpf.cpp | 40 +- .../wasmedge_ffmpeg/avcodec/avCodec.cpp | 76 ++-- .../wasmedge_ffmpeg/avcodec/avCodecCtx.cpp | 364 +++++++++--------- .../avcodec/avCodecParameters.cpp | 12 +- .../wasmedge_ffmpeg/avcodec/avPacket.cpp | 84 ++-- .../wasmedge_ffmpeg/avcodec/avcodec_func.cpp | 108 +++--- .../wasmedge_ffmpeg/avfilter/avfilter.cpp | 56 +-- .../avfilter/avfilter_func.cpp | 108 +++--- .../wasmedge_ffmpeg/avformat/avChapter.cpp | 36 +- .../avformat/avInputOutputContext.cpp | 40 +- .../wasmedge_ffmpeg/avformat/avStream.cpp | 64 +-- .../avformat/avformatContext.cpp | 40 +- .../avformat/avformat_func.cpp | 100 ++--- .../wasmedge_ffmpeg/avutil/avDictionary.cpp | 20 +- .../wasmedge_ffmpeg/avutil/avError.cpp | 6 + .../wasmedge_ffmpeg/avutil/avFrame.cpp | 96 +++++ .../wasmedge_ffmpeg/avutil/avPixfmt.cpp | 28 ++ .../wasmedge_ffmpeg/avutil/avRational.cpp | 44 +-- .../wasmedge_ffmpeg/avutil/avSampleFmt.cpp | 22 ++ .../wasmedge_ffmpeg/avutil/avutil_func.cpp | 34 ++ .../swresample/swresample_func.cpp | 44 +-- .../wasmedge_ffmpeg/swscale/swscale_func.cpp | 90 +++-- test/plugins/wasmedge_ffmpeg/utils.cpp | 31 +- .../wasmedge_process/wasmedge_process.cpp | 56 +-- .../wasmedge_stablediffusion.cpp | 16 +- 27 files changed, 926 insertions(+), 701 deletions(-) diff --git a/test/plugins/wasi_logging/wasi_logging.cpp b/test/plugins/wasi_logging/wasi_logging.cpp index 91519f19..ece53b93 100644 --- a/test/plugins/wasi_logging/wasi_logging.cpp +++ b/test/plugins/wasi_logging/wasi_logging.cpp @@ -83,10 +83,10 @@ TEST(WasiLoggingTests, func_log) { // Get the function "log". auto *FuncInst1 = WasiLoggingMod1->findFuncExports("log"); auto *FuncInst2 = WasiLoggingMod2->findFuncExports("log"); - EXPECT_NE(FuncInst1, nullptr); - EXPECT_NE(FuncInst2, nullptr); - EXPECT_TRUE(FuncInst1->isHostFunction()); - EXPECT_TRUE(FuncInst2->isHostFunction()); + ASSERT_NE(FuncInst1, nullptr); + ASSERT_NE(FuncInst2, nullptr); + ASSERT_TRUE(FuncInst1->isHostFunction()); + ASSERT_TRUE(FuncInst2->isHostFunction()); auto &HostFuncInst1 = FuncInst1->getHostFunc(); auto &HostFuncInst2 = FuncInst2->getHostFunc(); diff --git a/test/plugins/wasm_bpf/simple_map_test.cpp b/test/plugins/wasm_bpf/simple_map_test.cpp index 641b9a25..db128139 100644 --- a/test/plugins/wasm_bpf/simple_map_test.cpp +++ b/test/plugins/wasm_bpf/simple_map_test.cpp @@ -163,8 +163,8 @@ TEST(WasmBpfTest, SimpleMapTest) { // Get function `wasm_bpf_map_fd_by_name` auto *mapOptFunc = module->findFuncExports("wasm_bpf_map_operate"); - EXPECT_NE(mapOptFunc, nullptr); - EXPECT_TRUE(mapOptFunc->isHostFunction()); + ASSERT_NE(mapOptFunc, nullptr); + ASSERT_TRUE(mapOptFunc->isHostFunction()); auto &mapOptFuncHost = mapOptFunc->getHostFunc(); // A wrapper to call wasm_bpf_map_operate diff --git a/test/plugins/wasm_bpf/wasm_bpf.cpp b/test/plugins/wasm_bpf/wasm_bpf.cpp index 771241e3..d8d25c59 100644 --- a/test/plugins/wasm_bpf/wasm_bpf.cpp +++ b/test/plugins/wasm_bpf/wasm_bpf.cpp @@ -212,8 +212,8 @@ TEST(WasmBpfTest, RunBpfProgramWithPolling) { // Get function "wasm_load_bpf_object" auto *loadFunc = module->findFuncExports("wasm_load_bpf_object"); - EXPECT_NE(loadFunc, nullptr); - EXPECT_TRUE(loadFunc->isHostFunction()); + ASSERT_NE(loadFunc, nullptr); + ASSERT_TRUE(loadFunc->isHostFunction()); auto &loadFuncHost = loadFunc->getHostFunc(); // call "wasm_load_bpf_object" to Load `bootstrap.bpf.o`, and check the @@ -230,8 +230,8 @@ TEST(WasmBpfTest, RunBpfProgramWithPolling) { // Get function `wasm_attach_bpf_program` auto *attachFunc = module->findFuncExports("wasm_attach_bpf_program"); - EXPECT_NE(attachFunc, nullptr); - EXPECT_TRUE(attachFunc->isHostFunction()); + ASSERT_NE(attachFunc, nullptr); + ASSERT_TRUE(attachFunc->isHostFunction()); auto &attachFuncHost = attachFunc->getHostFunc(); // Call "wasm_attach_bpf_program" to attach, and check the result @@ -263,8 +263,8 @@ TEST(WasmBpfTest, RunBpfProgramWithPolling) { // Get function `wasm_bpf_map_fd_by_name` auto *mapFdFunc = module->findFuncExports("wasm_bpf_map_fd_by_name"); - EXPECT_NE(mapFdFunc, nullptr); - EXPECT_TRUE(mapFdFunc->isHostFunction()); + ASSERT_NE(mapFdFunc, nullptr); + ASSERT_TRUE(mapFdFunc->isHostFunction()); auto &mapFdFuncHost = mapFdFunc->getHostFunc(); // Call "wasm_bpf_map_fd_by_name" to get the map fd, and check the result @@ -296,8 +296,8 @@ TEST(WasmBpfTest, RunBpfProgramWithPolling) { // Get the "wasm_bpf_buffer_poll" function auto *bufferPollFunc = module->findFuncExports("wasm_bpf_buffer_poll"); - EXPECT_NE(bufferPollFunc, nullptr); - EXPECT_TRUE(bufferPollFunc->isHostFunction()); + ASSERT_NE(bufferPollFunc, nullptr); + ASSERT_TRUE(bufferPollFunc->isHostFunction()); auto &bufferPollFuncHost = bufferPollFunc->getHostFunc(); // Call the polling function @@ -321,8 +321,8 @@ TEST(WasmBpfTest, RunBpfProgramWithPolling) { // Get function `wasm_close_bpf_object` auto *closeFunc = module->findFuncExports("wasm_close_bpf_object"); - EXPECT_NE(closeFunc, nullptr); - EXPECT_TRUE(closeFunc->isHostFunction()); + ASSERT_NE(closeFunc, nullptr); + ASSERT_TRUE(closeFunc->isHostFunction()); auto &closeFuncHost = closeFunc->getHostFunc(); // Call "wasm_close_bpf_object" to attach, and check the result @@ -400,8 +400,8 @@ TEST(WasmBpfTest, RunBpfProgramWithMapOperation) { // Get function "wasm_load_bpf_object" auto *loadFunc = module->findFuncExports("wasm_load_bpf_object"); - EXPECT_NE(loadFunc, nullptr); - EXPECT_TRUE(loadFunc->isHostFunction()); + ASSERT_NE(loadFunc, nullptr); + ASSERT_TRUE(loadFunc->isHostFunction()); auto &loadFuncHost = loadFunc->getHostFunc(); // call "wasm_load_bpf_object" to Load `bootstrap.bpf.o`, and check the @@ -418,8 +418,8 @@ TEST(WasmBpfTest, RunBpfProgramWithMapOperation) { // Get function `wasm_attach_bpf_program` auto *attachFunc = module->findFuncExports("wasm_attach_bpf_program"); - EXPECT_NE(attachFunc, nullptr); - EXPECT_TRUE(attachFunc->isHostFunction()); + ASSERT_NE(attachFunc, nullptr); + ASSERT_TRUE(attachFunc->isHostFunction()); auto &attachFuncHost = attachFunc->getHostFunc(); std::array programNameIndexes = {1, 2, 3}; @@ -440,8 +440,8 @@ TEST(WasmBpfTest, RunBpfProgramWithMapOperation) { // Get function `wasm_bpf_map_fd_by_name` auto *mapFdFunc = module->findFuncExports("wasm_bpf_map_fd_by_name"); - EXPECT_NE(mapFdFunc, nullptr); - EXPECT_TRUE(mapFdFunc->isHostFunction()); + ASSERT_NE(mapFdFunc, nullptr); + ASSERT_TRUE(mapFdFunc->isHostFunction()); auto &mapFdFuncHost = mapFdFunc->getHostFunc(); // Call "wasm_bpf_map_fd_by_name" to get the map fd, and check the result @@ -456,8 +456,8 @@ TEST(WasmBpfTest, RunBpfProgramWithMapOperation) { // Get function `wasm_bpf_map_fd_by_name` auto *mapOptFunc = module->findFuncExports("wasm_bpf_map_operate"); - EXPECT_NE(mapOptFunc, nullptr); - EXPECT_TRUE(mapOptFunc->isHostFunction()); + ASSERT_NE(mapOptFunc, nullptr); + ASSERT_TRUE(mapOptFunc->isHostFunction()); auto &mapOptFuncHost = mapOptFunc->getHostFunc(); // A wrapper to call wasm_bpf_map_operate auto callMapOperate = [&](int32_t fd, int32_t cmd, uint32_t key, @@ -551,8 +551,8 @@ TEST(WasmBpfTest, RunBpfProgramWithMapOperation) { // Get function `wasm_close_bpf_object` auto *closeFunc = module->findFuncExports("wasm_close_bpf_object"); - EXPECT_NE(closeFunc, nullptr); - EXPECT_TRUE(closeFunc->isHostFunction()); + ASSERT_NE(closeFunc, nullptr); + ASSERT_TRUE(closeFunc->isHostFunction()); auto &closeFuncHost = closeFunc->getHostFunc(); // Call "wasm_close_bpf_object" to attach, and check the result diff --git a/test/plugins/wasmedge_ffmpeg/avcodec/avCodec.cpp b/test/plugins/wasmedge_ffmpeg/avcodec/avCodec.cpp index e4177cdd..1b40cf31 100644 --- a/test/plugins/wasmedge_ffmpeg/avcodec/avCodec.cpp +++ b/test/plugins/wasmedge_ffmpeg/avcodec/avCodec.cpp @@ -28,8 +28,8 @@ TEST_F(FFmpegTest, AVCodec) { uint32_t AVCodecId = readUInt32(MemInst, AVCodecPtr); auto *FuncInst = AVCodecMod->findFuncExports("wasmedge_ffmpeg_avcodec_avcodec_id"); - EXPECT_NE(FuncInst, nullptr); - EXPECT_TRUE(FuncInst->isHostFunction()); + ASSERT_NE(FuncInst, nullptr); + ASSERT_TRUE(FuncInst->isHostFunction()); auto &HostFuncAVCodecID = FuncInst->getHostFunc(); @@ -43,8 +43,8 @@ TEST_F(FFmpegTest, AVCodec) { FuncInst = AVCodecMod->findFuncExports("wasmedge_ffmpeg_avcodec_avcodec_type"); - EXPECT_NE(FuncInst, nullptr); - EXPECT_TRUE(FuncInst->isHostFunction()); + ASSERT_NE(FuncInst, nullptr); + ASSERT_TRUE(FuncInst->isHostFunction()); auto &HostFuncAVCodecType = FuncInst->getHostFunc(); @@ -59,8 +59,8 @@ TEST_F(FFmpegTest, AVCodec) { FuncInst = AVCodecMod->findFuncExports("wasmedge_ffmpeg_avcodec_avcodec_max_lowres"); - EXPECT_NE(FuncInst, nullptr); - EXPECT_TRUE(FuncInst->isHostFunction()); + ASSERT_NE(FuncInst, nullptr); + ASSERT_TRUE(FuncInst->isHostFunction()); auto &HostFuncAVCodecMaxLowres = FuncInst->getHostFunc(); @@ -74,8 +74,8 @@ TEST_F(FFmpegTest, AVCodec) { FuncInst = AVCodecMod->findFuncExports( "wasmedge_ffmpeg_avcodec_avcodec_capabilities"); - EXPECT_NE(FuncInst, nullptr); - EXPECT_TRUE(FuncInst->isHostFunction()); + ASSERT_NE(FuncInst, nullptr); + ASSERT_TRUE(FuncInst->isHostFunction()); auto &HostFuncAVCodecCapabilities = FuncInst->getHostFunc(); @@ -90,8 +90,8 @@ TEST_F(FFmpegTest, AVCodec) { int32_t Length = 0; FuncInst = AVCodecMod->findFuncExports( "wasmedge_ffmpeg_avcodec_avcodec_get_name_len"); - EXPECT_NE(FuncInst, nullptr); - EXPECT_TRUE(FuncInst->isHostFunction()); + ASSERT_NE(FuncInst, nullptr); + ASSERT_TRUE(FuncInst->isHostFunction()); auto &HostFuncAVCodecGetNameLen = FuncInst->getHostFunc(); @@ -106,8 +106,8 @@ TEST_F(FFmpegTest, AVCodec) { FuncInst = AVCodecMod->findFuncExports("wasmedge_ffmpeg_avcodec_avcodec_get_name"); - EXPECT_NE(FuncInst, nullptr); - EXPECT_TRUE(FuncInst->isHostFunction()); + ASSERT_NE(FuncInst, nullptr); + ASSERT_TRUE(FuncInst->isHostFunction()); auto &HostFuncAVCodecGetName = FuncInst->getHostFunc(); @@ -125,8 +125,8 @@ TEST_F(FFmpegTest, AVCodec) { FuncInst = AVCodecMod->findFuncExports( "wasmedge_ffmpeg_avcodec_avcodec_get_long_name_len"); - EXPECT_NE(FuncInst, nullptr); - EXPECT_TRUE(FuncInst->isHostFunction()); + ASSERT_NE(FuncInst, nullptr); + ASSERT_TRUE(FuncInst->isHostFunction()); auto &HostFuncAVCodecGetLongNameLen = FuncInst->getHostFunc(); @@ -141,8 +141,8 @@ TEST_F(FFmpegTest, AVCodec) { FuncInst = AVCodecMod->findFuncExports( "wasmedge_ffmpeg_avcodec_avcodec_get_long_name"); - EXPECT_NE(FuncInst, nullptr); - EXPECT_TRUE(FuncInst->isHostFunction()); + ASSERT_NE(FuncInst, nullptr); + ASSERT_TRUE(FuncInst->isHostFunction()); auto &HostFuncAVCodecGetLongName = FuncInst->getHostFunc(); @@ -158,8 +158,8 @@ TEST_F(FFmpegTest, AVCodec) { FuncInst = AVCodecMod->findFuncExports("wasmedge_ffmpeg_avcodec_avcodec_profiles"); - EXPECT_NE(FuncInst, nullptr); - EXPECT_TRUE(FuncInst->isHostFunction()); + ASSERT_NE(FuncInst, nullptr); + ASSERT_TRUE(FuncInst->isHostFunction()); auto &HostFuncAVCodecProfiles = FuncInst->getHostFunc(); @@ -173,8 +173,8 @@ TEST_F(FFmpegTest, AVCodec) { FuncInst = AVCodecMod->findFuncExports( "wasmedge_ffmpeg_avcodec_avcodec_pix_fmts_is_null"); - EXPECT_NE(FuncInst, nullptr); - EXPECT_TRUE(FuncInst->isHostFunction()); + ASSERT_NE(FuncInst, nullptr); + ASSERT_TRUE(FuncInst->isHostFunction()); auto &HostFuncAVCodecPixFmtIsNull = FuncInst->getHostFunc(); @@ -188,8 +188,8 @@ TEST_F(FFmpegTest, AVCodec) { FuncInst = AVCodecMod->findFuncExports( "wasmedge_ffmpeg_avcodec_avcodec_pix_fmts_iter"); - EXPECT_NE(FuncInst, nullptr); - EXPECT_TRUE(FuncInst->isHostFunction()); + ASSERT_NE(FuncInst, nullptr); + ASSERT_TRUE(FuncInst->isHostFunction()); auto &HostFuncAVCodecPixFmtIter = FuncInst->getHostFunc(); @@ -204,8 +204,8 @@ TEST_F(FFmpegTest, AVCodec) { FuncInst = AVCodecMod->findFuncExports( "wasmedge_ffmpeg_avcodec_avcodec_supported_framerate_is_null"); - EXPECT_NE(FuncInst, nullptr); - EXPECT_TRUE(FuncInst->isHostFunction()); + ASSERT_NE(FuncInst, nullptr); + ASSERT_TRUE(FuncInst->isHostFunction()); auto &HostFuncAVCodecSupportedFrameratesIsNull = FuncInst->getHostFunc(); @@ -219,8 +219,8 @@ TEST_F(FFmpegTest, AVCodec) { FuncInst = AVCodecMod->findFuncExports( "wasmedge_ffmpeg_avcodec_avcodec_supported_framerate_iter"); - EXPECT_NE(FuncInst, nullptr); - EXPECT_TRUE(FuncInst->isHostFunction()); + ASSERT_NE(FuncInst, nullptr); + ASSERT_TRUE(FuncInst->isHostFunction()); auto &HostFuncAVCodecSupportedFrameratesIter = FuncInst->getHostFunc(); @@ -236,8 +236,8 @@ TEST_F(FFmpegTest, AVCodec) { FuncInst = AVCodecMod->findFuncExports( "wasmedge_ffmpeg_avcodec_avcodec_supported_samplerates_is_null"); - EXPECT_NE(FuncInst, nullptr); - EXPECT_TRUE(FuncInst->isHostFunction()); + ASSERT_NE(FuncInst, nullptr); + ASSERT_TRUE(FuncInst->isHostFunction()); auto &HostFuncAVCodecSupportedSampleRatesIsNull = FuncInst->getHostFunc(); @@ -251,8 +251,8 @@ TEST_F(FFmpegTest, AVCodec) { FuncInst = AVCodecMod->findFuncExports( "wasmedge_ffmpeg_avcodec_avcodec_supported_samplerates_iter"); - EXPECT_NE(FuncInst, nullptr); - EXPECT_TRUE(FuncInst->isHostFunction()); + ASSERT_NE(FuncInst, nullptr); + ASSERT_TRUE(FuncInst->isHostFunction()); auto &HostFuncAVCodecSupportedSampleRatesIter = FuncInst->getHostFunc(); @@ -266,8 +266,8 @@ TEST_F(FFmpegTest, AVCodec) { FuncInst = AVCodecMod->findFuncExports( "wasmedge_ffmpeg_avcodec_avcodec_channel_layouts_is_null"); - EXPECT_NE(FuncInst, nullptr); - EXPECT_TRUE(FuncInst->isHostFunction()); + ASSERT_NE(FuncInst, nullptr); + ASSERT_TRUE(FuncInst->isHostFunction()); auto &HostFuncAVCodecChannelLayoutIsNull = FuncInst->getHostFunc(); @@ -281,8 +281,8 @@ TEST_F(FFmpegTest, AVCodec) { FuncInst = AVCodecMod->findFuncExports( "wasmedge_ffmpeg_avcodec_avcodec_channel_layouts_iter"); - EXPECT_NE(FuncInst, nullptr); - EXPECT_TRUE(FuncInst->isHostFunction()); + ASSERT_NE(FuncInst, nullptr); + ASSERT_TRUE(FuncInst->isHostFunction()); auto &HostFuncAVCodecChannelLayoutIter = FuncInst->getHostFunc(); @@ -296,8 +296,8 @@ TEST_F(FFmpegTest, AVCodec) { FuncInst = AVCodecMod->findFuncExports( "wasmedge_ffmpeg_avcodec_avcodec_sample_fmts_is_null"); - EXPECT_NE(FuncInst, nullptr); - EXPECT_TRUE(FuncInst->isHostFunction()); + ASSERT_NE(FuncInst, nullptr); + ASSERT_TRUE(FuncInst->isHostFunction()); auto &HostFuncAVCodecSampleFmtsIsNull = FuncInst->getHostFunc(); @@ -311,8 +311,8 @@ TEST_F(FFmpegTest, AVCodec) { FuncInst = AVCodecMod->findFuncExports( "wasmedge_ffmpeg_avcodec_avcodec_sample_fmts_iter"); - EXPECT_NE(FuncInst, nullptr); - EXPECT_TRUE(FuncInst->isHostFunction()); + ASSERT_NE(FuncInst, nullptr); + ASSERT_TRUE(FuncInst->isHostFunction()); auto &HostFuncAVCodecSampleFmtsIter = FuncInst->getHostFunc(); diff --git a/test/plugins/wasmedge_ffmpeg/avcodec/avCodecCtx.cpp b/test/plugins/wasmedge_ffmpeg/avcodec/avCodecCtx.cpp index a562e219..530701e9 100644 --- a/test/plugins/wasmedge_ffmpeg/avcodec/avCodecCtx.cpp +++ b/test/plugins/wasmedge_ffmpeg/avcodec/avCodecCtx.cpp @@ -29,8 +29,8 @@ TEST_F(FFmpegTest, AVCodecCtx) { auto *FuncInst = AVCodecMod->findFuncExports( "wasmedge_ffmpeg_avcodec_avcodeccontext_codec_id"); - EXPECT_NE(FuncInst, nullptr); - EXPECT_TRUE(FuncInst->isHostFunction()); + ASSERT_NE(FuncInst, nullptr); + ASSERT_TRUE(FuncInst->isHostFunction()); auto &HostFuncAVCodecCtxCodecID = FuncInst->getHostFunc(); @@ -44,8 +44,8 @@ TEST_F(FFmpegTest, AVCodecCtx) { int32_t CodecType = 0; // MediaType Video FuncInst = AVCodecMod->findFuncExports( "wasmedge_ffmpeg_avcodec_avcodeccontext_set_codec_type"); - EXPECT_NE(FuncInst, nullptr); - EXPECT_TRUE(FuncInst->isHostFunction()); + ASSERT_NE(FuncInst, nullptr); + ASSERT_TRUE(FuncInst->isHostFunction()); auto &HostFuncAVCodecCtxSetCodecType = FuncInst->getHostFunc(); @@ -59,8 +59,8 @@ TEST_F(FFmpegTest, AVCodecCtx) { FuncInst = AVCodecMod->findFuncExports( "wasmedge_ffmpeg_avcodec_avcodeccontext_codec_type"); - EXPECT_NE(FuncInst, nullptr); - EXPECT_TRUE(FuncInst->isHostFunction()); + ASSERT_NE(FuncInst, nullptr); + ASSERT_TRUE(FuncInst->isHostFunction()); auto &HostFuncAVCodecCtxCodecType = FuncInst->getHostFunc(); @@ -75,8 +75,8 @@ TEST_F(FFmpegTest, AVCodecCtx) { int32_t Den = 10; FuncInst = AVCodecMod->findFuncExports( "wasmedge_ffmpeg_avcodec_avcodeccontext_set_time_base"); - EXPECT_NE(FuncInst, nullptr); - EXPECT_TRUE(FuncInst->isHostFunction()); + ASSERT_NE(FuncInst, nullptr); + ASSERT_TRUE(FuncInst->isHostFunction()); auto &HostFuncAVCodecCtxSetTimebase = FuncInst->getHostFunc(); @@ -90,8 +90,8 @@ TEST_F(FFmpegTest, AVCodecCtx) { FuncInst = AVCodecMod->findFuncExports( "wasmedge_ffmpeg_avcodec_avcodeccontext_time_base"); - EXPECT_NE(FuncInst, nullptr); - EXPECT_TRUE(FuncInst->isHostFunction()); + ASSERT_NE(FuncInst, nullptr); + ASSERT_TRUE(FuncInst->isHostFunction()); auto &HostFuncAVCodecCtxTimeBase = FuncInst->getHostFunc(); @@ -111,8 +111,8 @@ TEST_F(FFmpegTest, AVCodecCtx) { int32_t Dimension = 200; FuncInst = AVCodecMod->findFuncExports( "wasmedge_ffmpeg_avcodec_avcodeccontext_set_width"); - EXPECT_NE(FuncInst, nullptr); - EXPECT_TRUE(FuncInst->isHostFunction()); + ASSERT_NE(FuncInst, nullptr); + ASSERT_TRUE(FuncInst->isHostFunction()); auto &HostFuncAVCodecCtxSetWidth = FuncInst->getHostFunc(); @@ -126,8 +126,8 @@ TEST_F(FFmpegTest, AVCodecCtx) { FuncInst = AVCodecMod->findFuncExports( "wasmedge_ffmpeg_avcodec_avcodeccontext_width"); - EXPECT_NE(FuncInst, nullptr); - EXPECT_TRUE(FuncInst->isHostFunction()); + ASSERT_NE(FuncInst, nullptr); + ASSERT_TRUE(FuncInst->isHostFunction()); auto &HostFuncAVCodecCtxWidth = FuncInst->getHostFunc(); @@ -140,8 +140,8 @@ TEST_F(FFmpegTest, AVCodecCtx) { FuncInst = AVCodecMod->findFuncExports( "wasmedge_ffmpeg_avcodec_avcodeccontext_set_height"); - EXPECT_NE(FuncInst, nullptr); - EXPECT_TRUE(FuncInst->isHostFunction()); + ASSERT_NE(FuncInst, nullptr); + ASSERT_TRUE(FuncInst->isHostFunction()); auto &HostFuncAVCodecCtxSetHeight = FuncInst->getHostFunc(); @@ -155,8 +155,8 @@ TEST_F(FFmpegTest, AVCodecCtx) { FuncInst = AVCodecMod->findFuncExports( "wasmedge_ffmpeg_avcodec_avcodeccontext_height"); - EXPECT_NE(FuncInst, nullptr); - EXPECT_TRUE(FuncInst->isHostFunction()); + ASSERT_NE(FuncInst, nullptr); + ASSERT_TRUE(FuncInst->isHostFunction()); auto &HostFuncAVCodecCtxHeight = FuncInst->getHostFunc(); @@ -171,8 +171,8 @@ TEST_F(FFmpegTest, AVCodecCtx) { Den = 20; FuncInst = AVCodecMod->findFuncExports( "wasmedge_ffmpeg_avcodec_avcodeccontext_set_sample_aspect_ratio"); - EXPECT_NE(FuncInst, nullptr); - EXPECT_TRUE(FuncInst->isHostFunction()); + ASSERT_NE(FuncInst, nullptr); + ASSERT_TRUE(FuncInst->isHostFunction()); auto &HostFuncAVCodecCtxSetSampleAspectRatio = FuncInst->getHostFunc(); @@ -186,8 +186,8 @@ TEST_F(FFmpegTest, AVCodecCtx) { FuncInst = AVCodecMod->findFuncExports( "wasmedge_ffmpeg_avcodec_avcodeccontext_sample_aspect_ratio"); - EXPECT_NE(FuncInst, nullptr); - EXPECT_TRUE(FuncInst->isHostFunction()); + ASSERT_NE(FuncInst, nullptr); + ASSERT_TRUE(FuncInst->isHostFunction()); auto &HostFuncAVCodecCtxSampleAspectRatio = FuncInst->getHostFunc(); @@ -208,8 +208,8 @@ TEST_F(FFmpegTest, AVCodecCtx) { uint64_t ChannelLayoutId = 1; // FRONT_LEFT; FuncInst = AVCodecMod->findFuncExports( "wasmedge_ffmpeg_avcodec_avcodeccontext_set_channel_layout"); - EXPECT_NE(FuncInst, nullptr); - EXPECT_TRUE(FuncInst->isHostFunction()); + ASSERT_NE(FuncInst, nullptr); + ASSERT_TRUE(FuncInst->isHostFunction()); auto &HostFuncAVCodecCtxSetChannelLayout = FuncInst->getHostFunc(); @@ -224,8 +224,8 @@ TEST_F(FFmpegTest, AVCodecCtx) { FuncInst = AVCodecMod->findFuncExports( "wasmedge_ffmpeg_avcodec_avcodeccontext_channel_layout"); - EXPECT_NE(FuncInst, nullptr); - EXPECT_TRUE(FuncInst->isHostFunction()); + ASSERT_NE(FuncInst, nullptr); + ASSERT_TRUE(FuncInst->isHostFunction()); auto &HostFuncAVCodecCtxChannelLayout = FuncInst->getHostFunc(); @@ -240,8 +240,8 @@ TEST_F(FFmpegTest, AVCodecCtx) { FuncInst = AVCodecMod->findFuncExports( "wasmedge_ffmpeg_avcodec_avcodeccontext_set_pix_fmt"); - EXPECT_NE(FuncInst, nullptr); - EXPECT_TRUE(FuncInst->isHostFunction()); + ASSERT_NE(FuncInst, nullptr); + ASSERT_TRUE(FuncInst->isHostFunction()); auto &HostFuncAVCodecCtxSetPixFormat = FuncInst->getHostFunc(); @@ -255,8 +255,8 @@ TEST_F(FFmpegTest, AVCodecCtx) { FuncInst = AVCodecMod->findFuncExports( "wasmedge_ffmpeg_avcodec_avcodeccontext_pix_fmt"); - EXPECT_NE(FuncInst, nullptr); - EXPECT_TRUE(FuncInst->isHostFunction()); + ASSERT_NE(FuncInst, nullptr); + ASSERT_TRUE(FuncInst->isHostFunction()); auto &HostFuncAVCodecCtxPixFormat = FuncInst->getHostFunc(); @@ -270,8 +270,8 @@ TEST_F(FFmpegTest, AVCodecCtx) { uint32_t SampleFmtId = 1; // SAMPLE_FMT_U8 FuncInst = AVCodecMod->findFuncExports( "wasmedge_ffmpeg_avcodec_avcodeccontext_set_sample_format"); - EXPECT_NE(FuncInst, nullptr); - EXPECT_TRUE(FuncInst->isHostFunction()); + ASSERT_NE(FuncInst, nullptr); + ASSERT_TRUE(FuncInst->isHostFunction()); auto &HostFuncAVCodecCtxSetSampleFormat = FuncInst->getHostFunc(); @@ -285,8 +285,8 @@ TEST_F(FFmpegTest, AVCodecCtx) { FuncInst = AVCodecMod->findFuncExports( "wasmedge_ffmpeg_avcodec_avcodeccontext_sample_format"); - EXPECT_NE(FuncInst, nullptr); - EXPECT_TRUE(FuncInst->isHostFunction()); + ASSERT_NE(FuncInst, nullptr); + ASSERT_TRUE(FuncInst->isHostFunction()); auto &HostFuncAVCodecCtxSampleFormat = FuncInst->getHostFunc(); @@ -300,8 +300,8 @@ TEST_F(FFmpegTest, AVCodecCtx) { int32_t SampleRate = 500; FuncInst = AVCodecMod->findFuncExports( "wasmedge_ffmpeg_avcodec_avcodeccontext_set_sample_rate"); - EXPECT_NE(FuncInst, nullptr); - EXPECT_TRUE(FuncInst->isHostFunction()); + ASSERT_NE(FuncInst, nullptr); + ASSERT_TRUE(FuncInst->isHostFunction()); auto &HostFuncAVCodecCtxSetSampleRate = FuncInst->getHostFunc(); @@ -315,8 +315,8 @@ TEST_F(FFmpegTest, AVCodecCtx) { FuncInst = AVCodecMod->findFuncExports( "wasmedge_ffmpeg_avcodec_avcodeccontext_sample_rate"); - EXPECT_NE(FuncInst, nullptr); - EXPECT_TRUE(FuncInst->isHostFunction()); + ASSERT_NE(FuncInst, nullptr); + ASSERT_TRUE(FuncInst->isHostFunction()); auto &HostFuncAVCodecCtxSampleRate = FuncInst->getHostFunc(); @@ -329,8 +329,8 @@ TEST_F(FFmpegTest, AVCodecCtx) { FuncInst = AVCodecMod->findFuncExports( "wasmedge_ffmpeg_avcodec_avcodeccontext_set_gop_size"); - EXPECT_NE(FuncInst, nullptr); - EXPECT_TRUE(FuncInst->isHostFunction()); + ASSERT_NE(FuncInst, nullptr); + ASSERT_TRUE(FuncInst->isHostFunction()); auto &HostFuncAVCodecCtxSetGopSize = FuncInst->getHostFunc(); @@ -345,8 +345,8 @@ TEST_F(FFmpegTest, AVCodecCtx) { FuncInst = AVCodecMod->findFuncExports( "wasmedge_ffmpeg_avcodec_avcodeccontext_set_max_b_frames"); - EXPECT_NE(FuncInst, nullptr); - EXPECT_TRUE(FuncInst->isHostFunction()); + ASSERT_NE(FuncInst, nullptr); + ASSERT_TRUE(FuncInst->isHostFunction()); auto &HostFuncAVCodecCtxSetMaxBFrames = FuncInst->getHostFunc(); @@ -361,8 +361,8 @@ TEST_F(FFmpegTest, AVCodecCtx) { FuncInst = AVCodecMod->findFuncExports( "wasmedge_ffmpeg_avcodec_avcodeccontext_set_b_quant_factor"); - EXPECT_NE(FuncInst, nullptr); - EXPECT_TRUE(FuncInst->isHostFunction()); + ASSERT_NE(FuncInst, nullptr); + ASSERT_TRUE(FuncInst->isHostFunction()); auto &HostFuncAVCodecCtxSetBQuantFactor = FuncInst->getHostFunc(); @@ -377,8 +377,8 @@ TEST_F(FFmpegTest, AVCodecCtx) { FuncInst = AVCodecMod->findFuncExports( "wasmedge_ffmpeg_avcodec_avcodeccontext_set_b_quant_offset"); - EXPECT_NE(FuncInst, nullptr); - EXPECT_TRUE(FuncInst->isHostFunction()); + ASSERT_NE(FuncInst, nullptr); + ASSERT_TRUE(FuncInst->isHostFunction()); auto &HostFuncAVCodecCtxSetBQuantOffset = FuncInst->getHostFunc(); @@ -393,8 +393,8 @@ TEST_F(FFmpegTest, AVCodecCtx) { FuncInst = AVCodecMod->findFuncExports( "wasmedge_ffmpeg_avcodec_avcodeccontext_set_i_quant_factor"); - EXPECT_NE(FuncInst, nullptr); - EXPECT_TRUE(FuncInst->isHostFunction()); + ASSERT_NE(FuncInst, nullptr); + ASSERT_TRUE(FuncInst->isHostFunction()); auto &HostFuncAVCodecCtxSetIQuantFactor = FuncInst->getHostFunc(); @@ -409,8 +409,8 @@ TEST_F(FFmpegTest, AVCodecCtx) { FuncInst = AVCodecMod->findFuncExports( "wasmedge_ffmpeg_avcodec_avcodeccontext_set_i_quant_offset"); - EXPECT_NE(FuncInst, nullptr); - EXPECT_TRUE(FuncInst->isHostFunction()); + ASSERT_NE(FuncInst, nullptr); + ASSERT_TRUE(FuncInst->isHostFunction()); auto &HostFuncAVCodecCtxSetIQuantOffset = FuncInst->getHostFunc(); @@ -425,8 +425,8 @@ TEST_F(FFmpegTest, AVCodecCtx) { FuncInst = AVCodecMod->findFuncExports( "wasmedge_ffmpeg_avcodec_avcodeccontext_set_lumi_masking"); - EXPECT_NE(FuncInst, nullptr); - EXPECT_TRUE(FuncInst->isHostFunction()); + ASSERT_NE(FuncInst, nullptr); + ASSERT_TRUE(FuncInst->isHostFunction()); auto &HostFuncAVCodecCtxSetLumiMasking = FuncInst->getHostFunc(); @@ -441,8 +441,8 @@ TEST_F(FFmpegTest, AVCodecCtx) { FuncInst = AVCodecMod->findFuncExports( "wasmedge_ffmpeg_avcodec_avcodeccontext_set_temporal_cplx_masking"); - EXPECT_NE(FuncInst, nullptr); - EXPECT_TRUE(FuncInst->isHostFunction()); + ASSERT_NE(FuncInst, nullptr); + ASSERT_TRUE(FuncInst->isHostFunction()); auto &HostFuncAVCodecCtxSetTemporalCplxMasking = FuncInst->getHostFunc(); @@ -458,8 +458,8 @@ TEST_F(FFmpegTest, AVCodecCtx) { FuncInst = AVCodecMod->findFuncExports( "wasmedge_ffmpeg_avcodec_avcodeccontext_set_spatial_cplx_masking"); - EXPECT_NE(FuncInst, nullptr); - EXPECT_TRUE(FuncInst->isHostFunction()); + ASSERT_NE(FuncInst, nullptr); + ASSERT_TRUE(FuncInst->isHostFunction()); auto &HostFuncAVCodecCtxSetSpatialCplxMasking = FuncInst->getHostFunc(); @@ -475,8 +475,8 @@ TEST_F(FFmpegTest, AVCodecCtx) { FuncInst = AVCodecMod->findFuncExports( "wasmedge_ffmpeg_avcodec_avcodeccontext_set_p_masking"); - EXPECT_NE(FuncInst, nullptr); - EXPECT_TRUE(FuncInst->isHostFunction()); + ASSERT_NE(FuncInst, nullptr); + ASSERT_TRUE(FuncInst->isHostFunction()); auto &HostFuncAVCodecCtxSetPMasking = FuncInst->getHostFunc(); @@ -491,8 +491,8 @@ TEST_F(FFmpegTest, AVCodecCtx) { FuncInst = AVCodecMod->findFuncExports( "wasmedge_ffmpeg_avcodec_avcodeccontext_set_dark_masking"); - EXPECT_NE(FuncInst, nullptr); - EXPECT_TRUE(FuncInst->isHostFunction()); + ASSERT_NE(FuncInst, nullptr); + ASSERT_TRUE(FuncInst->isHostFunction()); auto &HostFuncAVCodecCtxSetDarkMasking = FuncInst->getHostFunc(); @@ -507,8 +507,8 @@ TEST_F(FFmpegTest, AVCodecCtx) { FuncInst = AVCodecMod->findFuncExports( "wasmedge_ffmpeg_avcodec_avcodeccontext_set_me_cmp"); - EXPECT_NE(FuncInst, nullptr); - EXPECT_TRUE(FuncInst->isHostFunction()); + ASSERT_NE(FuncInst, nullptr); + ASSERT_TRUE(FuncInst->isHostFunction()); auto &HostFuncAVCodecCtxSetMeCmp = FuncInst->getHostFunc(); @@ -523,8 +523,8 @@ TEST_F(FFmpegTest, AVCodecCtx) { FuncInst = AVCodecMod->findFuncExports( "wasmedge_ffmpeg_avcodec_avcodeccontext_set_me_sub_cmp"); - EXPECT_NE(FuncInst, nullptr); - EXPECT_TRUE(FuncInst->isHostFunction()); + ASSERT_NE(FuncInst, nullptr); + ASSERT_TRUE(FuncInst->isHostFunction()); auto &HostFuncAVCodecCtxSetMeSubCmp = FuncInst->getHostFunc(); @@ -539,8 +539,8 @@ TEST_F(FFmpegTest, AVCodecCtx) { FuncInst = AVCodecMod->findFuncExports( "wasmedge_ffmpeg_avcodec_avcodeccontext_set_mb_cmp"); - EXPECT_NE(FuncInst, nullptr); - EXPECT_TRUE(FuncInst->isHostFunction()); + ASSERT_NE(FuncInst, nullptr); + ASSERT_TRUE(FuncInst->isHostFunction()); auto &HostFuncAVCodecCtxSetMbCmp = FuncInst->getHostFunc(); @@ -555,8 +555,8 @@ TEST_F(FFmpegTest, AVCodecCtx) { FuncInst = AVCodecMod->findFuncExports( "wasmedge_ffmpeg_avcodec_avcodeccontext_set_ildct_cmp"); - EXPECT_NE(FuncInst, nullptr); - EXPECT_TRUE(FuncInst->isHostFunction()); + ASSERT_NE(FuncInst, nullptr); + ASSERT_TRUE(FuncInst->isHostFunction()); auto &HostFuncAVCodecCtxSetIldctCmp = FuncInst->getHostFunc(); @@ -571,8 +571,8 @@ TEST_F(FFmpegTest, AVCodecCtx) { FuncInst = AVCodecMod->findFuncExports( "wasmedge_ffmpeg_avcodec_avcodeccontext_set_dia_size"); - EXPECT_NE(FuncInst, nullptr); - EXPECT_TRUE(FuncInst->isHostFunction()); + ASSERT_NE(FuncInst, nullptr); + ASSERT_TRUE(FuncInst->isHostFunction()); auto &HostFuncAVCodecCtxSetDiaSize = FuncInst->getHostFunc(); @@ -587,8 +587,8 @@ TEST_F(FFmpegTest, AVCodecCtx) { FuncInst = AVCodecMod->findFuncExports( "wasmedge_ffmpeg_avcodec_avcodeccontext_set_last_predictor_count"); - EXPECT_NE(FuncInst, nullptr); - EXPECT_TRUE(FuncInst->isHostFunction()); + ASSERT_NE(FuncInst, nullptr); + ASSERT_TRUE(FuncInst->isHostFunction()); auto &HostFuncAVCodecCtxSetLastPredictorsCount = FuncInst->getHostFunc(); @@ -604,8 +604,8 @@ TEST_F(FFmpegTest, AVCodecCtx) { FuncInst = AVCodecMod->findFuncExports( "wasmedge_ffmpeg_avcodec_avcodeccontext_set_me_pre_cmp"); - EXPECT_NE(FuncInst, nullptr); - EXPECT_TRUE(FuncInst->isHostFunction()); + ASSERT_NE(FuncInst, nullptr); + ASSERT_TRUE(FuncInst->isHostFunction()); auto &HostFuncAVCodecCtxSetMePreCmp = FuncInst->getHostFunc(); @@ -620,8 +620,8 @@ TEST_F(FFmpegTest, AVCodecCtx) { FuncInst = AVCodecMod->findFuncExports( "wasmedge_ffmpeg_avcodec_avcodeccontext_set_pre_dia_size"); - EXPECT_NE(FuncInst, nullptr); - EXPECT_TRUE(FuncInst->isHostFunction()); + ASSERT_NE(FuncInst, nullptr); + ASSERT_TRUE(FuncInst->isHostFunction()); auto &HostFuncAVCodecCtxSetPreDiaSize = FuncInst->getHostFunc(); @@ -636,8 +636,8 @@ TEST_F(FFmpegTest, AVCodecCtx) { FuncInst = AVCodecMod->findFuncExports( "wasmedge_ffmpeg_avcodec_avcodeccontext_set_me_subpel_quality"); - EXPECT_NE(FuncInst, nullptr); - EXPECT_TRUE(FuncInst->isHostFunction()); + ASSERT_NE(FuncInst, nullptr); + ASSERT_TRUE(FuncInst->isHostFunction()); auto &HostFuncAVCodecCtxSetMeSubpelQuality = FuncInst->getHostFunc(); @@ -653,8 +653,8 @@ TEST_F(FFmpegTest, AVCodecCtx) { FuncInst = AVCodecMod->findFuncExports( "wasmedge_ffmpeg_avcodec_avcodeccontext_set_me_range"); - EXPECT_NE(FuncInst, nullptr); - EXPECT_TRUE(FuncInst->isHostFunction()); + ASSERT_NE(FuncInst, nullptr); + ASSERT_TRUE(FuncInst->isHostFunction()); auto &HostFuncAVCodecCtxSetMeRange = FuncInst->getHostFunc(); @@ -669,8 +669,8 @@ TEST_F(FFmpegTest, AVCodecCtx) { FuncInst = AVCodecMod->findFuncExports( "wasmedge_ffmpeg_avcodec_avcodeccontext_set_mb_decision"); - EXPECT_NE(FuncInst, nullptr); - EXPECT_TRUE(FuncInst->isHostFunction()); + ASSERT_NE(FuncInst, nullptr); + ASSERT_TRUE(FuncInst->isHostFunction()); auto &HostFuncAVCodecCtxSetMbDecision = FuncInst->getHostFunc(); @@ -685,8 +685,8 @@ TEST_F(FFmpegTest, AVCodecCtx) { FuncInst = AVCodecMod->findFuncExports( "wasmedge_ffmpeg_avcodec_avcodeccontext_set_mb_lmin"); - EXPECT_NE(FuncInst, nullptr); - EXPECT_TRUE(FuncInst->isHostFunction()); + ASSERT_NE(FuncInst, nullptr); + ASSERT_TRUE(FuncInst->isHostFunction()); auto &HostFuncAVCodecCtxSetMbLMin = FuncInst->getHostFunc(); @@ -701,8 +701,8 @@ TEST_F(FFmpegTest, AVCodecCtx) { FuncInst = AVCodecMod->findFuncExports( "wasmedge_ffmpeg_avcodec_avcodeccontext_set_mb_lmax"); - EXPECT_NE(FuncInst, nullptr); - EXPECT_TRUE(FuncInst->isHostFunction()); + ASSERT_NE(FuncInst, nullptr); + ASSERT_TRUE(FuncInst->isHostFunction()); auto &HostFuncAVCodecCtxSetMbLMax = FuncInst->getHostFunc(); @@ -717,8 +717,8 @@ TEST_F(FFmpegTest, AVCodecCtx) { FuncInst = AVCodecMod->findFuncExports( "wasmedge_ffmpeg_avcodec_avcodeccontext_set_intra_dc_precision"); - EXPECT_NE(FuncInst, nullptr); - EXPECT_TRUE(FuncInst->isHostFunction()); + ASSERT_NE(FuncInst, nullptr); + ASSERT_TRUE(FuncInst->isHostFunction()); int32_t IntraDcPrecision = 323; auto &HostFuncAVCodecCtxSetIntraDcPrecision = FuncInst->getHostFunc(); @@ -734,8 +734,8 @@ TEST_F(FFmpegTest, AVCodecCtx) { FuncInst = AVCodecMod->findFuncExports( "wasmedge_ffmpeg_avcodec_avcodeccontext_intra_dc_precision"); - EXPECT_NE(FuncInst, nullptr); - EXPECT_TRUE(FuncInst->isHostFunction()); + ASSERT_NE(FuncInst, nullptr); + ASSERT_TRUE(FuncInst->isHostFunction()); auto &HostFuncAVCodecCtxIntraDcPrecision = FuncInst->getHostFunc(); @@ -748,8 +748,8 @@ TEST_F(FFmpegTest, AVCodecCtx) { FuncInst = AVCodecMod->findFuncExports( "wasmedge_ffmpeg_avcodec_avcodeccontext_set_qmin"); - EXPECT_NE(FuncInst, nullptr); - EXPECT_TRUE(FuncInst->isHostFunction()); + ASSERT_NE(FuncInst, nullptr); + ASSERT_TRUE(FuncInst->isHostFunction()); auto &HostFuncAVCodecCtxSetQMin = FuncInst->getHostFunc(); @@ -764,8 +764,8 @@ TEST_F(FFmpegTest, AVCodecCtx) { FuncInst = AVCodecMod->findFuncExports( "wasmedge_ffmpeg_avcodec_avcodeccontext_set_qmax"); - EXPECT_NE(FuncInst, nullptr); - EXPECT_TRUE(FuncInst->isHostFunction()); + ASSERT_NE(FuncInst, nullptr); + ASSERT_TRUE(FuncInst->isHostFunction()); auto &HostFuncAVCodecCtxSetQMax = FuncInst->getHostFunc(); @@ -780,8 +780,8 @@ TEST_F(FFmpegTest, AVCodecCtx) { FuncInst = AVCodecMod->findFuncExports( "wasmedge_ffmpeg_avcodec_avcodeccontext_set_global_quality"); - EXPECT_NE(FuncInst, nullptr); - EXPECT_TRUE(FuncInst->isHostFunction()); + ASSERT_NE(FuncInst, nullptr); + ASSERT_TRUE(FuncInst->isHostFunction()); auto &HostFuncAVCodecCtxSetGlobalQuality = FuncInst->getHostFunc(); @@ -797,8 +797,8 @@ TEST_F(FFmpegTest, AVCodecCtx) { FuncInst = AVCodecMod->findFuncExports( "wasmedge_ffmpeg_avcodec_avcodeccontext_set_colorspace"); - EXPECT_NE(FuncInst, nullptr); - EXPECT_TRUE(FuncInst->isHostFunction()); + ASSERT_NE(FuncInst, nullptr); + ASSERT_TRUE(FuncInst->isHostFunction()); auto &HostFuncAVCodecCtxSetColorspace = FuncInst->getHostFunc(); @@ -813,8 +813,8 @@ TEST_F(FFmpegTest, AVCodecCtx) { FuncInst = AVCodecMod->findFuncExports( "wasmedge_ffmpeg_avcodec_avcodeccontext_colorspace"); - EXPECT_NE(FuncInst, nullptr); - EXPECT_TRUE(FuncInst->isHostFunction()); + ASSERT_NE(FuncInst, nullptr); + ASSERT_TRUE(FuncInst->isHostFunction()); auto &HostFuncAVCodecCtxColorspace = FuncInst->getHostFunc(); @@ -827,8 +827,8 @@ TEST_F(FFmpegTest, AVCodecCtx) { FuncInst = AVCodecMod->findFuncExports( "wasmedge_ffmpeg_avcodec_avcodeccontext_set_color_range"); - EXPECT_NE(FuncInst, nullptr); - EXPECT_TRUE(FuncInst->isHostFunction()); + ASSERT_NE(FuncInst, nullptr); + ASSERT_TRUE(FuncInst->isHostFunction()); auto &HostFuncAVCodecCtxSetColorRange = FuncInst->getHostFunc(); @@ -843,8 +843,8 @@ TEST_F(FFmpegTest, AVCodecCtx) { FuncInst = AVCodecMod->findFuncExports( "wasmedge_ffmpeg_avcodec_avcodeccontext_color_range"); - EXPECT_NE(FuncInst, nullptr); - EXPECT_TRUE(FuncInst->isHostFunction()); + ASSERT_NE(FuncInst, nullptr); + ASSERT_TRUE(FuncInst->isHostFunction()); auto &HostFuncAVCodecCtxColorRange = FuncInst->getHostFunc(); @@ -857,8 +857,8 @@ TEST_F(FFmpegTest, AVCodecCtx) { FuncInst = AVCodecMod->findFuncExports( "wasmedge_ffmpeg_avcodec_avcodeccontext_frame_size"); - EXPECT_NE(FuncInst, nullptr); - EXPECT_TRUE(FuncInst->isHostFunction()); + ASSERT_NE(FuncInst, nullptr); + ASSERT_TRUE(FuncInst->isHostFunction()); auto &HostFuncAVCodecCtxFrameSize = FuncInst->getHostFunc(); @@ -871,8 +871,8 @@ TEST_F(FFmpegTest, AVCodecCtx) { FuncInst = AVCodecMod->findFuncExports( "wasmedge_ffmpeg_avcodec_avcodeccontext_set_bit_rate"); - EXPECT_NE(FuncInst, nullptr); - EXPECT_TRUE(FuncInst->isHostFunction()); + ASSERT_NE(FuncInst, nullptr); + ASSERT_TRUE(FuncInst->isHostFunction()); auto &HostFuncAVCodecCtxSetBitRate = FuncInst->getHostFunc(); @@ -887,8 +887,8 @@ TEST_F(FFmpegTest, AVCodecCtx) { FuncInst = AVCodecMod->findFuncExports( "wasmedge_ffmpeg_avcodec_avcodeccontext_bit_rate"); - EXPECT_NE(FuncInst, nullptr); - EXPECT_TRUE(FuncInst->isHostFunction()); + ASSERT_NE(FuncInst, nullptr); + ASSERT_TRUE(FuncInst->isHostFunction()); auto &HostFuncAVCodecCtxBitRate = FuncInst->getHostFunc(); @@ -901,8 +901,8 @@ TEST_F(FFmpegTest, AVCodecCtx) { FuncInst = AVCodecMod->findFuncExports( "wasmedge_ffmpeg_avcodec_avcodeccontext_set_rc_max_rate"); - EXPECT_NE(FuncInst, nullptr); - EXPECT_TRUE(FuncInst->isHostFunction()); + ASSERT_NE(FuncInst, nullptr); + ASSERT_TRUE(FuncInst->isHostFunction()); int64_t RcMaxRate = 3245; auto &HostFuncAVCodecCtxSetRcMaxRate = FuncInst->getHostFunc(); @@ -917,8 +917,8 @@ TEST_F(FFmpegTest, AVCodecCtx) { FuncInst = AVCodecMod->findFuncExports( "wasmedge_ffmpeg_avcodec_avcodeccontext_rc_max_rate"); - EXPECT_NE(FuncInst, nullptr); - EXPECT_TRUE(FuncInst->isHostFunction()); + ASSERT_NE(FuncInst, nullptr); + ASSERT_TRUE(FuncInst->isHostFunction()); auto &HostFuncAVCodecCtxRcMaxRate = FuncInst->getHostFunc(); @@ -931,8 +931,8 @@ TEST_F(FFmpegTest, AVCodecCtx) { FuncInst = AVCodecMod->findFuncExports( "wasmedge_ffmpeg_avcodec_avcodeccontext_set_bit_rate_tolerance"); - EXPECT_NE(FuncInst, nullptr); - EXPECT_TRUE(FuncInst->isHostFunction()); + ASSERT_NE(FuncInst, nullptr); + ASSERT_TRUE(FuncInst->isHostFunction()); auto &HostFuncAVCodecCtxSetBitRateTolerance = FuncInst->getHostFunc(); @@ -948,8 +948,8 @@ TEST_F(FFmpegTest, AVCodecCtx) { FuncInst = AVCodecMod->findFuncExports( "wasmedge_ffmpeg_avcodec_avcodeccontext_set_compression_level"); - EXPECT_NE(FuncInst, nullptr); - EXPECT_TRUE(FuncInst->isHostFunction()); + ASSERT_NE(FuncInst, nullptr); + ASSERT_TRUE(FuncInst->isHostFunction()); auto &HostFuncAVCodecCtxSetCompressionLevel = FuncInst->getHostFunc(); @@ -965,8 +965,8 @@ TEST_F(FFmpegTest, AVCodecCtx) { FuncInst = AVCodecMod->findFuncExports( "wasmedge_ffmpeg_avcodec_avcodeccontext_set_framerate"); - EXPECT_NE(FuncInst, nullptr); - EXPECT_TRUE(FuncInst->isHostFunction()); + ASSERT_NE(FuncInst, nullptr); + ASSERT_TRUE(FuncInst->isHostFunction()); Num = 20; Den = 30; @@ -982,8 +982,8 @@ TEST_F(FFmpegTest, AVCodecCtx) { FuncInst = AVCodecMod->findFuncExports( "wasmedge_ffmpeg_avcodec_avcodeccontext_framerate"); - EXPECT_NE(FuncInst, nullptr); - EXPECT_TRUE(FuncInst->isHostFunction()); + ASSERT_NE(FuncInst, nullptr); + ASSERT_TRUE(FuncInst->isHostFunction()); auto &HostFuncAVCodecCtxFrameRate = FuncInst->getHostFunc(); @@ -1002,8 +1002,8 @@ TEST_F(FFmpegTest, AVCodecCtx) { FuncInst = AVCodecMod->findFuncExports( "wasmedge_ffmpeg_avcodec_avcodeccontext_set_flags"); - EXPECT_NE(FuncInst, nullptr); - EXPECT_TRUE(FuncInst->isHostFunction()); + ASSERT_NE(FuncInst, nullptr); + ASSERT_TRUE(FuncInst->isHostFunction()); auto &HostFuncAVCodecCtxSetFlags = FuncInst->getHostFunc(); @@ -1018,8 +1018,8 @@ TEST_F(FFmpegTest, AVCodecCtx) { FuncInst = AVCodecMod->findFuncExports( "wasmedge_ffmpeg_avcodec_avcodeccontext_set_strict_std_compliance"); - EXPECT_NE(FuncInst, nullptr); - EXPECT_TRUE(FuncInst->isHostFunction()); + ASSERT_NE(FuncInst, nullptr); + ASSERT_TRUE(FuncInst->isHostFunction()); auto &HostFuncAVCodecCtxSetStrictStdCompliance = FuncInst->getHostFunc(); @@ -1034,8 +1034,8 @@ TEST_F(FFmpegTest, AVCodecCtx) { FuncInst = AVCodecMod->findFuncExports( "wasmedge_ffmpeg_avcodec_avcodeccontext_set_debug"); - EXPECT_NE(FuncInst, nullptr); - EXPECT_TRUE(FuncInst->isHostFunction()); + ASSERT_NE(FuncInst, nullptr); + ASSERT_TRUE(FuncInst->isHostFunction()); auto &HostFuncAVCodecCtxSetDebug = FuncInst->getHostFunc(); @@ -1050,8 +1050,8 @@ TEST_F(FFmpegTest, AVCodecCtx) { FuncInst = AVCodecMod->findFuncExports( "wasmedge_ffmpeg_avcodec_avcodeccontext_codec"); - EXPECT_NE(FuncInst, nullptr); - EXPECT_TRUE(FuncInst->isHostFunction()); + ASSERT_NE(FuncInst, nullptr); + ASSERT_TRUE(FuncInst->isHostFunction()); auto &HostFuncAVCodecCtxCodec = FuncInst->getHostFunc(); @@ -1066,8 +1066,8 @@ TEST_F(FFmpegTest, AVCodecCtx) { FuncInst = AVCodecMod->findFuncExports( "wasmedge_ffmpeg_avcodec_avcodeccontext_set_channels"); - EXPECT_NE(FuncInst, nullptr); - EXPECT_TRUE(FuncInst->isHostFunction()); + ASSERT_NE(FuncInst, nullptr); + ASSERT_TRUE(FuncInst->isHostFunction()); auto &HostFuncAVCodecCtxSetChannels = FuncInst->getHostFunc(); @@ -1082,8 +1082,8 @@ TEST_F(FFmpegTest, AVCodecCtx) { FuncInst = AVCodecMod->findFuncExports( "wasmedge_ffmpeg_avcodec_avcodeccontext_channels"); - EXPECT_NE(FuncInst, nullptr); - EXPECT_TRUE(FuncInst->isHostFunction()); + ASSERT_NE(FuncInst, nullptr); + ASSERT_TRUE(FuncInst->isHostFunction()); auto &HostFuncAVCodecCtxChannels = FuncInst->getHostFunc(); @@ -1096,8 +1096,8 @@ TEST_F(FFmpegTest, AVCodecCtx) { FuncInst = AVCodecMod->findFuncExports( "wasmedge_ffmpeg_avcodec_avcodeccontext_set_skip_loop_filter"); - EXPECT_NE(FuncInst, nullptr); - EXPECT_TRUE(FuncInst->isHostFunction()); + ASSERT_NE(FuncInst, nullptr); + ASSERT_TRUE(FuncInst->isHostFunction()); auto &HostFuncAVCodecCtxSetSkipLoopFilter = FuncInst->getHostFunc(); @@ -1112,8 +1112,8 @@ TEST_F(FFmpegTest, AVCodecCtx) { FuncInst = AVCodecMod->findFuncExports( "wasmedge_ffmpeg_avcodec_avcodeccontext_set_skip_frame"); - EXPECT_NE(FuncInst, nullptr); - EXPECT_TRUE(FuncInst->isHostFunction()); + ASSERT_NE(FuncInst, nullptr); + ASSERT_TRUE(FuncInst->isHostFunction()); auto &HostFuncAVCodecCtxSetSkipFrame = FuncInst->getHostFunc(); @@ -1127,8 +1127,8 @@ TEST_F(FFmpegTest, AVCodecCtx) { FuncInst = AVCodecMod->findFuncExports( "wasmedge_ffmpeg_avcodec_avcodeccontext_set_skip_idct"); - EXPECT_NE(FuncInst, nullptr); - EXPECT_TRUE(FuncInst->isHostFunction()); + ASSERT_NE(FuncInst, nullptr); + ASSERT_TRUE(FuncInst->isHostFunction()); auto &HostFuncAVCodecCtxSetSkipIdct = FuncInst->getHostFunc(); @@ -1142,8 +1142,8 @@ TEST_F(FFmpegTest, AVCodecCtx) { FuncInst = AVCodecMod->findFuncExports( "wasmedge_ffmpeg_avcodec_avcodeccontext_set_error_concealment"); - EXPECT_NE(FuncInst, nullptr); - EXPECT_TRUE(FuncInst->isHostFunction()); + ASSERT_NE(FuncInst, nullptr); + ASSERT_TRUE(FuncInst->isHostFunction()); auto &HostFuncAVCodecCtxSetErrorConcealment = FuncInst->getHostFunc(); @@ -1159,8 +1159,8 @@ TEST_F(FFmpegTest, AVCodecCtx) { FuncInst = AVCodecMod->findFuncExports( "wasmedge_ffmpeg_avcodec_avcodeccontext_set_err_recognition"); - EXPECT_NE(FuncInst, nullptr); - EXPECT_TRUE(FuncInst->isHostFunction()); + ASSERT_NE(FuncInst, nullptr); + ASSERT_TRUE(FuncInst->isHostFunction()); auto &HostFuncAVCodecCtxSetErrorRecognition = FuncInst->getHostFunc(); @@ -1176,8 +1176,8 @@ TEST_F(FFmpegTest, AVCodecCtx) { FuncInst = AVCodecMod->findFuncExports( "wasmedge_ffmpeg_avcodec_avcodeccontext_delay"); - EXPECT_NE(FuncInst, nullptr); - EXPECT_TRUE(FuncInst->isHostFunction()); + ASSERT_NE(FuncInst, nullptr); + ASSERT_TRUE(FuncInst->isHostFunction()); auto &HostFuncAVCodecCtxDelay = FuncInst->getHostFunc(); @@ -1190,8 +1190,8 @@ TEST_F(FFmpegTest, AVCodecCtx) { FuncInst = AVCodecMod->findFuncExports( "wasmedge_ffmpeg_avcodec_avcodeccontext_set_skip_top"); - EXPECT_NE(FuncInst, nullptr); - EXPECT_TRUE(FuncInst->isHostFunction()); + ASSERT_NE(FuncInst, nullptr); + ASSERT_TRUE(FuncInst->isHostFunction()); auto &HostFuncAVCodecCtxSetSkipTop = FuncInst->getHostFunc(); @@ -1206,8 +1206,8 @@ TEST_F(FFmpegTest, AVCodecCtx) { FuncInst = AVCodecMod->findFuncExports( "wasmedge_ffmpeg_avcodec_avcodeccontext_set_skip_bottom"); - EXPECT_NE(FuncInst, nullptr); - EXPECT_TRUE(FuncInst->isHostFunction()); + ASSERT_NE(FuncInst, nullptr); + ASSERT_TRUE(FuncInst->isHostFunction()); auto &HostFuncAVCodecCtxSetSkipBottom = FuncInst->getHostFunc(); @@ -1222,8 +1222,8 @@ TEST_F(FFmpegTest, AVCodecCtx) { FuncInst = AVCodecMod->findFuncExports( "wasmedge_ffmpeg_avcodec_avcodeccontext_refs"); - EXPECT_NE(FuncInst, nullptr); - EXPECT_TRUE(FuncInst->isHostFunction()); + ASSERT_NE(FuncInst, nullptr); + ASSERT_TRUE(FuncInst->isHostFunction()); auto &HostFuncAVCodecCtxRefs = FuncInst->getHostFunc(); @@ -1236,8 +1236,8 @@ TEST_F(FFmpegTest, AVCodecCtx) { FuncInst = AVCodecMod->findFuncExports( "wasmedge_ffmpeg_avcodec_avcodeccontext_set_slice_flags"); - EXPECT_NE(FuncInst, nullptr); - EXPECT_TRUE(FuncInst->isHostFunction()); + ASSERT_NE(FuncInst, nullptr); + ASSERT_TRUE(FuncInst->isHostFunction()); auto &HostFuncAVCodecCtxSetSliceFlags = FuncInst->getHostFunc(); @@ -1252,8 +1252,8 @@ TEST_F(FFmpegTest, AVCodecCtx) { FuncInst = AVCodecMod->findFuncExports( "wasmedge_ffmpeg_avcodec_avcodeccontext_set_slice_count"); - EXPECT_NE(FuncInst, nullptr); - EXPECT_TRUE(FuncInst->isHostFunction()); + ASSERT_NE(FuncInst, nullptr); + ASSERT_TRUE(FuncInst->isHostFunction()); auto &HostFuncAVCodecCtxSetSliceCount = FuncInst->getHostFunc(); @@ -1268,8 +1268,8 @@ TEST_F(FFmpegTest, AVCodecCtx) { FuncInst = AVCodecMod->findFuncExports( "wasmedge_ffmpeg_avcodec_avcodeccontext_set_field_order"); - EXPECT_NE(FuncInst, nullptr); - EXPECT_TRUE(FuncInst->isHostFunction()); + ASSERT_NE(FuncInst, nullptr); + ASSERT_TRUE(FuncInst->isHostFunction()); auto &HostFuncAVCodecCtxSetFieldOrder = FuncInst->getHostFunc(); @@ -1284,8 +1284,8 @@ TEST_F(FFmpegTest, AVCodecCtx) { FuncInst = AVCodecMod->findFuncExports( "wasmedge_ffmpeg_avcodec_avcodeccontext_color_trc"); - EXPECT_NE(FuncInst, nullptr); - EXPECT_TRUE(FuncInst->isHostFunction()); + ASSERT_NE(FuncInst, nullptr); + ASSERT_TRUE(FuncInst->isHostFunction()); auto &HostFuncAVCodecCtxColorTrc = FuncInst->getHostFunc(); @@ -1298,8 +1298,8 @@ TEST_F(FFmpegTest, AVCodecCtx) { FuncInst = AVCodecMod->findFuncExports( "wasmedge_ffmpeg_avcodec_avcodeccontext_chroma_sample_location"); - EXPECT_NE(FuncInst, nullptr); - EXPECT_TRUE(FuncInst->isHostFunction()); + ASSERT_NE(FuncInst, nullptr); + ASSERT_TRUE(FuncInst->isHostFunction()); auto &HostFuncAVCodecCtxChromaSampleLocation = FuncInst->getHostFunc(); @@ -1312,8 +1312,8 @@ TEST_F(FFmpegTest, AVCodecCtx) { FuncInst = AVCodecMod->findFuncExports( "wasmedge_ffmpeg_avcodec_avcodeccontext_frame_number"); - EXPECT_NE(FuncInst, nullptr); - EXPECT_TRUE(FuncInst->isHostFunction()); + ASSERT_NE(FuncInst, nullptr); + ASSERT_TRUE(FuncInst->isHostFunction()); auto &HostFuncAVCodecCtxFrameNumber = FuncInst->getHostFunc(); @@ -1326,8 +1326,8 @@ TEST_F(FFmpegTest, AVCodecCtx) { FuncInst = AVCodecMod->findFuncExports( "wasmedge_ffmpeg_avcodec_avcodeccontext_block_align"); - EXPECT_NE(FuncInst, nullptr); - EXPECT_TRUE(FuncInst->isHostFunction()); + ASSERT_NE(FuncInst, nullptr); + ASSERT_TRUE(FuncInst->isHostFunction()); auto &HostFuncAVCodecCtxBlockAlign = FuncInst->getHostFunc(); @@ -1340,8 +1340,8 @@ TEST_F(FFmpegTest, AVCodecCtx) { FuncInst = AVCodecMod->findFuncExports( "wasmedge_ffmpeg_avcodec_avcodeccontext_set_request_sample_fmt"); - EXPECT_NE(FuncInst, nullptr); - EXPECT_TRUE(FuncInst->isHostFunction()); + ASSERT_NE(FuncInst, nullptr); + ASSERT_TRUE(FuncInst->isHostFunction()); auto &HostFuncAVCodecCtxSetRequestSampleFmt = FuncInst->getHostFunc(); @@ -1355,8 +1355,8 @@ TEST_F(FFmpegTest, AVCodecCtx) { FuncInst = AVCodecMod->findFuncExports( "wasmedge_ffmpeg_avcodec_avcodeccontext_audio_service_type"); - EXPECT_NE(FuncInst, nullptr); - EXPECT_TRUE(FuncInst->isHostFunction()); + ASSERT_NE(FuncInst, nullptr); + ASSERT_TRUE(FuncInst->isHostFunction()); auto &HostFuncAVCodecCtxAudioServiceType = FuncInst->getHostFunc(); @@ -1369,8 +1369,8 @@ TEST_F(FFmpegTest, AVCodecCtx) { FuncInst = AVCodecMod->findFuncExports( "wasmedge_ffmpeg_avcodec_avcodeccontext_has_b_frames"); - EXPECT_NE(FuncInst, nullptr); - EXPECT_TRUE(FuncInst->isHostFunction()); + ASSERT_NE(FuncInst, nullptr); + ASSERT_TRUE(FuncInst->isHostFunction()); auto &HostFuncAVCodecCtxHasBFrames = FuncInst->getHostFunc(); @@ -1383,8 +1383,8 @@ TEST_F(FFmpegTest, AVCodecCtx) { FuncInst = AVCodecMod->findFuncExports( "wasmedge_ffmpeg_avcodec_avcodeccontext_active_thread_type"); - EXPECT_NE(FuncInst, nullptr); - EXPECT_TRUE(FuncInst->isHostFunction()); + ASSERT_NE(FuncInst, nullptr); + ASSERT_TRUE(FuncInst->isHostFunction()); auto &HostFuncAVCodecCtxActiveThreadType = FuncInst->getHostFunc(); @@ -1397,8 +1397,8 @@ TEST_F(FFmpegTest, AVCodecCtx) { FuncInst = AVCodecMod->findFuncExports( "wasmedge_ffmpeg_avcodec_avcodeccontext_set_thread_type"); - EXPECT_NE(FuncInst, nullptr); - EXPECT_TRUE(FuncInst->isHostFunction()); + ASSERT_NE(FuncInst, nullptr); + ASSERT_TRUE(FuncInst->isHostFunction()); auto &HostFuncAVCodecCtxSetThreadType = FuncInst->getHostFunc(); @@ -1413,8 +1413,8 @@ TEST_F(FFmpegTest, AVCodecCtx) { FuncInst = AVCodecMod->findFuncExports( "wasmedge_ffmpeg_avcodec_avcodeccontext_set_thread_count"); - EXPECT_NE(FuncInst, nullptr); - EXPECT_TRUE(FuncInst->isHostFunction()); + ASSERT_NE(FuncInst, nullptr); + ASSERT_TRUE(FuncInst->isHostFunction()); auto &HostFuncAVCodecCtxSetThreadCount = FuncInst->getHostFunc(); @@ -1429,8 +1429,8 @@ TEST_F(FFmpegTest, AVCodecCtx) { FuncInst = AVCodecMod->findFuncExports( "wasmedge_ffmpeg_avcodec_avcodeccontext_thread_count"); - EXPECT_NE(FuncInst, nullptr); - EXPECT_TRUE(FuncInst->isHostFunction()); + ASSERT_NE(FuncInst, nullptr); + ASSERT_TRUE(FuncInst->isHostFunction()); auto &HostFuncAVCodecCtxThreadCount = FuncInst->getHostFunc(); @@ -1443,8 +1443,8 @@ TEST_F(FFmpegTest, AVCodecCtx) { FuncInst = AVCodecMod->findFuncExports( "wasmedge_ffmpeg_avcodec_avcodeccontext_color_primaries"); - EXPECT_NE(FuncInst, nullptr); - EXPECT_TRUE(FuncInst->isHostFunction()); + ASSERT_NE(FuncInst, nullptr); + ASSERT_TRUE(FuncInst->isHostFunction()); auto &HostFuncAVCodecCtxColorPrimaries = FuncInst->getHostFunc(); diff --git a/test/plugins/wasmedge_ffmpeg/avcodec/avCodecParameters.cpp b/test/plugins/wasmedge_ffmpeg/avcodec/avCodecParameters.cpp index 1b1d83c2..3c15bd91 100644 --- a/test/plugins/wasmedge_ffmpeg/avcodec/avCodecParameters.cpp +++ b/test/plugins/wasmedge_ffmpeg/avcodec/avCodecParameters.cpp @@ -27,8 +27,8 @@ TEST_F(FFmpegTest, AVCodecParameters) { auto *FuncInst = AVCodecMod->findFuncExports( "wasmedge_ffmpeg_avcodec_avcodecparam_codec_id"); - EXPECT_NE(FuncInst, nullptr); - EXPECT_TRUE(FuncInst->isHostFunction()); + ASSERT_NE(FuncInst, nullptr); + ASSERT_TRUE(FuncInst->isHostFunction()); auto &HostFuncAVCodecParamCodecId = FuncInst->getHostFunc(); @@ -41,8 +41,8 @@ TEST_F(FFmpegTest, AVCodecParameters) { FuncInst = AVCodecMod->findFuncExports( "wasmedge_ffmpeg_avcodec_avcodecparam_codec_type"); - EXPECT_NE(FuncInst, nullptr); - EXPECT_TRUE(FuncInst->isHostFunction()); + ASSERT_NE(FuncInst, nullptr); + ASSERT_TRUE(FuncInst->isHostFunction()); auto &HostFuncAVCodecParamCodecType = FuncInst->getHostFunc(); @@ -55,8 +55,8 @@ TEST_F(FFmpegTest, AVCodecParameters) { FuncInst = AVCodecMod->findFuncExports( "wasmedge_ffmpeg_avcodec_avcodecparam_set_codec_tag"); - EXPECT_NE(FuncInst, nullptr); - EXPECT_TRUE(FuncInst->isHostFunction()); + ASSERT_NE(FuncInst, nullptr); + ASSERT_TRUE(FuncInst->isHostFunction()); auto &HostFuncAVCodecParamSetCodecTag = FuncInst->getHostFunc(); diff --git a/test/plugins/wasmedge_ffmpeg/avcodec/avPacket.cpp b/test/plugins/wasmedge_ffmpeg/avcodec/avPacket.cpp index f558dc2c..9b6ab307 100644 --- a/test/plugins/wasmedge_ffmpeg/avcodec/avPacket.cpp +++ b/test/plugins/wasmedge_ffmpeg/avcodec/avPacket.cpp @@ -23,8 +23,8 @@ TEST_F(FFmpegTest, AVPacketTest) { auto *FuncInst = AVCodecMod->findFuncExports("wasmedge_ffmpeg_avcodec_av_packet_alloc"); - EXPECT_NE(FuncInst, nullptr); - EXPECT_TRUE(FuncInst->isHostFunction()); + ASSERT_NE(FuncInst, nullptr); + ASSERT_TRUE(FuncInst->isHostFunction()); auto &HostFuncAVPacketAlloc = FuncInst->getHostFunc(); @@ -47,8 +47,8 @@ TEST_F(FFmpegTest, AVPacketTest) { FuncInst = AVCodecMod->findFuncExports("wasmedge_ffmpeg_avcodec_av_new_packet"); - EXPECT_NE(FuncInst, nullptr); - EXPECT_TRUE(FuncInst->isHostFunction()); + ASSERT_NE(FuncInst, nullptr); + ASSERT_TRUE(FuncInst->isHostFunction()); auto &HostFuncAVNewPacket = FuncInst->getHostFunc(); @@ -62,8 +62,8 @@ TEST_F(FFmpegTest, AVPacketTest) { FuncInst = AVCodecMod->findFuncExports("wasmedge_ffmpeg_avcodec_av_grow_packet"); - EXPECT_NE(FuncInst, nullptr); - EXPECT_TRUE(FuncInst->isHostFunction()); + ASSERT_NE(FuncInst, nullptr); + ASSERT_TRUE(FuncInst->isHostFunction()); auto &HostFuncAVGrowPacket = FuncInst->getHostFunc(); { @@ -76,8 +76,8 @@ TEST_F(FFmpegTest, AVPacketTest) { FuncInst = AVCodecMod->findFuncExports("wasmedge_ffmpeg_avcodec_av_shrink_packet"); - EXPECT_NE(FuncInst, nullptr); - EXPECT_TRUE(FuncInst->isHostFunction()); + ASSERT_NE(FuncInst, nullptr); + ASSERT_TRUE(FuncInst->isHostFunction()); auto &HostFuncAVShrinkPacket = FuncInst->getHostFunc(); { @@ -91,8 +91,8 @@ TEST_F(FFmpegTest, AVPacketTest) { uint32_t StreamIdx = 3; FuncInst = AVCodecMod->findFuncExports( "wasmedge_ffmpeg_avcodec_av_packet_set_stream_index"); - EXPECT_NE(FuncInst, nullptr); - EXPECT_TRUE(FuncInst->isHostFunction()); + ASSERT_NE(FuncInst, nullptr); + ASSERT_TRUE(FuncInst->isHostFunction()); auto &HostFuncAVPacketSetStreamIndex = FuncInst->getHostFunc(); { @@ -105,8 +105,8 @@ TEST_F(FFmpegTest, AVPacketTest) { FuncInst = AVCodecMod->findFuncExports( "wasmedge_ffmpeg_avcodec_av_packet_stream_index"); - EXPECT_NE(FuncInst, nullptr); - EXPECT_TRUE(FuncInst->isHostFunction()); + ASSERT_NE(FuncInst, nullptr); + ASSERT_TRUE(FuncInst->isHostFunction()); auto &HostFuncAVPacketStreamIndex = FuncInst->getHostFunc(); { @@ -119,8 +119,8 @@ TEST_F(FFmpegTest, AVPacketTest) { uint32_t Size = 0; FuncInst = AVCodecMod->findFuncExports("wasmedge_ffmpeg_avcodec_av_packet_size"); - EXPECT_NE(FuncInst, nullptr); - EXPECT_TRUE(FuncInst->isHostFunction()); + ASSERT_NE(FuncInst, nullptr); + ASSERT_TRUE(FuncInst->isHostFunction()); auto &HostFuncAVPacketSize = FuncInst->getHostFunc(); { @@ -135,8 +135,8 @@ TEST_F(FFmpegTest, AVPacketTest) { FuncInst = AVCodecMod->findFuncExports( "wasmedge_ffmpeg_avcodec_av_packet_set_flags"); - EXPECT_NE(FuncInst, nullptr); - EXPECT_TRUE(FuncInst->isHostFunction()); + ASSERT_NE(FuncInst, nullptr); + ASSERT_TRUE(FuncInst->isHostFunction()); auto &HostFuncAVPacketSetFlags = FuncInst->getHostFunc(); { @@ -148,8 +148,8 @@ TEST_F(FFmpegTest, AVPacketTest) { FuncInst = AVCodecMod->findFuncExports("wasmedge_ffmpeg_avcodec_av_packet_flags"); - EXPECT_NE(FuncInst, nullptr); - EXPECT_TRUE(FuncInst->isHostFunction()); + ASSERT_NE(FuncInst, nullptr); + ASSERT_TRUE(FuncInst->isHostFunction()); auto &HostFuncAVPacketFlags = FuncInst->getHostFunc(); { @@ -162,8 +162,8 @@ TEST_F(FFmpegTest, AVPacketTest) { int64_t Pos = 500; FuncInst = AVCodecMod->findFuncExports("wasmedge_ffmpeg_avcodec_av_packet_set_pos"); - EXPECT_NE(FuncInst, nullptr); - EXPECT_TRUE(FuncInst->isHostFunction()); + ASSERT_NE(FuncInst, nullptr); + ASSERT_TRUE(FuncInst->isHostFunction()); auto &HostFuncAVPacketSetPos = FuncInst->getHostFunc(); { @@ -175,8 +175,8 @@ TEST_F(FFmpegTest, AVPacketTest) { FuncInst = AVCodecMod->findFuncExports("wasmedge_ffmpeg_avcodec_av_packet_pos"); - EXPECT_NE(FuncInst, nullptr); - EXPECT_TRUE(FuncInst->isHostFunction()); + ASSERT_NE(FuncInst, nullptr); + ASSERT_TRUE(FuncInst->isHostFunction()); auto &HostFuncAVPacketPos = FuncInst->getHostFunc(); { @@ -189,8 +189,8 @@ TEST_F(FFmpegTest, AVPacketTest) { int64_t Duration = 100; FuncInst = AVCodecMod->findFuncExports( "wasmedge_ffmpeg_avcodec_av_packet_set_duration"); - EXPECT_NE(FuncInst, nullptr); - EXPECT_TRUE(FuncInst->isHostFunction()); + ASSERT_NE(FuncInst, nullptr); + ASSERT_TRUE(FuncInst->isHostFunction()); auto &HostFuncAVPacketSetDuration = FuncInst->getHostFunc(); { @@ -203,8 +203,8 @@ TEST_F(FFmpegTest, AVPacketTest) { FuncInst = AVCodecMod->findFuncExports("wasmedge_ffmpeg_avcodec_av_packet_duration"); - EXPECT_NE(FuncInst, nullptr); - EXPECT_TRUE(FuncInst->isHostFunction()); + ASSERT_NE(FuncInst, nullptr); + ASSERT_TRUE(FuncInst->isHostFunction()); auto &HostFuncAVPacketDuration = FuncInst->getHostFunc(); { @@ -217,8 +217,8 @@ TEST_F(FFmpegTest, AVPacketTest) { int64_t Dts = 1000; FuncInst = AVCodecMod->findFuncExports("wasmedge_ffmpeg_avcodec_av_packet_set_dts"); - EXPECT_NE(FuncInst, nullptr); - EXPECT_TRUE(FuncInst->isHostFunction()); + ASSERT_NE(FuncInst, nullptr); + ASSERT_TRUE(FuncInst->isHostFunction()); auto &HostFuncAVPacketSetDts = FuncInst->getHostFunc(); { @@ -230,8 +230,8 @@ TEST_F(FFmpegTest, AVPacketTest) { FuncInst = AVCodecMod->findFuncExports("wasmedge_ffmpeg_avcodec_av_packet_dts"); - EXPECT_NE(FuncInst, nullptr); - EXPECT_TRUE(FuncInst->isHostFunction()); + ASSERT_NE(FuncInst, nullptr); + ASSERT_TRUE(FuncInst->isHostFunction()); auto &HostFuncAVPacketDts = FuncInst->getHostFunc(); { @@ -244,8 +244,8 @@ TEST_F(FFmpegTest, AVPacketTest) { int64_t Pts = 5000; FuncInst = AVCodecMod->findFuncExports("wasmedge_ffmpeg_avcodec_av_packet_set_pts"); - EXPECT_NE(FuncInst, nullptr); - EXPECT_TRUE(FuncInst->isHostFunction()); + ASSERT_NE(FuncInst, nullptr); + ASSERT_TRUE(FuncInst->isHostFunction()); auto &HostFuncAVPacketSetPts = FuncInst->getHostFunc(); { @@ -257,8 +257,8 @@ TEST_F(FFmpegTest, AVPacketTest) { FuncInst = AVCodecMod->findFuncExports("wasmedge_ffmpeg_avcodec_av_packet_pts"); - EXPECT_NE(FuncInst, nullptr); - EXPECT_TRUE(FuncInst->isHostFunction()); + ASSERT_NE(FuncInst, nullptr); + ASSERT_TRUE(FuncInst->isHostFunction()); auto &HostFuncAVPacketPts = FuncInst->getHostFunc(); { @@ -270,8 +270,8 @@ TEST_F(FFmpegTest, AVPacketTest) { FuncInst = AVCodecMod->findFuncExports( "wasmedge_ffmpeg_avcodec_av_packet_is_data_null"); - EXPECT_NE(FuncInst, nullptr); - EXPECT_TRUE(FuncInst->isHostFunction()); + ASSERT_NE(FuncInst, nullptr); + ASSERT_TRUE(FuncInst->isHostFunction()); auto &HostFuncAVPacketIsDataNull = FuncInst->getHostFunc(); { @@ -283,8 +283,8 @@ TEST_F(FFmpegTest, AVPacketTest) { FuncInst = AVCodecMod->findFuncExports("wasmedge_ffmpeg_avcodec_av_packet_data"); - EXPECT_NE(FuncInst, nullptr); - EXPECT_TRUE(FuncInst->isHostFunction()); + ASSERT_NE(FuncInst, nullptr); + ASSERT_TRUE(FuncInst->isHostFunction()); auto &HostFuncAVPacketData = FuncInst->getHostFunc(); { @@ -297,8 +297,8 @@ TEST_F(FFmpegTest, AVPacketTest) { FuncInst = AVCodecMod->findFuncExports("wasmedge_ffmpeg_avcodec_av_packet_ref"); - EXPECT_NE(FuncInst, nullptr); - EXPECT_TRUE(FuncInst->isHostFunction()); + ASSERT_NE(FuncInst, nullptr); + ASSERT_TRUE(FuncInst->isHostFunction()); auto &HostFuncAVPacketRef = FuncInst->getHostFunc(); @@ -312,8 +312,8 @@ TEST_F(FFmpegTest, AVPacketTest) { FuncInst = AVCodecMod->findFuncExports("wasmedge_ffmpeg_avcodec_av_packet_unref"); - EXPECT_NE(FuncInst, nullptr); - EXPECT_TRUE(FuncInst->isHostFunction()); + ASSERT_NE(FuncInst, nullptr); + ASSERT_TRUE(FuncInst->isHostFunction()); auto &HostFuncAVPacketUnref = FuncInst->getHostFunc(); diff --git a/test/plugins/wasmedge_ffmpeg/avcodec/avcodec_func.cpp b/test/plugins/wasmedge_ffmpeg/avcodec/avcodec_func.cpp index 09816de3..5a2a2420 100644 --- a/test/plugins/wasmedge_ffmpeg/avcodec/avcodec_func.cpp +++ b/test/plugins/wasmedge_ffmpeg/avcodec/avcodec_func.cpp @@ -33,8 +33,8 @@ TEST_F(FFmpegTest, AVCodecFunc) { auto *FuncInst = AVCodecMod->findFuncExports( "wasmedge_ffmpeg_avcodec_avcodec_alloc_context3"); - EXPECT_NE(FuncInst, nullptr); - EXPECT_TRUE(FuncInst->isHostFunction()); + ASSERT_NE(FuncInst, nullptr); + ASSERT_TRUE(FuncInst->isHostFunction()); auto &HostFuncAVCodecAllocContext3 = FuncInst->getHostFunc(); @@ -51,8 +51,8 @@ TEST_F(FFmpegTest, AVCodecFunc) { FuncInst = AVCodecMod->findFuncExports( "wasmedge_ffmpeg_avcodec_avcodec_parameters_alloc"); - EXPECT_NE(FuncInst, nullptr); - EXPECT_TRUE(FuncInst->isHostFunction()); + ASSERT_NE(FuncInst, nullptr); + ASSERT_TRUE(FuncInst->isHostFunction()); auto &HostFuncAVCodecParametersAlloc = FuncInst->getHostFunc(); @@ -77,8 +77,8 @@ TEST_F(FFmpegTest, AVCodecFunc) { FuncInst = AVCodecMod->findFuncExports( "wasmedge_ffmpeg_avcodec_avcodec_parameters_from_context"sv); - EXPECT_NE(FuncInst, nullptr); - EXPECT_TRUE(FuncInst->isHostFunction()); + ASSERT_NE(FuncInst, nullptr); + ASSERT_TRUE(FuncInst->isHostFunction()); auto &HostFuncAVCodecParametersFromContext = FuncInst->getHostFunc(); @@ -94,8 +94,8 @@ TEST_F(FFmpegTest, AVCodecFunc) { FuncInst = AVCodecMod->findFuncExports("wasmedge_ffmpeg_avcodec_avcodec_get_type"); - EXPECT_NE(FuncInst, nullptr); - EXPECT_TRUE(FuncInst->isHostFunction()); + ASSERT_NE(FuncInst, nullptr); + ASSERT_TRUE(FuncInst->isHostFunction()); auto &HostFuncAVCodecGetType = FuncInst->getHostFunc(); @@ -108,8 +108,8 @@ TEST_F(FFmpegTest, AVCodecFunc) { FuncInst = AVCodecMod->findFuncExports( "wasmedge_ffmpeg_avcodec_avcodec_find_decoder"); - EXPECT_NE(FuncInst, nullptr); - EXPECT_TRUE(FuncInst->isHostFunction()); + ASSERT_NE(FuncInst, nullptr); + ASSERT_TRUE(FuncInst->isHostFunction()); auto &HostFuncAVCodecFindDecoder = FuncInst->getHostFunc(); @@ -127,8 +127,8 @@ TEST_F(FFmpegTest, AVCodecFunc) { FuncInst = AVCodecMod->findFuncExports( "wasmedge_ffmpeg_avcodec_avcodec_find_encoder"); - EXPECT_NE(FuncInst, nullptr); - EXPECT_TRUE(FuncInst->isHostFunction()); + ASSERT_NE(FuncInst, nullptr); + ASSERT_TRUE(FuncInst->isHostFunction()); auto &HostFuncAVCodecFindEncoder = FuncInst->getHostFunc(); @@ -146,8 +146,8 @@ TEST_F(FFmpegTest, AVCodecFunc) { FuncInst = AVCodecMod->findFuncExports("wasmedge_ffmpeg_avcodec_avcodec_open2"); - EXPECT_NE(FuncInst, nullptr); - EXPECT_TRUE(FuncInst->isHostFunction()); + ASSERT_NE(FuncInst, nullptr); + ASSERT_TRUE(FuncInst->isHostFunction()); auto &HostFuncAVCodecOpen2 = FuncInst->getHostFunc(); @@ -165,8 +165,8 @@ TEST_F(FFmpegTest, AVCodecFunc) { FuncInst = AVCodecMod->findFuncExports( "wasmedge_ffmpeg_avcodec_av_codec_is_encoder"); - EXPECT_NE(FuncInst, nullptr); - EXPECT_TRUE(FuncInst->isHostFunction()); + ASSERT_NE(FuncInst, nullptr); + ASSERT_TRUE(FuncInst->isHostFunction()); auto &HostFuncAVCodecIsEncoder = FuncInst->getHostFunc(); @@ -180,8 +180,8 @@ TEST_F(FFmpegTest, AVCodecFunc) { FuncInst = AVCodecMod->findFuncExports( "wasmedge_ffmpeg_avcodec_av_codec_is_decoder"); - EXPECT_NE(FuncInst, nullptr); - EXPECT_TRUE(FuncInst->isHostFunction()); + ASSERT_NE(FuncInst, nullptr); + ASSERT_TRUE(FuncInst->isHostFunction()); auto &HostFuncAVCodecIsDecoder = FuncInst->getHostFunc(); @@ -195,8 +195,8 @@ TEST_F(FFmpegTest, AVCodecFunc) { FuncInst = AVCodecMod->findFuncExports( "wasmedge_ffmpeg_avcodec_avcodec_find_decoder_by_name"); - EXPECT_NE(FuncInst, nullptr); - EXPECT_TRUE(FuncInst->isHostFunction()); + ASSERT_NE(FuncInst, nullptr); + ASSERT_TRUE(FuncInst->isHostFunction()); auto &HostFuncAVCodecFindDecoderByName = FuncInst->getHostFunc(); @@ -213,8 +213,8 @@ TEST_F(FFmpegTest, AVCodecFunc) { FuncInst = AVCodecMod->findFuncExports( "wasmedge_ffmpeg_avcodec_avcodec_find_encoder_by_name"); - EXPECT_NE(FuncInst, nullptr); - EXPECT_TRUE(FuncInst->isHostFunction()); + ASSERT_NE(FuncInst, nullptr); + ASSERT_TRUE(FuncInst->isHostFunction()); auto &HostFuncAVCodecFindEncoderByName = FuncInst->getHostFunc(); @@ -231,8 +231,8 @@ TEST_F(FFmpegTest, AVCodecFunc) { FuncInst = AVCodecMod->findFuncExports( "wasmedge_ffmpeg_avcodec_avcodec_parameters_to_context"); - EXPECT_NE(FuncInst, nullptr); - EXPECT_TRUE(FuncInst->isHostFunction()); + ASSERT_NE(FuncInst, nullptr); + ASSERT_TRUE(FuncInst->isHostFunction()); auto &HostFuncAVCodecParametersToContext = FuncInst->getHostFunc(); @@ -264,8 +264,8 @@ TEST_F(FFmpegTest, AVCodecFunc) { // } FuncInst = AVCodecMod->findFuncExports("wasmedge_ffmpeg_avcodec_avcodec_version"); - EXPECT_NE(FuncInst, nullptr); - EXPECT_TRUE(FuncInst->isHostFunction()); + ASSERT_NE(FuncInst, nullptr); + ASSERT_TRUE(FuncInst->isHostFunction()); auto &HostFuncAVCodecVersion = FuncInst->getHostFunc(); @@ -278,8 +278,8 @@ TEST_F(FFmpegTest, AVCodecFunc) { FuncInst = AVCodecMod->findFuncExports( "wasmedge_ffmpeg_avcodec_avcodec_configuration_length"); - EXPECT_NE(FuncInst, nullptr); - EXPECT_TRUE(FuncInst->isHostFunction()); + ASSERT_NE(FuncInst, nullptr); + ASSERT_TRUE(FuncInst->isHostFunction()); auto &HostFuncAVCodecConfigurationLength = FuncInst->getHostFunc(); @@ -294,8 +294,8 @@ TEST_F(FFmpegTest, AVCodecFunc) { FuncInst = AVCodecMod->findFuncExports( "wasmedge_ffmpeg_avcodec_avcodec_configuration"); - EXPECT_NE(FuncInst, nullptr); - EXPECT_TRUE(FuncInst->isHostFunction()); + ASSERT_NE(FuncInst, nullptr); + ASSERT_TRUE(FuncInst->isHostFunction()); auto &HostFuncAVCodecConfiguration = FuncInst->getHostFunc(); @@ -309,8 +309,8 @@ TEST_F(FFmpegTest, AVCodecFunc) { FuncInst = AVCodecMod->findFuncExports( "wasmedge_ffmpeg_avcodec_avcodec_license_length"); - EXPECT_NE(FuncInst, nullptr); - EXPECT_TRUE(FuncInst->isHostFunction()); + ASSERT_NE(FuncInst, nullptr); + ASSERT_TRUE(FuncInst->isHostFunction()); auto &HostFuncAVCodecLicenseLength = FuncInst->getHostFunc(); @@ -325,8 +325,8 @@ TEST_F(FFmpegTest, AVCodecFunc) { FuncInst = AVCodecMod->findFuncExports("wasmedge_ffmpeg_avcodec_avcodec_license"); - EXPECT_NE(FuncInst, nullptr); - EXPECT_TRUE(FuncInst->isHostFunction()); + ASSERT_NE(FuncInst, nullptr); + ASSERT_TRUE(FuncInst->isHostFunction()); auto &HostFuncAVCodecLicense = FuncInst->getHostFunc(); @@ -340,8 +340,8 @@ TEST_F(FFmpegTest, AVCodecFunc) { FuncInst = AVCodecMod->findFuncExports( "wasmedge_ffmpeg_avcodec_avcodec_free_context"); - EXPECT_NE(FuncInst, nullptr); - EXPECT_TRUE(FuncInst->isHostFunction()); + ASSERT_NE(FuncInst, nullptr); + ASSERT_TRUE(FuncInst->isHostFunction()); auto &HostFuncAVCodecFreeContext = FuncInst->getHostFunc(); @@ -355,8 +355,8 @@ TEST_F(FFmpegTest, AVCodecFunc) { FuncInst = AVCodecMod->findFuncExports( "wasmedge_ffmpeg_avcodec_avcodec_parameters_free"); - EXPECT_NE(FuncInst, nullptr); - EXPECT_TRUE(FuncInst->isHostFunction()); + ASSERT_NE(FuncInst, nullptr); + ASSERT_TRUE(FuncInst->isHostFunction()); auto &HostFuncAVCodecParametersFree = FuncInst->getHostFunc(); @@ -383,8 +383,8 @@ TEST_F(FFmpegTest, SendPacketReceiveFrame) { auto *FuncInst = AVCodecMod->findFuncExports("wasmedge_ffmpeg_avcodec_avcodec_send_frame"); - EXPECT_NE(FuncInst, nullptr); - EXPECT_TRUE(FuncInst->isHostFunction()); + ASSERT_NE(FuncInst, nullptr); + ASSERT_TRUE(FuncInst->isHostFunction()); auto &HostFuncAVCodecSendFrame = FuncInst->getHostFunc(); @@ -403,8 +403,8 @@ TEST_F(FFmpegTest, SendPacketReceiveFrame) { // Aim is to test the functionality. FuncInst = AVCodecMod->findFuncExports( "wasmedge_ffmpeg_avcodec_avcodec_receive_packet"); - EXPECT_NE(FuncInst, nullptr); - EXPECT_TRUE(FuncInst->isHostFunction()); + ASSERT_NE(FuncInst, nullptr); + ASSERT_TRUE(FuncInst->isHostFunction()); auto &HostFuncAVCodecReceivePacket = FuncInst->getHostFunc(); @@ -419,8 +419,8 @@ TEST_F(FFmpegTest, SendPacketReceiveFrame) { FuncInst = AVCodecMod->findFuncExports( "wasmedge_ffmpeg_avcodec_avcodec_send_packet"); - EXPECT_NE(FuncInst, nullptr); - EXPECT_TRUE(FuncInst->isHostFunction()); + ASSERT_NE(FuncInst, nullptr); + ASSERT_TRUE(FuncInst->isHostFunction()); auto &HostFuncAVCodecSendPacket = FuncInst->getHostFunc(); @@ -436,8 +436,8 @@ TEST_F(FFmpegTest, SendPacketReceiveFrame) { FuncInst = AVCodecMod->findFuncExports( "wasmedge_ffmpeg_avcodec_avcodec_receive_frame"); - EXPECT_NE(FuncInst, nullptr); - EXPECT_TRUE(FuncInst->isHostFunction()); + ASSERT_NE(FuncInst, nullptr); + ASSERT_TRUE(FuncInst->isHostFunction()); // Decoder Receives the Packet as Frame. auto &HostFuncAVCodecReceiveFrame = FuncInst->getHostFunc(); @@ -453,8 +453,8 @@ TEST_F(FFmpegTest, SendPacketReceiveFrame) { FuncInst = AVCodecMod->findFuncExports( "wasmedge_ffmpeg_avcodec_av_packet_rescale_ts"); - EXPECT_NE(FuncInst, nullptr); - EXPECT_TRUE(FuncInst->isHostFunction()); + ASSERT_NE(FuncInst, nullptr); + ASSERT_TRUE(FuncInst->isHostFunction()); auto &HostFuncAVPacketRescaleTs = FuncInst->getHostFunc(); @@ -474,8 +474,8 @@ TEST_F(FFmpegTest, SendPacketReceiveFrame) { FuncInst = AVCodecMod->findFuncExports( "wasmedge_ffmpeg_avcodec_av_packet_make_writable"); - EXPECT_NE(FuncInst, nullptr); - EXPECT_TRUE(FuncInst->isHostFunction()); + ASSERT_NE(FuncInst, nullptr); + ASSERT_TRUE(FuncInst->isHostFunction()); auto &HostFuncAVPacketMakeWritable = FuncInst->getHostFunc(); @@ -489,8 +489,8 @@ TEST_F(FFmpegTest, SendPacketReceiveFrame) { FuncInst = AVCodecMod->findFuncExports( "wasmedge_ffmpeg_avcodec_avcodec_flush_buffers"); - EXPECT_NE(FuncInst, nullptr); - EXPECT_TRUE(FuncInst->isHostFunction()); + ASSERT_NE(FuncInst, nullptr); + ASSERT_TRUE(FuncInst->isHostFunction()); auto &HostFuncAVCodecFlushBuffers = FuncInst->getHostFunc(); @@ -504,8 +504,8 @@ TEST_F(FFmpegTest, SendPacketReceiveFrame) { FuncInst = AVCodecMod->findFuncExports("wasmedge_ffmpeg_avcodec_avcodec_close"); - EXPECT_NE(FuncInst, nullptr); - EXPECT_TRUE(FuncInst->isHostFunction()); + ASSERT_NE(FuncInst, nullptr); + ASSERT_TRUE(FuncInst->isHostFunction()); auto &HostFuncAVCodecClose = FuncInst->getHostFunc(); diff --git a/test/plugins/wasmedge_ffmpeg/avfilter/avfilter.cpp b/test/plugins/wasmedge_ffmpeg/avfilter/avfilter.cpp index 7910e90b..5a719b5b 100644 --- a/test/plugins/wasmedge_ffmpeg/avfilter/avfilter.cpp +++ b/test/plugins/wasmedge_ffmpeg/avfilter/avfilter.cpp @@ -31,8 +31,8 @@ TEST_F(FFmpegTest, AVFilterStructs) { auto *FuncInst = AVFilterMod->findFuncExports( "wasmedge_ffmpeg_avfilter_avfilter_get_by_name"); - EXPECT_NE(FuncInst, nullptr); - EXPECT_TRUE(FuncInst->isHostFunction()); + ASSERT_NE(FuncInst, nullptr); + ASSERT_TRUE(FuncInst->isHostFunction()); auto &HostFuncAVFilterGetByName = FuncInst->getHostFunc(); @@ -54,8 +54,8 @@ TEST_F(FFmpegTest, AVFilterStructs) { FuncInst = AVFilterMod->findFuncExports( "wasmedge_ffmpeg_avfilter_avfilter_name_length"); - EXPECT_NE(FuncInst, nullptr); - EXPECT_TRUE(FuncInst->isHostFunction()); + ASSERT_NE(FuncInst, nullptr); + ASSERT_TRUE(FuncInst->isHostFunction()); auto &HostFuncAVFilterNameLength = FuncInst->getHostFunc(); @@ -70,8 +70,8 @@ TEST_F(FFmpegTest, AVFilterStructs) { FuncInst = AVFilterMod->findFuncExports("wasmedge_ffmpeg_avfilter_avfilter_name"); - EXPECT_NE(FuncInst, nullptr); - EXPECT_TRUE(FuncInst->isHostFunction()); + ASSERT_NE(FuncInst, nullptr); + ASSERT_TRUE(FuncInst->isHostFunction()); auto &HostFuncAVFilterName = FuncInst->getHostFunc(); @@ -86,8 +86,8 @@ TEST_F(FFmpegTest, AVFilterStructs) { FuncInst = AVFilterMod->findFuncExports( "wasmedge_ffmpeg_avfilter_avfilter_description_length"); - EXPECT_NE(FuncInst, nullptr); - EXPECT_TRUE(FuncInst->isHostFunction()); + ASSERT_NE(FuncInst, nullptr); + ASSERT_TRUE(FuncInst->isHostFunction()); auto &HostFuncAVFilterDescriptionLength = FuncInst->getHostFunc(); @@ -102,8 +102,8 @@ TEST_F(FFmpegTest, AVFilterStructs) { FuncInst = AVFilterMod->findFuncExports( "wasmedge_ffmpeg_avfilter_avfilter_description"); - EXPECT_NE(FuncInst, nullptr); - EXPECT_TRUE(FuncInst->isHostFunction()); + ASSERT_NE(FuncInst, nullptr); + ASSERT_TRUE(FuncInst->isHostFunction()); auto &HostFuncAVFilterDescription = FuncInst->getHostFunc(); @@ -118,8 +118,8 @@ TEST_F(FFmpegTest, AVFilterStructs) { FuncInst = AVFilterMod->findFuncExports( "wasmedge_ffmpeg_avfilter_avfilter_nb_inputs"); - EXPECT_NE(FuncInst, nullptr); - EXPECT_TRUE(FuncInst->isHostFunction()); + ASSERT_NE(FuncInst, nullptr); + ASSERT_TRUE(FuncInst->isHostFunction()); auto &HostFuncAVFilterNbInputs = FuncInst->getHostFunc(); @@ -132,8 +132,8 @@ TEST_F(FFmpegTest, AVFilterStructs) { FuncInst = AVFilterMod->findFuncExports( "wasmedge_ffmpeg_avfilter_avfilter_nb_outputs"); - EXPECT_NE(FuncInst, nullptr); - EXPECT_TRUE(FuncInst->isHostFunction()); + ASSERT_NE(FuncInst, nullptr); + ASSERT_TRUE(FuncInst->isHostFunction()); auto &HostFuncAVFilterNbOutputs = FuncInst->getHostFunc(); @@ -146,8 +146,8 @@ TEST_F(FFmpegTest, AVFilterStructs) { FuncInst = AVFilterMod->findFuncExports("wasmedge_ffmpeg_avfilter_avfilter_flags"); - EXPECT_NE(FuncInst, nullptr); - EXPECT_TRUE(FuncInst->isHostFunction()); + ASSERT_NE(FuncInst, nullptr); + ASSERT_TRUE(FuncInst->isHostFunction()); auto &HostFuncAVFilterFlags = FuncInst->getHostFunc(); @@ -160,8 +160,8 @@ TEST_F(FFmpegTest, AVFilterStructs) { FuncInst = AVFilterMod->findFuncExports( "wasmedge_ffmpeg_avfilter_avfilter_get_inputs_filter_pad"); - EXPECT_NE(FuncInst, nullptr); - EXPECT_TRUE(FuncInst->isHostFunction()); + ASSERT_NE(FuncInst, nullptr); + ASSERT_TRUE(FuncInst->isHostFunction()); auto &HostFuncAVFilterGetInputsFilterPad = FuncInst->getHostFunc(); @@ -176,8 +176,8 @@ TEST_F(FFmpegTest, AVFilterStructs) { FuncInst = AVFilterMod->findFuncExports( "wasmedge_ffmpeg_avfilter_avfilter_get_outputs_filter_pad"); - EXPECT_NE(FuncInst, nullptr); - EXPECT_TRUE(FuncInst->isHostFunction()); + ASSERT_NE(FuncInst, nullptr); + ASSERT_TRUE(FuncInst->isHostFunction()); auto &HostFuncAVFilterGetOutputsFilterPad = FuncInst->getHostFunc(); @@ -195,8 +195,8 @@ TEST_F(FFmpegTest, AVFilterStructs) { FuncInst = AVFilterMod->findFuncExports( "wasmedge_ffmpeg_avfilter_avfilter_pad_get_name_length"); - EXPECT_NE(FuncInst, nullptr); - EXPECT_TRUE(FuncInst->isHostFunction()); + ASSERT_NE(FuncInst, nullptr); + ASSERT_TRUE(FuncInst->isHostFunction()); auto &HostFuncAVFilterPadGetNameLength = FuncInst->getHostFunc(); @@ -211,8 +211,8 @@ TEST_F(FFmpegTest, AVFilterStructs) { FuncInst = AVFilterMod->findFuncExports( "wasmedge_ffmpeg_avfilter_avfilter_pad_get_name"); - EXPECT_NE(FuncInst, nullptr); - EXPECT_TRUE(FuncInst->isHostFunction()); + ASSERT_NE(FuncInst, nullptr); + ASSERT_TRUE(FuncInst->isHostFunction()); auto &HostFuncAVFilterPadGetName = FuncInst->getHostFunc(); @@ -228,8 +228,8 @@ TEST_F(FFmpegTest, AVFilterStructs) { FuncInst = AVFilterMod->findFuncExports( "wasmedge_ffmpeg_avfilter_avfilter_pad_get_type"); - EXPECT_NE(FuncInst, nullptr); - EXPECT_TRUE(FuncInst->isHostFunction()); + ASSERT_NE(FuncInst, nullptr); + ASSERT_TRUE(FuncInst->isHostFunction()); auto &HostFuncAVFilterPadGetType = FuncInst->getHostFunc(); @@ -244,8 +244,8 @@ TEST_F(FFmpegTest, AVFilterStructs) { FuncInst = AVFilterMod->findFuncExports( "wasmedge_ffmpeg_avfilter_avfilter_pad_drop"); - EXPECT_NE(FuncInst, nullptr); - EXPECT_TRUE(FuncInst->isHostFunction()); + ASSERT_NE(FuncInst, nullptr); + ASSERT_TRUE(FuncInst->isHostFunction()); auto &HostFuncAVFilterPadDrop = FuncInst->getHostFunc(); diff --git a/test/plugins/wasmedge_ffmpeg/avfilter/avfilter_func.cpp b/test/plugins/wasmedge_ffmpeg/avfilter/avfilter_func.cpp index ed40780a..ead1bd1d 100644 --- a/test/plugins/wasmedge_ffmpeg/avfilter/avfilter_func.cpp +++ b/test/plugins/wasmedge_ffmpeg/avfilter/avfilter_func.cpp @@ -60,8 +60,8 @@ TEST_F(FFmpegTest, AVFilterFunc) { auto *FuncInst = AVFilterMod->findFuncExports( "wasmedge_ffmpeg_avfilter_avfilter_graph_alloc"); - EXPECT_NE(FuncInst, nullptr); - EXPECT_TRUE(FuncInst->isHostFunction()); + ASSERT_NE(FuncInst, nullptr); + ASSERT_TRUE(FuncInst->isHostFunction()); auto &HostFuncAVFilterGraphAlloc = FuncInst->getHostFunc(); @@ -77,8 +77,8 @@ TEST_F(FFmpegTest, AVFilterFunc) { FuncInst = AVFilterMod->findFuncExports( "wasmedge_ffmpeg_avfilter_avfilter_get_by_name"); - EXPECT_NE(FuncInst, nullptr); - EXPECT_TRUE(FuncInst->isHostFunction()); + ASSERT_NE(FuncInst, nullptr); + ASSERT_TRUE(FuncInst->isHostFunction()); auto &HostFuncAVFilterGetByName = FuncInst->getHostFunc(); @@ -107,8 +107,8 @@ TEST_F(FFmpegTest, AVFilterFunc) { FuncInst = AVFilterMod->findFuncExports( "wasmedge_ffmpeg_avfilter_avfilter_graph_create_filter"); - EXPECT_NE(FuncInst, nullptr); - EXPECT_TRUE(FuncInst->isHostFunction()); + ASSERT_NE(FuncInst, nullptr); + ASSERT_TRUE(FuncInst->isHostFunction()); auto &HostFuncAVFilterGraphCreateFilter = FuncInst->getHostFunc(); @@ -137,8 +137,8 @@ TEST_F(FFmpegTest, AVFilterFunc) { FuncInst = AVFilterMod->findFuncExports( "wasmedge_ffmpeg_avfilter_avfilter_inout_alloc"); - EXPECT_NE(FuncInst, nullptr); - EXPECT_TRUE(FuncInst->isHostFunction()); + ASSERT_NE(FuncInst, nullptr); + ASSERT_TRUE(FuncInst->isHostFunction()); auto &HostFuncAVFilterInOutAlloc = FuncInst->getHostFunc(); @@ -162,8 +162,8 @@ TEST_F(FFmpegTest, AVFilterFunc) { FuncInst = AVFilterMod->findFuncExports( "wasmedge_ffmpeg_avfilter_avfilter_graph_get_filter"); - EXPECT_NE(FuncInst, nullptr); - EXPECT_TRUE(FuncInst->isHostFunction()); + ASSERT_NE(FuncInst, nullptr); + ASSERT_TRUE(FuncInst->isHostFunction()); auto &HostFuncAVFilterGraphGetFilter = FuncInst->getHostFunc(); @@ -197,8 +197,8 @@ TEST_F(FFmpegTest, AVFilterFunc) { FuncInst = AVFilterMod->findFuncExports( "wasmedge_ffmpeg_avfilter_avfilter_inout_set_name"); - EXPECT_NE(FuncInst, nullptr); - EXPECT_TRUE(FuncInst->isHostFunction()); + ASSERT_NE(FuncInst, nullptr); + ASSERT_TRUE(FuncInst->isHostFunction()); auto &HostFuncAVFilterInOutSetName = FuncInst->getHostFunc(); @@ -222,8 +222,8 @@ TEST_F(FFmpegTest, AVFilterFunc) { FuncInst = AVFilterMod->findFuncExports( "wasmedge_ffmpeg_avfilter_avfilter_inout_set_filter_ctx"); - EXPECT_NE(FuncInst, nullptr); - EXPECT_TRUE(FuncInst->isHostFunction()); + ASSERT_NE(FuncInst, nullptr); + ASSERT_TRUE(FuncInst->isHostFunction()); auto &HostFuncAVFilterInOutSetFilterCtx = FuncInst->getHostFunc(); @@ -245,8 +245,8 @@ TEST_F(FFmpegTest, AVFilterFunc) { FuncInst = AVFilterMod->findFuncExports( "wasmedge_ffmpeg_avfilter_avfilter_inout_set_pad_idx"); - EXPECT_NE(FuncInst, nullptr); - EXPECT_TRUE(FuncInst->isHostFunction()); + ASSERT_NE(FuncInst, nullptr); + ASSERT_TRUE(FuncInst->isHostFunction()); auto &HostFuncAVFilterInOutSetPadIdx = FuncInst->getHostFunc(); @@ -264,8 +264,8 @@ TEST_F(FFmpegTest, AVFilterFunc) { FuncInst = AVFilterMod->findFuncExports( "wasmedge_ffmpeg_avfilter_avfilter_inout_set_next"); - EXPECT_NE(FuncInst, nullptr); - EXPECT_TRUE(FuncInst->isHostFunction()); + ASSERT_NE(FuncInst, nullptr); + ASSERT_TRUE(FuncInst->isHostFunction()); auto &HostFuncAVFilterInOutSetNext = FuncInst->getHostFunc(); @@ -287,8 +287,8 @@ TEST_F(FFmpegTest, AVFilterFunc) { FuncInst = AVFilterMod->findFuncExports( "wasmedge_ffmpeg_avfilter_avfilter_graph_parse_ptr"); - EXPECT_NE(FuncInst, nullptr); - EXPECT_TRUE(FuncInst->isHostFunction()); + ASSERT_NE(FuncInst, nullptr); + ASSERT_TRUE(FuncInst->isHostFunction()); auto &HostFuncAVFilterGraphParsePtr = FuncInst->getHostFunc(); @@ -304,8 +304,8 @@ TEST_F(FFmpegTest, AVFilterFunc) { FuncInst = AVFilterMod->findFuncExports( "wasmedge_ffmpeg_avfilter_avfilter_graph_config"); - EXPECT_NE(FuncInst, nullptr); - EXPECT_TRUE(FuncInst->isHostFunction()); + ASSERT_NE(FuncInst, nullptr); + ASSERT_TRUE(FuncInst->isHostFunction()); auto &HostFuncAVFilterGraphConfig = FuncInst->getHostFunc(); @@ -318,8 +318,8 @@ TEST_F(FFmpegTest, AVFilterFunc) { FuncInst = AVFilterMod->findFuncExports( "wasmedge_ffmpeg_avfilter_avfilter_graph_dump_length"); - EXPECT_NE(FuncInst, nullptr); - EXPECT_TRUE(FuncInst->isHostFunction()); + ASSERT_NE(FuncInst, nullptr); + ASSERT_TRUE(FuncInst->isHostFunction()); auto &HostFuncAVFilterGraphDumpLength = FuncInst->getHostFunc(); @@ -334,8 +334,8 @@ TEST_F(FFmpegTest, AVFilterFunc) { FuncInst = AVFilterMod->findFuncExports( "wasmedge_ffmpeg_avfilter_avfilter_graph_dump"); - EXPECT_NE(FuncInst, nullptr); - EXPECT_TRUE(FuncInst->isHostFunction()); + ASSERT_NE(FuncInst, nullptr); + ASSERT_TRUE(FuncInst->isHostFunction()); auto &HostFuncAVFilterGraphDump = FuncInst->getHostFunc(); @@ -376,8 +376,8 @@ TEST_F(FFmpegTest, AVFilterFunc) { FuncInst = AVFilterMod->findFuncExports("wasmedge_ffmpeg_avfilter_avfilter_version"); - EXPECT_NE(FuncInst, nullptr); - EXPECT_TRUE(FuncInst->isHostFunction()); + ASSERT_NE(FuncInst, nullptr); + ASSERT_TRUE(FuncInst->isHostFunction()); auto &HostFuncAVFilterVersion = FuncInst->getHostFunc(); @@ -389,8 +389,8 @@ TEST_F(FFmpegTest, AVFilterFunc) { FuncInst = AVFilterMod->findFuncExports( "wasmedge_ffmpeg_avfilter_avfilter_configuration_length"); - EXPECT_NE(FuncInst, nullptr); - EXPECT_TRUE(FuncInst->isHostFunction()); + ASSERT_NE(FuncInst, nullptr); + ASSERT_TRUE(FuncInst->isHostFunction()); auto &HostFuncAVFilterConfigurationLength = FuncInst->getHostFunc(); @@ -404,8 +404,8 @@ TEST_F(FFmpegTest, AVFilterFunc) { FuncInst = AVFilterMod->findFuncExports( "wasmedge_ffmpeg_avfilter_avfilter_configuration"); - EXPECT_NE(FuncInst, nullptr); - EXPECT_TRUE(FuncInst->isHostFunction()); + ASSERT_NE(FuncInst, nullptr); + ASSERT_TRUE(FuncInst->isHostFunction()); auto &HostFuncAVFilterConfiguration = FuncInst->getHostFunc(); @@ -418,8 +418,8 @@ TEST_F(FFmpegTest, AVFilterFunc) { FuncInst = AVFilterMod->findFuncExports( "wasmedge_ffmpeg_avfilter_avfilter_license_length"); - EXPECT_NE(FuncInst, nullptr); - EXPECT_TRUE(FuncInst->isHostFunction()); + ASSERT_NE(FuncInst, nullptr); + ASSERT_TRUE(FuncInst->isHostFunction()); auto &HostFuncAVFilterLicenseLength = FuncInst->getHostFunc(); @@ -432,8 +432,8 @@ TEST_F(FFmpegTest, AVFilterFunc) { FuncInst = AVFilterMod->findFuncExports("wasmedge_ffmpeg_avfilter_avfilter_license"); - EXPECT_NE(FuncInst, nullptr); - EXPECT_TRUE(FuncInst->isHostFunction()); + ASSERT_NE(FuncInst, nullptr); + ASSERT_TRUE(FuncInst->isHostFunction()); auto &HostFuncAVFilterLicense = FuncInst->getHostFunc(); @@ -450,8 +450,8 @@ TEST_F(FFmpegTest, AVFilterFunc) { FuncInst = AVFilterMod->findFuncExports( "wasmedge_ffmpeg_avfilter_av_buffersrc_get_nb_failed_requests"); - EXPECT_NE(FuncInst, nullptr); - EXPECT_TRUE(FuncInst->isHostFunction()); + ASSERT_NE(FuncInst, nullptr); + ASSERT_TRUE(FuncInst->isHostFunction()); auto &HostFuncAVBufferSrcGetNbFailedRequests = FuncInst->getHostFunc(); @@ -464,8 +464,8 @@ TEST_F(FFmpegTest, AVFilterFunc) { FuncInst = AVFilterMod->findFuncExports( "wasmedge_ffmpeg_avfilter_av_buffersrc_add_frame"); - EXPECT_NE(FuncInst, nullptr); - EXPECT_TRUE(FuncInst->isHostFunction()); + ASSERT_NE(FuncInst, nullptr); + ASSERT_TRUE(FuncInst->isHostFunction()); auto &HostFuncAVBufferSrcAddFrame = FuncInst->getHostFunc(); @@ -505,8 +505,8 @@ TEST_F(FFmpegTest, AVFilterFunc) { // due to no frames present. FuncInst = AVFilterMod->findFuncExports( "wasmedge_ffmpeg_avfilter_av_buffersink_get_frame"); - EXPECT_NE(FuncInst, nullptr); - EXPECT_TRUE(FuncInst->isHostFunction()); + ASSERT_NE(FuncInst, nullptr); + ASSERT_TRUE(FuncInst->isHostFunction()); auto &HostFuncAVBufferSinkGetFrame = FuncInst->getHostFunc(); @@ -520,8 +520,8 @@ TEST_F(FFmpegTest, AVFilterFunc) { FuncInst = AVFilterMod->findFuncExports( "wasmedge_ffmpeg_avfilter_av_buffersink_get_samples"); - EXPECT_NE(FuncInst, nullptr); - EXPECT_TRUE(FuncInst->isHostFunction()); + ASSERT_NE(FuncInst, nullptr); + ASSERT_TRUE(FuncInst->isHostFunction()); auto &HostFuncAVBufferSinkGetSamples = FuncInst->getHostFunc(); @@ -538,8 +538,8 @@ TEST_F(FFmpegTest, AVFilterFunc) { FuncInst = AVFilterMod->findFuncExports( "wasmedge_ffmpeg_avfilter_av_buffersink_set_frame_size"); - EXPECT_NE(FuncInst, nullptr); - EXPECT_TRUE(FuncInst->isHostFunction()); + ASSERT_NE(FuncInst, nullptr); + ASSERT_TRUE(FuncInst->isHostFunction()); auto &HostFuncAvBufferSinkSetFrameSize = FuncInst->getHostFunc(); @@ -561,8 +561,8 @@ TEST_F(FFmpegTest, AVFilterFunc) { FuncInst = AVFilterMod->findFuncExports( "wasmedge_ffmpeg_avfilter_avfilter_free_graph_str"); - EXPECT_NE(FuncInst, nullptr); - EXPECT_TRUE(FuncInst->isHostFunction()); + ASSERT_NE(FuncInst, nullptr); + ASSERT_TRUE(FuncInst->isHostFunction()); auto &HostFuncAVFilterFreeGraphStr = FuncInst->getHostFunc(); @@ -575,8 +575,8 @@ TEST_F(FFmpegTest, AVFilterFunc) { FuncInst = AVFilterMod->findFuncExports("wasmedge_ffmpeg_avfilter_avfilter_drop"); - EXPECT_NE(FuncInst, nullptr); - EXPECT_TRUE(FuncInst->isHostFunction()); + ASSERT_NE(FuncInst, nullptr); + ASSERT_TRUE(FuncInst->isHostFunction()); auto &HostFuncAVFilterDrop = FuncInst->getHostFunc(); @@ -589,8 +589,8 @@ TEST_F(FFmpegTest, AVFilterFunc) { FuncInst = AVFilterMod->findFuncExports( "wasmedge_ffmpeg_avfilter_avfilter_context_drop"); - EXPECT_NE(FuncInst, nullptr); - EXPECT_TRUE(FuncInst->isHostFunction()); + ASSERT_NE(FuncInst, nullptr); + ASSERT_TRUE(FuncInst->isHostFunction()); auto &HostFuncAVFilterContextDrop = FuncInst->getHostFunc(); @@ -609,8 +609,8 @@ TEST_F(FFmpegTest, AVFilterFunc) { FuncInst = AVFilterMod->findFuncExports( "wasmedge_ffmpeg_avfilter_avfilter_graph_free"); - EXPECT_NE(FuncInst, nullptr); - EXPECT_TRUE(FuncInst->isHostFunction()); + ASSERT_NE(FuncInst, nullptr); + ASSERT_TRUE(FuncInst->isHostFunction()); auto &HostFuncAVFilterGraphFree = FuncInst->getHostFunc(); diff --git a/test/plugins/wasmedge_ffmpeg/avformat/avChapter.cpp b/test/plugins/wasmedge_ffmpeg/avformat/avChapter.cpp index 85c14325..95f38262 100644 --- a/test/plugins/wasmedge_ffmpeg/avformat/avChapter.cpp +++ b/test/plugins/wasmedge_ffmpeg/avformat/avChapter.cpp @@ -30,8 +30,8 @@ TEST_F(FFmpegTest, AVChapter) { auto *FuncInst = AVFormatMod->findFuncExports("wasmedge_ffmpeg_avformat_avChapter_id"); - EXPECT_NE(FuncInst, nullptr); - EXPECT_TRUE(FuncInst->isHostFunction()); + ASSERT_NE(FuncInst, nullptr); + ASSERT_TRUE(FuncInst->isHostFunction()); auto &HostFuncAVChapterId = FuncInst->getHostFunc(); { @@ -44,8 +44,8 @@ TEST_F(FFmpegTest, AVChapter) { FuncInst = AVFormatMod->findFuncExports( "wasmedge_ffmpeg_avformat_avChapter_timebase"); - EXPECT_NE(FuncInst, nullptr); - EXPECT_TRUE(FuncInst->isHostFunction()); + ASSERT_NE(FuncInst, nullptr); + ASSERT_TRUE(FuncInst->isHostFunction()); auto &HostFuncAVChapterTimebase = FuncInst->getHostFunc(); { @@ -61,8 +61,8 @@ TEST_F(FFmpegTest, AVChapter) { FuncInst = AVFormatMod->findFuncExports("wasmedge_ffmpeg_avformat_avChapter_start"); - EXPECT_NE(FuncInst, nullptr); - EXPECT_TRUE(FuncInst->isHostFunction()); + ASSERT_NE(FuncInst, nullptr); + ASSERT_TRUE(FuncInst->isHostFunction()); auto &HostFuncAVChapterStart = FuncInst->getHostFunc(); { @@ -75,8 +75,8 @@ TEST_F(FFmpegTest, AVChapter) { FuncInst = AVFormatMod->findFuncExports("wasmedge_ffmpeg_avformat_avChapter_end"); - EXPECT_NE(FuncInst, nullptr); - EXPECT_TRUE(FuncInst->isHostFunction()); + ASSERT_NE(FuncInst, nullptr); + ASSERT_TRUE(FuncInst->isHostFunction()); auto &HostFuncAVChapterEnd = FuncInst->getHostFunc(); { @@ -89,8 +89,8 @@ TEST_F(FFmpegTest, AVChapter) { FuncInst = AVFormatMod->findFuncExports( "wasmedge_ffmpeg_avformat_avChapter_metadata"); - EXPECT_NE(FuncInst, nullptr); - EXPECT_TRUE(FuncInst->isHostFunction()); + ASSERT_NE(FuncInst, nullptr); + ASSERT_TRUE(FuncInst->isHostFunction()); auto &HostFuncAVChapterMetadata = FuncInst->getHostFunc(); { @@ -105,8 +105,8 @@ TEST_F(FFmpegTest, AVChapter) { FuncInst = AVFormatMod->findFuncExports("wasmedge_ffmpeg_avformat_avChapter_set_id"); - EXPECT_NE(FuncInst, nullptr); - EXPECT_TRUE(FuncInst->isHostFunction()); + ASSERT_NE(FuncInst, nullptr); + ASSERT_TRUE(FuncInst->isHostFunction()); auto &HostFuncAVChapterSetId = FuncInst->getHostFunc(); { @@ -128,8 +128,8 @@ TEST_F(FFmpegTest, AVChapter) { FuncInst = AVFormatMod->findFuncExports( "wasmedge_ffmpeg_avformat_avChapter_set_timebase"); - EXPECT_NE(FuncInst, nullptr); - EXPECT_TRUE(FuncInst->isHostFunction()); + ASSERT_NE(FuncInst, nullptr); + ASSERT_TRUE(FuncInst->isHostFunction()); auto &HostFuncAVChapterSetTimebase = FuncInst->getHostFunc(); { @@ -155,8 +155,8 @@ TEST_F(FFmpegTest, AVChapter) { FuncInst = AVFormatMod->findFuncExports( "wasmedge_ffmpeg_avformat_avChapter_set_start"); - EXPECT_NE(FuncInst, nullptr); - EXPECT_TRUE(FuncInst->isHostFunction()); + ASSERT_NE(FuncInst, nullptr); + ASSERT_TRUE(FuncInst->isHostFunction()); auto &HostFuncAVChapterSetStart = FuncInst->getHostFunc(); { @@ -178,8 +178,8 @@ TEST_F(FFmpegTest, AVChapter) { FuncInst = AVFormatMod->findFuncExports( "wasmedge_ffmpeg_avformat_avChapter_set_end"); - EXPECT_NE(FuncInst, nullptr); - EXPECT_TRUE(FuncInst->isHostFunction()); + ASSERT_NE(FuncInst, nullptr); + ASSERT_TRUE(FuncInst->isHostFunction()); auto &HostFuncAVChapterSetEnd = FuncInst->getHostFunc(); { diff --git a/test/plugins/wasmedge_ffmpeg/avformat/avInputOutputContext.cpp b/test/plugins/wasmedge_ffmpeg/avformat/avInputOutputContext.cpp index cad99021..0211fe4c 100644 --- a/test/plugins/wasmedge_ffmpeg/avformat/avInputOutputContext.cpp +++ b/test/plugins/wasmedge_ffmpeg/avformat/avInputOutputContext.cpp @@ -30,8 +30,8 @@ TEST_F(FFmpegTest, AVInputFormat) { auto *FuncInst = AVFormatMod->findFuncExports( "wasmedge_ffmpeg_avformat_avformatContext_iformat"); - EXPECT_NE(FuncInst, nullptr); - EXPECT_TRUE(FuncInst->isHostFunction()); + ASSERT_NE(FuncInst, nullptr); + ASSERT_TRUE(FuncInst->isHostFunction()); auto &HostFuncAVFormatCtxIFormat = FuncInst->getHostFunc(); { @@ -51,8 +51,8 @@ TEST_F(FFmpegTest, AVInputFormat) { FuncInst = AVFormatMod->findFuncExports( "wasmedge_ffmpeg_avformat_avIOFormat_name_length"); - EXPECT_NE(FuncInst, nullptr); - EXPECT_TRUE(FuncInst->isHostFunction()); + ASSERT_NE(FuncInst, nullptr); + ASSERT_TRUE(FuncInst->isHostFunction()); auto &HostFuncAVIOFormatNameLength = FuncInst->getHostFunc(); int32_t Length = 0; @@ -66,8 +66,8 @@ TEST_F(FFmpegTest, AVInputFormat) { FuncInst = AVFormatMod->findFuncExports( "wasmedge_ffmpeg_avformat_avInputFormat_name"); - EXPECT_NE(FuncInst, nullptr); - EXPECT_TRUE(FuncInst->isHostFunction()); + ASSERT_NE(FuncInst, nullptr); + ASSERT_TRUE(FuncInst->isHostFunction()); auto &HostFuncAVInputFormatName = FuncInst->getHostFunc(); fillMemContent(MemInst, StrBuf, Length); @@ -82,8 +82,8 @@ TEST_F(FFmpegTest, AVInputFormat) { FuncInst = AVFormatMod->findFuncExports( "wasmedge_ffmpeg_avformat_avIOFormat_long_name_length"); - EXPECT_NE(FuncInst, nullptr); - EXPECT_TRUE(FuncInst->isHostFunction()); + ASSERT_NE(FuncInst, nullptr); + ASSERT_TRUE(FuncInst->isHostFunction()); auto &HostFuncAVIOFormatLongNameLength = FuncInst->getHostFunc(); { @@ -97,8 +97,8 @@ TEST_F(FFmpegTest, AVInputFormat) { FuncInst = AVFormatMod->findFuncExports( "wasmedge_ffmpeg_avformat_avInputFormat_long_name"); - EXPECT_NE(FuncInst, nullptr); - EXPECT_TRUE(FuncInst->isHostFunction()); + ASSERT_NE(FuncInst, nullptr); + ASSERT_TRUE(FuncInst->isHostFunction()); auto &HostFuncAVInputFormatLongName = FuncInst->getHostFunc(); { @@ -113,8 +113,8 @@ TEST_F(FFmpegTest, AVInputFormat) { FuncInst = AVFormatMod->findFuncExports( "wasmedge_ffmpeg_avformat_avIOFormat_extensions_length"); - EXPECT_NE(FuncInst, nullptr); - EXPECT_TRUE(FuncInst->isHostFunction()); + ASSERT_NE(FuncInst, nullptr); + ASSERT_TRUE(FuncInst->isHostFunction()); auto &HostFuncAVIOFormatExtensionsLength = FuncInst->getHostFunc(); { @@ -128,8 +128,8 @@ TEST_F(FFmpegTest, AVInputFormat) { FuncInst = AVFormatMod->findFuncExports( "wasmedge_ffmpeg_avformat_avInputFormat_extensions"); - EXPECT_NE(FuncInst, nullptr); - EXPECT_TRUE(FuncInst->isHostFunction()); + ASSERT_NE(FuncInst, nullptr); + ASSERT_TRUE(FuncInst->isHostFunction()); auto &HostFuncAVInputFormatExtensions = FuncInst->getHostFunc(); { @@ -143,8 +143,8 @@ TEST_F(FFmpegTest, AVInputFormat) { FuncInst = AVFormatMod->findFuncExports( "wasmedge_ffmpeg_avformat_avIOFormat_mime_type_length"); - EXPECT_NE(FuncInst, nullptr); - EXPECT_TRUE(FuncInst->isHostFunction()); + ASSERT_NE(FuncInst, nullptr); + ASSERT_TRUE(FuncInst->isHostFunction()); auto &HostFuncAVIOFormatMimeTypeLength = FuncInst->getHostFunc(); { @@ -158,8 +158,8 @@ TEST_F(FFmpegTest, AVInputFormat) { FuncInst = AVFormatMod->findFuncExports( "wasmedge_ffmpeg_avformat_avInputFormat_mime_type"); - EXPECT_NE(FuncInst, nullptr); - EXPECT_TRUE(FuncInst->isHostFunction()); + ASSERT_NE(FuncInst, nullptr); + ASSERT_TRUE(FuncInst->isHostFunction()); auto &HostFuncAVInputFormatMimeType = FuncInst->getHostFunc(); { @@ -173,8 +173,8 @@ TEST_F(FFmpegTest, AVInputFormat) { FuncInst = AVFormatMod->findFuncExports( "wasmedge_ffmpeg_avformat_avInputOutputFormat_free"); - EXPECT_NE(FuncInst, nullptr); - EXPECT_TRUE(FuncInst->isHostFunction()); + ASSERT_NE(FuncInst, nullptr); + ASSERT_TRUE(FuncInst->isHostFunction()); auto &HostFuncAVInputOutputFormatFree = FuncInst->getHostFunc(); { diff --git a/test/plugins/wasmedge_ffmpeg/avformat/avStream.cpp b/test/plugins/wasmedge_ffmpeg/avformat/avStream.cpp index ccb1b63e..b3b9a187 100644 --- a/test/plugins/wasmedge_ffmpeg/avformat/avStream.cpp +++ b/test/plugins/wasmedge_ffmpeg/avformat/avStream.cpp @@ -31,8 +31,8 @@ TEST_F(FFmpegTest, AVStreamStruct) { auto *FuncInst = AVFormatMod->findFuncExports("wasmedge_ffmpeg_avformat_avStream_id"); - EXPECT_NE(FuncInst, nullptr); - EXPECT_TRUE(FuncInst->isHostFunction()); + ASSERT_NE(FuncInst, nullptr); + ASSERT_TRUE(FuncInst->isHostFunction()); auto &HostFuncAVStreamId = FuncInst->getHostFunc(); uint32_t AvFormatCtxId = readUInt32(MemInst, FormatCtxPtr); @@ -46,8 +46,8 @@ TEST_F(FFmpegTest, AVStreamStruct) { FuncInst = AVFormatMod->findFuncExports("wasmedge_ffmpeg_avformat_avStream_index"); - EXPECT_NE(FuncInst, nullptr); - EXPECT_TRUE(FuncInst->isHostFunction()); + ASSERT_NE(FuncInst, nullptr); + ASSERT_TRUE(FuncInst->isHostFunction()); auto &HostFuncAVStreamIndex = FuncInst->getHostFunc(); { @@ -60,8 +60,8 @@ TEST_F(FFmpegTest, AVStreamStruct) { FuncInst = AVFormatMod->findFuncExports( "wasmedge_ffmpeg_avformat_avStream_codecpar"); - EXPECT_NE(FuncInst, nullptr); - EXPECT_TRUE(FuncInst->isHostFunction()); + ASSERT_NE(FuncInst, nullptr); + ASSERT_TRUE(FuncInst->isHostFunction()); auto &HostFuncAVStreamCodecPar = FuncInst->getHostFunc(); { @@ -76,14 +76,14 @@ TEST_F(FFmpegTest, AVStreamStruct) { FuncInst = AVFormatMod->findFuncExports( "wasmedge_ffmpeg_avformat_avStream_timebase"); - EXPECT_NE(FuncInst, nullptr); - EXPECT_TRUE(FuncInst->isHostFunction()); + ASSERT_NE(FuncInst, nullptr); + ASSERT_TRUE(FuncInst->isHostFunction()); auto &HostFuncAVStreamTimebase = FuncInst->getHostFunc(); FuncInst = AVFormatMod->findFuncExports( "wasmedge_ffmpeg_avformat_avStream_set_timebase"); - EXPECT_NE(FuncInst, nullptr); - EXPECT_TRUE(FuncInst->isHostFunction()); + ASSERT_NE(FuncInst, nullptr); + ASSERT_TRUE(FuncInst->isHostFunction()); auto &HostFuncAVStreamSetTimebase = FuncInst->getHostFunc(); { @@ -108,8 +108,8 @@ TEST_F(FFmpegTest, AVStreamStruct) { FuncInst = AVFormatMod->findFuncExports( "wasmedge_ffmpeg_avformat_avStream_duration"); - EXPECT_NE(FuncInst, nullptr); - EXPECT_TRUE(FuncInst->isHostFunction()); + ASSERT_NE(FuncInst, nullptr); + ASSERT_TRUE(FuncInst->isHostFunction()); auto &HostFuncAVStreamDuration = FuncInst->getHostFunc(); { @@ -122,8 +122,8 @@ TEST_F(FFmpegTest, AVStreamStruct) { FuncInst = AVFormatMod->findFuncExports( "wasmedge_ffmpeg_avformat_avStream_start_time"); - EXPECT_NE(FuncInst, nullptr); - EXPECT_TRUE(FuncInst->isHostFunction()); + ASSERT_NE(FuncInst, nullptr); + ASSERT_TRUE(FuncInst->isHostFunction()); auto &HostFuncAVStreamStartTime = FuncInst->getHostFunc(); { @@ -136,8 +136,8 @@ TEST_F(FFmpegTest, AVStreamStruct) { FuncInst = AVFormatMod->findFuncExports( "wasmedge_ffmpeg_avformat_avStream_nb_frames"); - EXPECT_NE(FuncInst, nullptr); - EXPECT_TRUE(FuncInst->isHostFunction()); + ASSERT_NE(FuncInst, nullptr); + ASSERT_TRUE(FuncInst->isHostFunction()); auto &HostFuncAVStreamNbFrames = FuncInst->getHostFunc(); { @@ -150,8 +150,8 @@ TEST_F(FFmpegTest, AVStreamStruct) { FuncInst = AVFormatMod->findFuncExports( "wasmedge_ffmpeg_avformat_avStream_disposition"); - EXPECT_NE(FuncInst, nullptr); - EXPECT_TRUE(FuncInst->isHostFunction()); + ASSERT_NE(FuncInst, nullptr); + ASSERT_TRUE(FuncInst->isHostFunction()); auto &HostFuncAVStreamDisposition = FuncInst->getHostFunc(); { @@ -164,14 +164,14 @@ TEST_F(FFmpegTest, AVStreamStruct) { FuncInst = AVFormatMod->findFuncExports( "wasmedge_ffmpeg_avformat_avStream_set_r_frame_rate"); - EXPECT_NE(FuncInst, nullptr); - EXPECT_TRUE(FuncInst->isHostFunction()); + ASSERT_NE(FuncInst, nullptr); + ASSERT_TRUE(FuncInst->isHostFunction()); auto &HostFuncAVStreamSetRFrameRate = FuncInst->getHostFunc(); FuncInst = AVFormatMod->findFuncExports( "wasmedge_ffmpeg_avformat_avStream_r_frame_rate"); - EXPECT_NE(FuncInst, nullptr); - EXPECT_TRUE(FuncInst->isHostFunction()); + ASSERT_NE(FuncInst, nullptr); + ASSERT_TRUE(FuncInst->isHostFunction()); auto &HostFuncAVStreamRFrameRate = FuncInst->getHostFunc(); { @@ -196,14 +196,14 @@ TEST_F(FFmpegTest, AVStreamStruct) { FuncInst = AVFormatMod->findFuncExports( "wasmedge_ffmpeg_avformat_avStream_set_avg_frame_rate"); - EXPECT_NE(FuncInst, nullptr); - EXPECT_TRUE(FuncInst->isHostFunction()); + ASSERT_NE(FuncInst, nullptr); + ASSERT_TRUE(FuncInst->isHostFunction()); auto &HostFuncAVStreamSetAvgFrameRate = FuncInst->getHostFunc(); FuncInst = AVFormatMod->findFuncExports( "wasmedge_ffmpeg_avformat_avStream_avg_frame_rate"); - EXPECT_NE(FuncInst, nullptr); - EXPECT_TRUE(FuncInst->isHostFunction()); + ASSERT_NE(FuncInst, nullptr); + ASSERT_TRUE(FuncInst->isHostFunction()); auto &HostFuncAVStreamAvgFrameRate = FuncInst->getHostFunc(); { @@ -229,14 +229,14 @@ TEST_F(FFmpegTest, AVStreamStruct) { FuncInst = AVFormatMod->findFuncExports( "wasmedge_ffmpeg_avformat_avStream_metadata"); - EXPECT_NE(FuncInst, nullptr); - EXPECT_TRUE(FuncInst->isHostFunction()); + ASSERT_NE(FuncInst, nullptr); + ASSERT_TRUE(FuncInst->isHostFunction()); auto &HostFuncAVStreamMetadata = FuncInst->getHostFunc(); FuncInst = AVFormatMod->findFuncExports( "wasmedge_ffmpeg_avformat_avStream_set_metadata"); - EXPECT_NE(FuncInst, nullptr); - EXPECT_TRUE(FuncInst->isHostFunction()); + ASSERT_NE(FuncInst, nullptr); + ASSERT_TRUE(FuncInst->isHostFunction()); auto &HostFuncAVStreamSetMetadata = FuncInst->getHostFunc(); { EXPECT_TRUE(HostFuncAVStreamMetadata.run( @@ -257,8 +257,8 @@ TEST_F(FFmpegTest, AVStreamStruct) { FuncInst = AVFormatMod->findFuncExports("wasmedge_ffmpeg_avformat_avStream_discard"); - EXPECT_NE(FuncInst, nullptr); - EXPECT_TRUE(FuncInst->isHostFunction()); + ASSERT_NE(FuncInst, nullptr); + ASSERT_TRUE(FuncInst->isHostFunction()); auto &HostFuncAVStreamDiscard = FuncInst->getHostFunc(); { EXPECT_TRUE(HostFuncAVStreamDiscard.run( diff --git a/test/plugins/wasmedge_ffmpeg/avformat/avformatContext.cpp b/test/plugins/wasmedge_ffmpeg/avformat/avformatContext.cpp index 479c9999..68795aef 100644 --- a/test/plugins/wasmedge_ffmpeg/avformat/avformatContext.cpp +++ b/test/plugins/wasmedge_ffmpeg/avformat/avformatContext.cpp @@ -26,8 +26,8 @@ TEST_F(FFmpegTest, AVFormatContextStruct) { auto *FuncInst = AVFormatMod->findFuncExports( "wasmedge_ffmpeg_avformat_avformatContext_iformat"); - EXPECT_NE(FuncInst, nullptr); - EXPECT_TRUE(FuncInst->isHostFunction()); + ASSERT_NE(FuncInst, nullptr); + ASSERT_TRUE(FuncInst->isHostFunction()); auto &HostFuncAVFormatCtxIFormat = FuncInst->getHostFunc(); { @@ -42,8 +42,8 @@ TEST_F(FFmpegTest, AVFormatContextStruct) { FuncInst = AVFormatMod->findFuncExports( "wasmedge_ffmpeg_avformat_avformatContext_oformat"); - EXPECT_NE(FuncInst, nullptr); - EXPECT_TRUE(FuncInst->isHostFunction()); + ASSERT_NE(FuncInst, nullptr); + ASSERT_TRUE(FuncInst->isHostFunction()); auto &HostFuncAVFormatCtxOFormat = FuncInst->getHostFunc(); { @@ -58,8 +58,8 @@ TEST_F(FFmpegTest, AVFormatContextStruct) { FuncInst = AVFormatMod->findFuncExports( "wasmedge_ffmpeg_avformat_avformatContext_probescope"); - EXPECT_NE(FuncInst, nullptr); - EXPECT_TRUE(FuncInst->isHostFunction()); + ASSERT_NE(FuncInst, nullptr); + ASSERT_TRUE(FuncInst->isHostFunction()); auto &HostFuncAVFormatCtxProbeScore = FuncInst->getHostFunc(); { @@ -71,8 +71,8 @@ TEST_F(FFmpegTest, AVFormatContextStruct) { FuncInst = AVFormatMod->findFuncExports( "wasmedge_ffmpeg_avformat_avformatContext_nb_streams"); - EXPECT_NE(FuncInst, nullptr); - EXPECT_TRUE(FuncInst->isHostFunction()); + ASSERT_NE(FuncInst, nullptr); + ASSERT_TRUE(FuncInst->isHostFunction()); auto &HostFuncAVFormatCtxNbStreams = FuncInst->getHostFunc(); { @@ -84,8 +84,8 @@ TEST_F(FFmpegTest, AVFormatContextStruct) { FuncInst = AVFormatMod->findFuncExports( "wasmedge_ffmpeg_avformat_avformatContext_duration"); - EXPECT_NE(FuncInst, nullptr); - EXPECT_TRUE(FuncInst->isHostFunction()); + ASSERT_NE(FuncInst, nullptr); + ASSERT_TRUE(FuncInst->isHostFunction()); auto &HostFuncAVFormatCtxDuration = FuncInst->getHostFunc(); { @@ -97,8 +97,8 @@ TEST_F(FFmpegTest, AVFormatContextStruct) { FuncInst = AVFormatMod->findFuncExports( "wasmedge_ffmpeg_avformat_avformatContext_bit_rate"); - EXPECT_NE(FuncInst, nullptr); - EXPECT_TRUE(FuncInst->isHostFunction()); + ASSERT_NE(FuncInst, nullptr); + ASSERT_TRUE(FuncInst->isHostFunction()); auto &HostFuncAVFormatCtxBitRate = FuncInst->getHostFunc(); { @@ -110,14 +110,14 @@ TEST_F(FFmpegTest, AVFormatContextStruct) { FuncInst = AVFormatMod->findFuncExports( "wasmedge_ffmpeg_avformat_avformatContext_set_nb_chapters"); - EXPECT_NE(FuncInst, nullptr); - EXPECT_TRUE(FuncInst->isHostFunction()); + ASSERT_NE(FuncInst, nullptr); + ASSERT_TRUE(FuncInst->isHostFunction()); auto &HostFuncAVFormatCtxSetNbChapters = FuncInst->getHostFunc(); FuncInst = AVFormatMod->findFuncExports( "wasmedge_ffmpeg_avformat_avformatContext_nb_chapters"); - EXPECT_NE(FuncInst, nullptr); - EXPECT_TRUE(FuncInst->isHostFunction()); + ASSERT_NE(FuncInst, nullptr); + ASSERT_TRUE(FuncInst->isHostFunction()); auto &HostFuncAVFormatCtxNbChapters = FuncInst->getHostFunc(); { uint32_t NbChapters = 200; @@ -135,14 +135,14 @@ TEST_F(FFmpegTest, AVFormatContextStruct) { FuncInst = AVFormatMod->findFuncExports( "wasmedge_ffmpeg_avformat_avformatContext_metadata"); - EXPECT_NE(FuncInst, nullptr); - EXPECT_TRUE(FuncInst->isHostFunction()); + ASSERT_NE(FuncInst, nullptr); + ASSERT_TRUE(FuncInst->isHostFunction()); auto &HostFuncAVFormatCtxMetadata = FuncInst->getHostFunc(); FuncInst = AVFormatMod->findFuncExports( "wasmedge_ffmpeg_avformat_avformatContext_set_metadata"); - EXPECT_NE(FuncInst, nullptr); - EXPECT_TRUE(FuncInst->isHostFunction()); + ASSERT_NE(FuncInst, nullptr); + ASSERT_TRUE(FuncInst->isHostFunction()); auto &HostFuncAVFormatCtxSetMetadata = FuncInst->getHostFunc(); { diff --git a/test/plugins/wasmedge_ffmpeg/avformat/avformat_func.cpp b/test/plugins/wasmedge_ffmpeg/avformat/avformat_func.cpp index aef7603a..b2bfdd82 100644 --- a/test/plugins/wasmedge_ffmpeg/avformat/avformat_func.cpp +++ b/test/plugins/wasmedge_ffmpeg/avformat/avformat_func.cpp @@ -31,8 +31,8 @@ TEST_F(FFmpegTest, AVInputFormatFunc) { auto *FuncInst = AVFormatMod->findFuncExports( "wasmedge_ffmpeg_avformat_avformat_open_input"); - EXPECT_NE(FuncInst, nullptr); - EXPECT_TRUE(FuncInst->isHostFunction()); + ASSERT_NE(FuncInst, nullptr); + ASSERT_TRUE(FuncInst->isHostFunction()); auto &HostFuncAVFormatOpenInput = FuncInst->getHostFunc(); spdlog::info("Testing AVFormatOpenInput"sv); @@ -60,8 +60,8 @@ TEST_F(FFmpegTest, AVInputFormatFunc) { FuncInst = AVFormatMod->findFuncExports( "wasmedge_ffmpeg_avformat_avformat_find_stream_info"); - EXPECT_NE(FuncInst, nullptr); - EXPECT_TRUE(FuncInst->isHostFunction()); + ASSERT_NE(FuncInst, nullptr); + ASSERT_TRUE(FuncInst->isHostFunction()); auto &HostFuncAVFormatFindStreamInfo = FuncInst->getHostFunc(); spdlog::info("Testing AVFormatFindStreamInfo"sv); @@ -75,8 +75,8 @@ TEST_F(FFmpegTest, AVInputFormatFunc) { FuncInst = AVFormatMod->findFuncExports("wasmedge_ffmpeg_avformat_av_dump_format"); - EXPECT_NE(FuncInst, nullptr); - EXPECT_TRUE(FuncInst->isHostFunction()); + ASSERT_NE(FuncInst, nullptr); + ASSERT_TRUE(FuncInst->isHostFunction()); auto &HostFuncAVFormatAVDumpFormat = FuncInst->getHostFunc(); spdlog::info("Testing AVDumpFormat"sv); @@ -91,8 +91,8 @@ TEST_F(FFmpegTest, AVInputFormatFunc) { FuncInst = AVFormatMod->findFuncExports( "wasmedge_ffmpeg_avformat_av_find_best_stream"); - EXPECT_NE(FuncInst, nullptr); - EXPECT_TRUE(FuncInst->isHostFunction()); + ASSERT_NE(FuncInst, nullptr); + ASSERT_TRUE(FuncInst->isHostFunction()); auto &HostFuncAVFindBestStream = FuncInst->getHostFunc(); spdlog::info("Testing AVFindBestStream"sv); @@ -107,8 +107,8 @@ TEST_F(FFmpegTest, AVInputFormatFunc) { FuncInst = AVFormatMod->findFuncExports("wasmedge_ffmpeg_avformat_av_read_frame"); - EXPECT_NE(FuncInst, nullptr); - EXPECT_TRUE(FuncInst->isHostFunction()); + ASSERT_NE(FuncInst, nullptr); + ASSERT_TRUE(FuncInst->isHostFunction()); auto &HostFuncAVReadFrame = FuncInst->getHostFunc(); spdlog::info("Testing AVReadFrame"sv); @@ -125,8 +125,8 @@ TEST_F(FFmpegTest, AVInputFormatFunc) { FuncInst = AVFormatMod->findFuncExports( "wasmedge_ffmpeg_avformat_avformat_network_init"); - EXPECT_NE(FuncInst, nullptr); - EXPECT_TRUE(FuncInst->isHostFunction()); + ASSERT_NE(FuncInst, nullptr); + ASSERT_TRUE(FuncInst->isHostFunction()); auto &HostFuncAVFormatNetworkInit = FuncInst->getHostFunc(); spdlog::info("Testing AVFormatNetworkInit"sv); @@ -139,8 +139,8 @@ TEST_F(FFmpegTest, AVInputFormatFunc) { FuncInst = AVFormatMod->findFuncExports( "wasmedge_ffmpeg_avformat_avformat_seek_file"); - EXPECT_NE(FuncInst, nullptr); - EXPECT_TRUE(FuncInst->isHostFunction()); + ASSERT_NE(FuncInst, nullptr); + ASSERT_TRUE(FuncInst->isHostFunction()); auto &HostFuncAVFormatSeekFile = FuncInst->getHostFunc(); spdlog::info("Testing AVFormatSeekFile"sv); @@ -162,8 +162,8 @@ TEST_F(FFmpegTest, AVInputFormatFunc) { FuncInst = AVFormatMod->findFuncExports("wasmedge_ffmpeg_avformat_av_read_play"); - EXPECT_NE(FuncInst, nullptr); - EXPECT_TRUE(FuncInst->isHostFunction()); + ASSERT_NE(FuncInst, nullptr); + ASSERT_TRUE(FuncInst->isHostFunction()); auto &HostFuncAVFormatAVReadPlay = FuncInst->getHostFunc(); spdlog::info("Testing AVReadPlay"sv); @@ -177,8 +177,8 @@ TEST_F(FFmpegTest, AVInputFormatFunc) { FuncInst = AVFormatMod->findFuncExports("wasmedge_ffmpeg_avformat_av_read_pause"); - EXPECT_NE(FuncInst, nullptr); - EXPECT_TRUE(FuncInst->isHostFunction()); + ASSERT_NE(FuncInst, nullptr); + ASSERT_TRUE(FuncInst->isHostFunction()); auto &HostFuncAVFormatAVReadPause = FuncInst->getHostFunc(); spdlog::info("Testing AVReadPause"sv); @@ -192,8 +192,8 @@ TEST_F(FFmpegTest, AVInputFormatFunc) { FuncInst = AVFormatMod->findFuncExports( "wasmedge_ffmpeg_avformat_avformat_network_deinit"); - EXPECT_NE(FuncInst, nullptr); - EXPECT_TRUE(FuncInst->isHostFunction()); + ASSERT_NE(FuncInst, nullptr); + ASSERT_TRUE(FuncInst->isHostFunction()); auto &HostFuncAVFormatNetworkDeInit = FuncInst->getHostFunc(); spdlog::info("Testing AVFormatNetworkDeInit"sv); @@ -206,8 +206,8 @@ TEST_F(FFmpegTest, AVInputFormatFunc) { FuncInst = AVFormatMod->findFuncExports( "wasmedge_ffmpeg_avformat_avformat_close_input"); - EXPECT_NE(FuncInst, nullptr); - EXPECT_TRUE(FuncInst->isHostFunction()); + ASSERT_NE(FuncInst, nullptr); + ASSERT_TRUE(FuncInst->isHostFunction()); auto &HostFuncAVFormatCloseInput = FuncInst->getHostFunc(); spdlog::info("Testing AVFormatCloseInput"sv); @@ -220,8 +220,8 @@ TEST_F(FFmpegTest, AVInputFormatFunc) { FuncInst = AVFormatMod->findFuncExports( "wasmedge_ffmpeg_avformat_avformat_free_context"); - EXPECT_NE(FuncInst, nullptr); - EXPECT_TRUE(FuncInst->isHostFunction()); + ASSERT_NE(FuncInst, nullptr); + ASSERT_TRUE(FuncInst->isHostFunction()); auto &HostFuncAVFreeContext = FuncInst->getHostFunc(); spdlog::info("Testing AVFormatFreeContext"sv); @@ -234,8 +234,8 @@ TEST_F(FFmpegTest, AVInputFormatFunc) { FuncInst = AVFormatMod->findFuncExports("wasmedge_ffmpeg_avformat_avformat_version"); - EXPECT_NE(FuncInst, nullptr); - EXPECT_TRUE(FuncInst->isHostFunction()); + ASSERT_NE(FuncInst, nullptr); + ASSERT_TRUE(FuncInst->isHostFunction()); auto &HostFuncAVFormatVersion = FuncInst->getHostFunc(); spdlog::info("Testing AVFormatVersion"sv); @@ -248,8 +248,8 @@ TEST_F(FFmpegTest, AVInputFormatFunc) { FuncInst = AVFormatMod->findFuncExports( "wasmedge_ffmpeg_avformat_avformat_configuration_length"); - EXPECT_NE(FuncInst, nullptr); - EXPECT_TRUE(FuncInst->isHostFunction()); + ASSERT_NE(FuncInst, nullptr); + ASSERT_TRUE(FuncInst->isHostFunction()); auto &HostFuncAVFormatConfigurationLength = FuncInst->getHostFunc(); spdlog::info("Testing AVFormatConfigurationLength"sv); @@ -263,8 +263,8 @@ TEST_F(FFmpegTest, AVInputFormatFunc) { FuncInst = AVFormatMod->findFuncExports( "wasmedge_ffmpeg_avformat_avformat_configuration"); - EXPECT_NE(FuncInst, nullptr); - EXPECT_TRUE(FuncInst->isHostFunction()); + ASSERT_NE(FuncInst, nullptr); + ASSERT_TRUE(FuncInst->isHostFunction()); auto &HostFuncAVFormatConfiguration = FuncInst->getHostFunc(); spdlog::info("Testing AVFormatConfiguration"sv); @@ -278,8 +278,8 @@ TEST_F(FFmpegTest, AVInputFormatFunc) { FuncInst = AVFormatMod->findFuncExports( "wasmedge_ffmpeg_avformat_avformat_license_length"); - EXPECT_NE(FuncInst, nullptr); - EXPECT_TRUE(FuncInst->isHostFunction()); + ASSERT_NE(FuncInst, nullptr); + ASSERT_TRUE(FuncInst->isHostFunction()); auto &HostFuncAVFormatLicenseLength = FuncInst->getHostFunc(); spdlog::info("Testing AVFormatLicenseLength"sv); @@ -293,8 +293,8 @@ TEST_F(FFmpegTest, AVInputFormatFunc) { FuncInst = AVFormatMod->findFuncExports("wasmedge_ffmpeg_avformat_avformat_license"); - EXPECT_NE(FuncInst, nullptr); - EXPECT_TRUE(FuncInst->isHostFunction()); + ASSERT_NE(FuncInst, nullptr); + ASSERT_TRUE(FuncInst->isHostFunction()); auto &HostFuncAVFormatLicense = FuncInst->getHostFunc(); spdlog::info("Testing AVFormatLicense"sv); @@ -332,8 +332,8 @@ TEST_F(FFmpegTest, AVOutputFormatFunc) { auto *FuncInst = AVFormatMod->findFuncExports( "wasmedge_ffmpeg_avformat_avformat_alloc_output_context2"); - EXPECT_NE(FuncInst, nullptr); - EXPECT_TRUE(FuncInst->isHostFunction()); + ASSERT_NE(FuncInst, nullptr); + ASSERT_TRUE(FuncInst->isHostFunction()); auto &HostFuncAVFormatAllocOutputContext2 = FuncInst->getHostFunc(); spdlog::info("Testing AVFormatAllocOutputContext2"sv); @@ -362,8 +362,8 @@ TEST_F(FFmpegTest, AVOutputFormatFunc) { } FuncInst = AVFormatMod->findFuncExports("wasmedge_ffmpeg_avformat_avio_open"); - EXPECT_NE(FuncInst, nullptr); - EXPECT_TRUE(FuncInst->isHostFunction()); + ASSERT_NE(FuncInst, nullptr); + ASSERT_TRUE(FuncInst->isHostFunction()); auto &HostFuncAVIOOpen = FuncInst->getHostFunc(); spdlog::info("Testing AVIOOpen"sv); @@ -379,8 +379,8 @@ TEST_F(FFmpegTest, AVOutputFormatFunc) { FuncInst = AVFormatMod->findFuncExports("wasmedge_ffmpeg_avformat_avio_open2"); - EXPECT_NE(FuncInst, nullptr); - EXPECT_TRUE(FuncInst->isHostFunction()); + ASSERT_NE(FuncInst, nullptr); + ASSERT_TRUE(FuncInst->isHostFunction()); auto &HostFuncAVIOOpen2 = FuncInst->getHostFunc(); spdlog::info("Testing AVIOOpen2"sv); @@ -415,8 +415,8 @@ TEST_F(FFmpegTest, AVOutputFormatFunc) { FuncInst = AVFormatMod->findFuncExports( "wasmedge_ffmpeg_avformat_avformat_write_header"); - EXPECT_NE(FuncInst, nullptr); - EXPECT_TRUE(FuncInst->isHostFunction()); + ASSERT_NE(FuncInst, nullptr); + ASSERT_TRUE(FuncInst->isHostFunction()); auto &HostFuncAVFormatWriteHeader = FuncInst->getHostFunc(); spdlog::info("Testing AVFormatWriteHeader"sv); @@ -452,8 +452,8 @@ TEST_F(FFmpegTest, AVOutputFormatFunc) { FuncInst = AVFormatMod->findFuncExports( "wasmedge_ffmpeg_avformat_avchapter_mallocz"); - EXPECT_NE(FuncInst, nullptr); - EXPECT_TRUE(FuncInst->isHostFunction()); + ASSERT_NE(FuncInst, nullptr); + ASSERT_TRUE(FuncInst->isHostFunction()); auto &HostFuncAVIOClose = FuncInst->getHostFunc(); spdlog::info("Testing AVChapterMallocz"sv); @@ -488,8 +488,8 @@ TEST_F(FFmpegTest, AVOutputFormatFunc) { FuncInst = AVFormatMod->findFuncExports("wasmedge_ffmpeg_avformat_avformat_avfreep"); - EXPECT_NE(FuncInst, nullptr); - EXPECT_TRUE(FuncInst->isHostFunction()); + ASSERT_NE(FuncInst, nullptr); + ASSERT_TRUE(FuncInst->isHostFunction()); auto &HostFuncAVFormatAVFreep = FuncInst->getHostFunc(); spdlog::info("Testing AVFreeP"sv); @@ -503,8 +503,8 @@ TEST_F(FFmpegTest, AVOutputFormatFunc) { FuncInst = AVFormatMod->findFuncExports("wasmedge_ffmpeg_avformat_av_write_frame"); - EXPECT_NE(FuncInst, nullptr); - EXPECT_TRUE(FuncInst->isHostFunction()); + ASSERT_NE(FuncInst, nullptr); + ASSERT_TRUE(FuncInst->isHostFunction()); auto &HostFuncAVWriteFrame = FuncInst->getHostFunc(); spdlog::info("Testing AVWriteFrame"sv); @@ -520,8 +520,8 @@ TEST_F(FFmpegTest, AVOutputFormatFunc) { FuncInst = AVFormatMod->findFuncExports( "wasmedge_ffmpeg_avformat_av_interleaved_write_frame"); - EXPECT_NE(FuncInst, nullptr); - EXPECT_TRUE(FuncInst->isHostFunction()); + ASSERT_NE(FuncInst, nullptr); + ASSERT_TRUE(FuncInst->isHostFunction()); auto &HostFuncAVInterleavedWriteFrame = FuncInst->getHostFunc(); spdlog::info("Testing AVInterleavedWriteFrame"sv); diff --git a/test/plugins/wasmedge_ffmpeg/avutil/avDictionary.cpp b/test/plugins/wasmedge_ffmpeg/avutil/avDictionary.cpp index 9261e8a6..43e5bef1 100644 --- a/test/plugins/wasmedge_ffmpeg/avutil/avDictionary.cpp +++ b/test/plugins/wasmedge_ffmpeg/avutil/avDictionary.cpp @@ -28,8 +28,8 @@ TEST_F(FFmpegTest, AVDictionary) { auto *FuncInst = AVUtilMod->findFuncExports("wasmedge_ffmpeg_avutil_av_dict_set"); - EXPECT_NE(FuncInst, nullptr); - EXPECT_TRUE(FuncInst->isHostFunction()); + ASSERT_NE(FuncInst, nullptr); + ASSERT_TRUE(FuncInst->isHostFunction()); auto &HostFuncAVDictSet = FuncInst->getHostFunc(); // Fill 0 in WasmMemory. @@ -50,8 +50,8 @@ TEST_F(FFmpegTest, AVDictionary) { } FuncInst = AVUtilMod->findFuncExports("wasmedge_ffmpeg_avutil_av_dict_copy"); - EXPECT_NE(FuncInst, nullptr); - EXPECT_TRUE(FuncInst->isHostFunction()); + ASSERT_NE(FuncInst, nullptr); + ASSERT_TRUE(FuncInst->isHostFunction()); auto &HostFuncAVDictCopy = FuncInst->getHostFunc(); { @@ -66,8 +66,8 @@ TEST_F(FFmpegTest, AVDictionary) { } FuncInst = AVUtilMod->findFuncExports("wasmedge_ffmpeg_avutil_av_dict_get"); - EXPECT_NE(FuncInst, nullptr); - EXPECT_TRUE(FuncInst->isHostFunction()); + ASSERT_NE(FuncInst, nullptr); + ASSERT_TRUE(FuncInst->isHostFunction()); auto &HostFuncAVDictGet = FuncInst->getHostFunc(); { @@ -98,8 +98,8 @@ TEST_F(FFmpegTest, AVDictionary) { FuncInst = AVUtilMod->findFuncExports( "wasmedge_ffmpeg_avutil_av_dict_get_key_value"); - EXPECT_NE(FuncInst, nullptr); - EXPECT_TRUE(FuncInst->isHostFunction()); + ASSERT_NE(FuncInst, nullptr); + ASSERT_TRUE(FuncInst->isHostFunction()); auto &HostFuncAVDictGetKeyValue = FuncInst->getHostFunc(); { @@ -128,8 +128,8 @@ TEST_F(FFmpegTest, AVDictionary) { } FuncInst = AVUtilMod->findFuncExports("wasmedge_ffmpeg_avutil_av_dict_free"); - EXPECT_NE(FuncInst, nullptr); - EXPECT_TRUE(FuncInst->isHostFunction()); + ASSERT_NE(FuncInst, nullptr); + ASSERT_TRUE(FuncInst->isHostFunction()); auto &HostFuncAVDictFree = FuncInst->getHostFunc(); { diff --git a/test/plugins/wasmedge_ffmpeg/avutil/avError.cpp b/test/plugins/wasmedge_ffmpeg/avutil/avError.cpp index c8cfc373..a30c999e 100644 --- a/test/plugins/wasmedge_ffmpeg/avutil/avError.cpp +++ b/test/plugins/wasmedge_ffmpeg/avutil/avError.cpp @@ -24,6 +24,8 @@ TEST_F(FFmpegTest, AVError) { auto *FuncInst = AVUtilMod->findFuncExports("wasmedge_ffmpeg_avutil_av_strerror"); + ASSERT_NE(FuncInst, nullptr); + ASSERT_TRUE(FuncInst->isHostFunction()); auto &HostFuncAVUtilAVStrError = FuncInst->getHostFunc(); { @@ -34,6 +36,8 @@ TEST_F(FFmpegTest, AVError) { } FuncInst = AVUtilMod->findFuncExports("wasmedge_ffmpeg_avutil_AVERROR"); + ASSERT_NE(FuncInst, nullptr); + ASSERT_TRUE(FuncInst->isHostFunction()); auto &HostFuncAVUtilAVError = FuncInst->getHostFunc(); { @@ -45,6 +49,8 @@ TEST_F(FFmpegTest, AVError) { } FuncInst = AVUtilMod->findFuncExports("wasmedge_ffmpeg_avutil_AVUNERROR"); + ASSERT_NE(FuncInst, nullptr); + ASSERT_TRUE(FuncInst->isHostFunction()); auto &HostFuncAVUtilAVUNError = FuncInst->getHostFunc(); { diff --git a/test/plugins/wasmedge_ffmpeg/avutil/avFrame.cpp b/test/plugins/wasmedge_ffmpeg/avutil/avFrame.cpp index 682e3486..80bfd9d0 100644 --- a/test/plugins/wasmedge_ffmpeg/avutil/avFrame.cpp +++ b/test/plugins/wasmedge_ffmpeg/avutil/avFrame.cpp @@ -32,6 +32,8 @@ TEST_F(FFmpegTest, AVFrame) { auto *FuncInst = AVUtilMod->findFuncExports("wasmedge_ffmpeg_avutil_av_frame_alloc"); + ASSERT_NE(FuncInst, nullptr); + ASSERT_TRUE(FuncInst->isHostFunction()); auto &HostFuncAVFrameAlloc = FuncInst->getHostFunc(); uint32_t EmptyFramePtr = UINT32_C(64); @@ -46,6 +48,8 @@ TEST_F(FFmpegTest, AVFrame) { } FuncInst = AVUtilMod->findFuncExports("wasmedge_ffmpeg_avutil_av_frame_free"); + ASSERT_NE(FuncInst, nullptr); + ASSERT_TRUE(FuncInst->isHostFunction()); auto &HostFuncAVFrameFree = FuncInst->getHostFunc(); { @@ -59,6 +63,8 @@ TEST_F(FFmpegTest, AVFrame) { FuncInst = AVUtilMod->findFuncExports("wasmedge_ffmpeg_avutil_av_frame_width"); + ASSERT_NE(FuncInst, nullptr); + ASSERT_TRUE(FuncInst->isHostFunction()); auto &HostFuncAVFrameWidth = FuncInst->getHostFunc(); { @@ -71,6 +77,8 @@ TEST_F(FFmpegTest, AVFrame) { FuncInst = AVUtilMod->findFuncExports("wasmedge_ffmpeg_avutil_av_frame_height"); + ASSERT_NE(FuncInst, nullptr); + ASSERT_TRUE(FuncInst->isHostFunction()); auto &HostFuncAVFrameHeight = FuncInst->getHostFunc(); { @@ -83,6 +91,8 @@ TEST_F(FFmpegTest, AVFrame) { FuncInst = AVUtilMod->findFuncExports( "wasmedge_ffmpeg_avutil_av_frame_video_format"); + ASSERT_NE(FuncInst, nullptr); + ASSERT_TRUE(FuncInst->isHostFunction()); auto &HostFuncAVFrameVideoFormat = FuncInst->getHostFunc(); { @@ -95,6 +105,8 @@ TEST_F(FFmpegTest, AVFrame) { FuncInst = AVUtilMod->findFuncExports("wasmedge_ffmpeg_avutil_av_frame_isnull"); + ASSERT_NE(FuncInst, nullptr); + ASSERT_TRUE(FuncInst->isHostFunction()); auto &HostFuncAVFrameIsNull = FuncInst->getHostFunc(); { @@ -107,6 +119,8 @@ TEST_F(FFmpegTest, AVFrame) { FuncInst = AVUtilMod->findFuncExports("wasmedge_ffmpeg_avutil_av_frame_linesize"); + ASSERT_NE(FuncInst, nullptr); + ASSERT_TRUE(FuncInst->isHostFunction()); auto &HostFuncAVFrameLinesize = FuncInst->getHostFunc(); int32_t Stride = 0; @@ -122,6 +136,8 @@ TEST_F(FFmpegTest, AVFrame) { FuncInst = AVUtilMod->findFuncExports("wasmedge_ffmpeg_avutil_av_frame_get_buffer"); + ASSERT_NE(FuncInst, nullptr); + ASSERT_TRUE(FuncInst->isHostFunction()); auto &HostFuncAVFrameGetBuffer = FuncInst->getHostFunc(); { // For video, it is 32. @@ -135,6 +151,8 @@ TEST_F(FFmpegTest, AVFrame) { FuncInst = AVUtilMod->findFuncExports( "wasmedge_ffmpeg_avutil_av_frame_best_effort_timestamp"); + ASSERT_NE(FuncInst, nullptr); + ASSERT_TRUE(FuncInst->isHostFunction()); auto &HostFuncAVFrameBestEffortTimestamp = FuncInst->getHostFunc(); { @@ -146,6 +164,8 @@ TEST_F(FFmpegTest, AVFrame) { FuncInst = AVUtilMod->findFuncExports("wasmedge_ffmpeg_avutil_av_frame_pict_type"); + ASSERT_NE(FuncInst, nullptr); + ASSERT_TRUE(FuncInst->isHostFunction()); auto &HostFuncAVFramePictType = FuncInst->getHostFunc(); { @@ -157,6 +177,8 @@ TEST_F(FFmpegTest, AVFrame) { FuncInst = AVUtilMod->findFuncExports( "wasmedge_ffmpeg_avutil_av_frame_interlaced_frame"); + ASSERT_NE(FuncInst, nullptr); + ASSERT_TRUE(FuncInst->isHostFunction()); auto &HostFuncAVFrameInterlacedFrame = FuncInst->getHostFunc(); { @@ -168,6 +190,8 @@ TEST_F(FFmpegTest, AVFrame) { FuncInst = AVUtilMod->findFuncExports( "wasmedge_ffmpeg_avutil_av_frame_top_field_first"); + ASSERT_NE(FuncInst, nullptr); + ASSERT_TRUE(FuncInst->isHostFunction()); auto &HostFuncAVFrameTopFieldFirst = FuncInst->getHostFunc(); { @@ -179,6 +203,8 @@ TEST_F(FFmpegTest, AVFrame) { FuncInst = AVUtilMod->findFuncExports( "wasmedge_ffmpeg_avutil_av_frame_palette_has_changed"); + ASSERT_NE(FuncInst, nullptr); + ASSERT_TRUE(FuncInst->isHostFunction()); auto &HostFuncAVFramePaletteHasChanged = FuncInst->getHostFunc(); { @@ -190,6 +216,8 @@ TEST_F(FFmpegTest, AVFrame) { FuncInst = AVUtilMod->findFuncExports("wasmedge_ffmpeg_avutil_av_frame_colorspace"); + ASSERT_NE(FuncInst, nullptr); + ASSERT_TRUE(FuncInst->isHostFunction()); auto &HostFuncAVFrameColorspace = FuncInst->getHostFunc(); { @@ -201,6 +229,8 @@ TEST_F(FFmpegTest, AVFrame) { FuncInst = AVUtilMod->findFuncExports("wasmedge_ffmpeg_avutil_av_frame_color_range"); + ASSERT_NE(FuncInst, nullptr); + ASSERT_TRUE(FuncInst->isHostFunction()); auto &HostFuncAVFrameColorRange = FuncInst->getHostFunc(); { @@ -212,6 +242,8 @@ TEST_F(FFmpegTest, AVFrame) { FuncInst = AVUtilMod->findFuncExports("wasmedge_ffmpeg_avutil_av_frame_color_trc"); + ASSERT_NE(FuncInst, nullptr); + ASSERT_TRUE(FuncInst->isHostFunction()); auto &HostAVFrameColorTransferCharacteristic = FuncInst->getHostFunc(); { @@ -223,6 +255,8 @@ TEST_F(FFmpegTest, AVFrame) { FuncInst = AVUtilMod->findFuncExports( "wasmedge_ffmpeg_avutil_av_frame_chroma_location"); + ASSERT_NE(FuncInst, nullptr); + ASSERT_TRUE(FuncInst->isHostFunction()); auto &HostAVFrameChromaLocation = FuncInst->getHostFunc(); { @@ -234,6 +268,8 @@ TEST_F(FFmpegTest, AVFrame) { FuncInst = AVUtilMod->findFuncExports("wasmedge_ffmpeg_avutil_av_frame_repeat_pict"); + ASSERT_NE(FuncInst, nullptr); + ASSERT_TRUE(FuncInst->isHostFunction()); auto &HostAVFrameRepeatPict = FuncInst->getHostFunc(); { @@ -245,6 +281,8 @@ TEST_F(FFmpegTest, AVFrame) { FuncInst = AVUtilMod->findFuncExports("wasmedge_ffmpeg_avutil_av_frame_flags"); + ASSERT_NE(FuncInst, nullptr); + ASSERT_TRUE(FuncInst->isHostFunction()); auto &HostAVFrameFlags = FuncInst->getHostFunc(); { @@ -256,6 +294,8 @@ TEST_F(FFmpegTest, AVFrame) { FuncInst = AVUtilMod->findFuncExports("wasmedge_ffmpeg_avutil_av_frame_quality"); + ASSERT_NE(FuncInst, nullptr); + ASSERT_TRUE(FuncInst->isHostFunction()); auto &HostAVFrameQuality = FuncInst->getHostFunc(); { @@ -267,6 +307,8 @@ TEST_F(FFmpegTest, AVFrame) { FuncInst = AVUtilMod->findFuncExports("wasmedge_ffmpeg_avutil_av_frame_metadata"); + ASSERT_NE(FuncInst, nullptr); + ASSERT_TRUE(FuncInst->isHostFunction()); auto &HostAVFrameMetadata = FuncInst->getHostFunc(); { @@ -281,6 +323,8 @@ TEST_F(FFmpegTest, AVFrame) { FuncInst = AVUtilMod->findFuncExports( "wasmedge_ffmpeg_avutil_av_frame_set_metadata"); + ASSERT_NE(FuncInst, nullptr); + ASSERT_TRUE(FuncInst->isHostFunction()); auto &HostAVFrameSetMetadata = FuncInst->getHostFunc(); { @@ -292,6 +336,8 @@ TEST_F(FFmpegTest, AVFrame) { FuncInst = AVUtilMod->findFuncExports("wasmedge_ffmpeg_avutil_av_frame_key_frame"); + ASSERT_NE(FuncInst, nullptr); + ASSERT_TRUE(FuncInst->isHostFunction()); auto &HostAVFrameKeyFrame = FuncInst->getHostFunc(); { @@ -302,6 +348,8 @@ TEST_F(FFmpegTest, AVFrame) { } FuncInst = AVUtilMod->findFuncExports("wasmedge_ffmpeg_avutil_av_frame_pts"); + ASSERT_NE(FuncInst, nullptr); + ASSERT_TRUE(FuncInst->isHostFunction()); auto &HostAVFramePts = FuncInst->getHostFunc(); { @@ -312,6 +360,8 @@ TEST_F(FFmpegTest, AVFrame) { } FuncInst = AVUtilMod->findFuncExports("wasmedge_ffmpeg_avutil_av_frame_copy"); + ASSERT_NE(FuncInst, nullptr); + ASSERT_TRUE(FuncInst->isHostFunction()); auto &HostAVFrameCopy = FuncInst->getHostFunc(); { @@ -324,6 +374,8 @@ TEST_F(FFmpegTest, AVFrame) { FuncInst = AVUtilMod->findFuncExports("wasmedge_ffmpeg_avutil_av_frame_copy_props"); + ASSERT_NE(FuncInst, nullptr); + ASSERT_TRUE(FuncInst->isHostFunction()); auto &HostAVFrameCopyProps = FuncInst->getHostFunc(); { @@ -336,6 +388,8 @@ TEST_F(FFmpegTest, AVFrame) { FuncInst = AVUtilMod->findFuncExports("wasmedge_ffmpeg_avutil_av_frame_set_width"); + ASSERT_NE(FuncInst, nullptr); + ASSERT_TRUE(FuncInst->isHostFunction()); auto &HostFuncAVFrameSetWidth = FuncInst->getHostFunc(); { @@ -353,6 +407,8 @@ TEST_F(FFmpegTest, AVFrame) { FuncInst = AVUtilMod->findFuncExports("wasmedge_ffmpeg_avutil_av_frame_set_height"); + ASSERT_NE(FuncInst, nullptr); + ASSERT_TRUE(FuncInst->isHostFunction()); auto &HostFuncAVFrameSetHeight = FuncInst->getHostFunc(); int32_t Height = 100; @@ -369,6 +425,8 @@ TEST_F(FFmpegTest, AVFrame) { } FuncInst = AVUtilMod->findFuncExports("wasmedge_ffmpeg_avutil_av_frame_data"); + ASSERT_NE(FuncInst, nullptr); + ASSERT_TRUE(FuncInst->isHostFunction()); auto &HostFuncAVFrameData = FuncInst->getHostFunc(); { @@ -383,6 +441,8 @@ TEST_F(FFmpegTest, AVFrame) { FuncInst = AVUtilMod->findFuncExports( "wasmedge_ffmpeg_avutil_av_frame_set_video_format"); + ASSERT_NE(FuncInst, nullptr); + ASSERT_TRUE(FuncInst->isHostFunction()); auto &HostFuncAVFrameSetVideoFormat = FuncInst->getHostFunc(); { @@ -401,6 +461,8 @@ TEST_F(FFmpegTest, AVFrame) { FuncInst = AVUtilMod->findFuncExports( "wasmedge_ffmpeg_avutil_av_frame_set_pict_type"); + ASSERT_NE(FuncInst, nullptr); + ASSERT_TRUE(FuncInst->isHostFunction()); auto &HostFuncAVFrameSetPictType = FuncInst->getHostFunc(); { @@ -419,6 +481,8 @@ TEST_F(FFmpegTest, AVFrame) { FuncInst = AVUtilMod->findFuncExports( "wasmedge_ffmpeg_avutil_av_frame_set_colorspace"); + ASSERT_NE(FuncInst, nullptr); + ASSERT_TRUE(FuncInst->isHostFunction()); auto &HostFuncAVFrameSetColorSpace = FuncInst->getHostFunc(); { @@ -437,6 +501,8 @@ TEST_F(FFmpegTest, AVFrame) { FuncInst = AVUtilMod->findFuncExports( "wasmedge_ffmpeg_avutil_av_frame_set_color_range"); + ASSERT_NE(FuncInst, nullptr); + ASSERT_TRUE(FuncInst->isHostFunction()); auto &HostFuncAVFrameSetColorRange = FuncInst->getHostFunc(); { @@ -455,6 +521,8 @@ TEST_F(FFmpegTest, AVFrame) { FuncInst = AVUtilMod->findFuncExports( "wasmedge_ffmpeg_avutil_av_frame_set_color_trc"); + ASSERT_NE(FuncInst, nullptr); + ASSERT_TRUE(FuncInst->isHostFunction()); auto &HostFuncAVFrameSetColorTransferCharacteristic = FuncInst->getHostFunc(); { @@ -473,6 +541,8 @@ TEST_F(FFmpegTest, AVFrame) { FuncInst = AVUtilMod->findFuncExports("wasmedge_ffmpeg_avutil_av_frame_set_pts"); + ASSERT_NE(FuncInst, nullptr); + ASSERT_TRUE(FuncInst->isHostFunction()); auto &HostFuncAVFrameSetPts = FuncInst->getHostFunc(); { @@ -490,6 +560,8 @@ TEST_F(FFmpegTest, AVFrame) { FuncInst = AVUtilMod->findFuncExports( "wasmedge_ffmpeg_avutil_av_frame_sample_aspect_ratio"); + ASSERT_NE(FuncInst, nullptr); + ASSERT_TRUE(FuncInst->isHostFunction()); auto &HostFuncAVFrameSampleAspectRatio = FuncInst->getHostFunc(); { @@ -503,6 +575,8 @@ TEST_F(FFmpegTest, AVFrame) { int32_t ColorPrimariesId = 1; // BT709 FuncInst = AVUtilMod->findFuncExports( "wasmedge_ffmpeg_avutil_av_frame_set_color_primaries"); + ASSERT_NE(FuncInst, nullptr); + ASSERT_TRUE(FuncInst->isHostFunction()); auto &HostFuncAVFrameSetColorPrimaries = FuncInst->getHostFunc(); { @@ -516,6 +590,8 @@ TEST_F(FFmpegTest, AVFrame) { FuncInst = AVUtilMod->findFuncExports( "wasmedge_ffmpeg_avutil_av_frame_color_primaries"); + ASSERT_NE(FuncInst, nullptr); + ASSERT_TRUE(FuncInst->isHostFunction()); auto &HostFuncAVFrameColorPrimaries = FuncInst->getHostFunc(); { @@ -533,6 +609,8 @@ TEST_F(FFmpegTest, AVFrame) { FuncInst = AVUtilMod->findFuncExports( "wasmedge_ffmpeg_avutil_av_frame_set_audio_format"); + ASSERT_NE(FuncInst, nullptr); + ASSERT_TRUE(FuncInst->isHostFunction()); auto &HostFuncAVFrameSetAudioFormat = FuncInst->getHostFunc(); uint32_t SampleFormatId = 4; @@ -546,6 +624,8 @@ TEST_F(FFmpegTest, AVFrame) { FuncInst = AVUtilMod->findFuncExports( "wasmedge_ffmpeg_avutil_av_frame_audio_format"); + ASSERT_NE(FuncInst, nullptr); + ASSERT_TRUE(FuncInst->isHostFunction()); auto &HostFuncAVFrameAudioFormat = FuncInst->getHostFunc(); { @@ -557,6 +637,8 @@ TEST_F(FFmpegTest, AVFrame) { FuncInst = AVUtilMod->findFuncExports( "wasmedge_ffmpeg_avutil_av_frame_set_nb_samples"); + ASSERT_NE(FuncInst, nullptr); + ASSERT_TRUE(FuncInst->isHostFunction()); auto &HostFuncAVFrameSetNbSamples = FuncInst->getHostFunc(); int32_t NbSamples = 32; @@ -570,6 +652,8 @@ TEST_F(FFmpegTest, AVFrame) { FuncInst = AVUtilMod->findFuncExports("wasmedge_ffmpeg_avutil_av_frame_nb_samples"); + ASSERT_NE(FuncInst, nullptr); + ASSERT_TRUE(FuncInst->isHostFunction()); auto &HostFuncAVFrameNbSamples = FuncInst->getHostFunc(); { @@ -581,6 +665,8 @@ TEST_F(FFmpegTest, AVFrame) { FuncInst = AVUtilMod->findFuncExports( "wasmedge_ffmpeg_avutil_av_frame_set_sample_rate"); + ASSERT_NE(FuncInst, nullptr); + ASSERT_TRUE(FuncInst->isHostFunction()); auto &HostFuncAVFrameSetSampleRate = FuncInst->getHostFunc(); int32_t SampleRate = 10; @@ -594,6 +680,8 @@ TEST_F(FFmpegTest, AVFrame) { FuncInst = AVUtilMod->findFuncExports("wasmedge_ffmpeg_avutil_av_frame_sample_rate"); + ASSERT_NE(FuncInst, nullptr); + ASSERT_TRUE(FuncInst->isHostFunction()); auto &HostFuncAVFrameSampleRate = FuncInst->getHostFunc(); { @@ -605,6 +693,8 @@ TEST_F(FFmpegTest, AVFrame) { FuncInst = AVUtilMod->findFuncExports( "wasmedge_ffmpeg_avutil_av_frame_set_channels"); + ASSERT_NE(FuncInst, nullptr); + ASSERT_TRUE(FuncInst->isHostFunction()); auto &HostFuncAVFrameSetChannels = FuncInst->getHostFunc(); int32_t Channels = 3; @@ -618,6 +708,8 @@ TEST_F(FFmpegTest, AVFrame) { FuncInst = AVUtilMod->findFuncExports("wasmedge_ffmpeg_avutil_av_frame_channels"); + ASSERT_NE(FuncInst, nullptr); + ASSERT_TRUE(FuncInst->isHostFunction()); auto &HostFuncAVFrameChannels = FuncInst->getHostFunc(); { @@ -629,6 +721,8 @@ TEST_F(FFmpegTest, AVFrame) { FuncInst = AVUtilMod->findFuncExports( "wasmedge_ffmpeg_avutil_av_frame_set_channel_layout"); + ASSERT_NE(FuncInst, nullptr); + ASSERT_TRUE(FuncInst->isHostFunction()); auto &HostFuncAVFrameSetChannelLayout = FuncInst->getHostFunc(); uint64_t ChannelLayout = 1UL << 10; @@ -642,6 +736,8 @@ TEST_F(FFmpegTest, AVFrame) { FuncInst = AVUtilMod->findFuncExports( "wasmedge_ffmpeg_avutil_av_frame_channel_layout"); + ASSERT_NE(FuncInst, nullptr); + ASSERT_TRUE(FuncInst->isHostFunction()); auto &HostFuncAVFrameChannelLayout = FuncInst->getHostFunc(); { diff --git a/test/plugins/wasmedge_ffmpeg/avutil/avPixfmt.cpp b/test/plugins/wasmedge_ffmpeg/avutil/avPixfmt.cpp index 6c1f3f49..f71d8397 100644 --- a/test/plugins/wasmedge_ffmpeg/avutil/avPixfmt.cpp +++ b/test/plugins/wasmedge_ffmpeg/avutil/avPixfmt.cpp @@ -17,6 +17,8 @@ TEST_F(FFmpegTest, AVPixFmt) { auto *FuncInst = AVUtilMod->findFuncExports( "wasmedge_ffmpeg_avutil_avpixfmtdescriptor_nb_components"); + ASSERT_NE(FuncInst, nullptr); + ASSERT_TRUE(FuncInst->isHostFunction()); auto &HostFuncAVPixFmtDescriptorNbComponents = FuncInst->getHostFunc(); uint32_t PixFmtId = 3; // RGB24 @@ -31,6 +33,8 @@ TEST_F(FFmpegTest, AVPixFmt) { FuncInst = AVUtilMod->findFuncExports( "wasmedge_ffmpeg_avutil_avpixfmtdescriptor_log2_chromaw"); + ASSERT_NE(FuncInst, nullptr); + ASSERT_TRUE(FuncInst->isHostFunction()); auto &HostFuncAvPixFmtDescriptorLog2ChromaW = FuncInst->getHostFunc(); { @@ -42,6 +46,8 @@ TEST_F(FFmpegTest, AVPixFmt) { FuncInst = AVUtilMod->findFuncExports( "wasmedge_ffmpeg_avutil_avpixfmtdescriptor_log2_chromah"); + ASSERT_NE(FuncInst, nullptr); + ASSERT_TRUE(FuncInst->isHostFunction()); auto &HostFuncAvPixFmtDescriptorLog2ChromaH = FuncInst->getHostFunc(); { @@ -56,6 +62,8 @@ TEST_F(FFmpegTest, AVPixFmt) { int32_t TransferCharacteristicId = 6; // (SMPTE170M) FuncInst = AVUtilMod->findFuncExports( "wasmedge_ffmpeg_avutil_av_color_transfer_name_length"); + ASSERT_NE(FuncInst, nullptr); + ASSERT_TRUE(FuncInst->isHostFunction()); auto &HostFuncAVColorTransferNameLength = FuncInst->getHostFunc(); { @@ -71,6 +79,8 @@ TEST_F(FFmpegTest, AVPixFmt) { fillMemContent(MemInst, NamePtr, Length); FuncInst = AVUtilMod->findFuncExports( "wasmedge_ffmpeg_avutil_av_color_transfer_name"); + ASSERT_NE(FuncInst, nullptr); + ASSERT_TRUE(FuncInst->isHostFunction()); auto &HostFuncAVColorTransferName = FuncInst->getHostFunc(); { @@ -86,6 +96,8 @@ TEST_F(FFmpegTest, AVPixFmt) { int32_t ColorRangeId = 2; //; JPEG FuncInst = AVUtilMod->findFuncExports( "wasmedge_ffmpeg_avutil_av_color_range_name_length"); + ASSERT_NE(FuncInst, nullptr); + ASSERT_TRUE(FuncInst->isHostFunction()); auto &HostFuncAVColorRangeNameLength = FuncInst->getHostFunc(); { @@ -101,6 +113,8 @@ TEST_F(FFmpegTest, AVPixFmt) { fillMemContent(MemInst, NamePtr, Length); FuncInst = AVUtilMod->findFuncExports("wasmedge_ffmpeg_avutil_av_color_range_name"); + ASSERT_NE(FuncInst, nullptr); + ASSERT_TRUE(FuncInst->isHostFunction()); auto &HostFuncAVColorRangeName = FuncInst->getHostFunc(); { @@ -115,6 +129,8 @@ TEST_F(FFmpegTest, AVPixFmt) { int32_t ColorSpaceId = 1; // BT709 FuncInst = AVUtilMod->findFuncExports( "wasmedge_ffmpeg_avutil_av_color_space_name_length"); + ASSERT_NE(FuncInst, nullptr); + ASSERT_TRUE(FuncInst->isHostFunction()); auto &HostFuncAVColorSpaceNameLength = FuncInst->getHostFunc(); { @@ -130,6 +146,8 @@ TEST_F(FFmpegTest, AVPixFmt) { fillMemContent(MemInst, NamePtr, Length); FuncInst = AVUtilMod->findFuncExports("wasmedge_ffmpeg_avutil_av_color_space_name"); + ASSERT_NE(FuncInst, nullptr); + ASSERT_TRUE(FuncInst->isHostFunction()); auto &HostFuncAVColorSpaceName = FuncInst->getHostFunc(); { @@ -144,6 +162,8 @@ TEST_F(FFmpegTest, AVPixFmt) { int32_t ColorPrimariesId = 1; // BT709 FuncInst = AVUtilMod->findFuncExports( "wasmedge_ffmpeg_avutil_av_color_primaries_name_length"); + ASSERT_NE(FuncInst, nullptr); + ASSERT_TRUE(FuncInst->isHostFunction()); auto &HostFuncAVColorPrimariesNameLength = FuncInst->getHostFunc(); { @@ -159,6 +179,8 @@ TEST_F(FFmpegTest, AVPixFmt) { fillMemContent(MemInst, NamePtr, Length); FuncInst = AVUtilMod->findFuncExports( "wasmedge_ffmpeg_avutil_av_color_primaries_name"); + ASSERT_NE(FuncInst, nullptr); + ASSERT_TRUE(FuncInst->isHostFunction()); auto &HostFuncAVColorPrimariesName = FuncInst->getHostFunc(); { @@ -174,6 +196,8 @@ TEST_F(FFmpegTest, AVPixFmt) { PixFmtId = 1; // YUV420P FuncInst = AVUtilMod->findFuncExports( "wasmedge_ffmpeg_avutil_av_pix_format_name_length"); + ASSERT_NE(FuncInst, nullptr); + ASSERT_TRUE(FuncInst->isHostFunction()); auto &HostFuncAVPixFormatNameLength = FuncInst->getHostFunc(); { @@ -189,6 +213,8 @@ TEST_F(FFmpegTest, AVPixFmt) { fillMemContent(MemInst, NamePtr, Length); FuncInst = AVUtilMod->findFuncExports("wasmedge_ffmpeg_avutil_av_pix_format_name"); + ASSERT_NE(FuncInst, nullptr); + ASSERT_TRUE(FuncInst->isHostFunction()); auto &HostFuncAVPixFormatName = FuncInst->getHostFunc(); { @@ -202,6 +228,8 @@ TEST_F(FFmpegTest, AVPixFmt) { FuncInst = AVUtilMod->findFuncExports("wasmedge_ffmpeg_avutil_av_pix_format_mask"); + ASSERT_NE(FuncInst, nullptr); + ASSERT_TRUE(FuncInst->isHostFunction()); auto &HostFuncAVPixFormatMask = FuncInst->getHostFunc(); { diff --git a/test/plugins/wasmedge_ffmpeg/avutil/avRational.cpp b/test/plugins/wasmedge_ffmpeg/avutil/avRational.cpp index d710cb1e..d8cdffeb 100644 --- a/test/plugins/wasmedge_ffmpeg/avutil/avRational.cpp +++ b/test/plugins/wasmedge_ffmpeg/avutil/avRational.cpp @@ -21,8 +21,8 @@ TEST_F(FFmpegTest, AVRational) { // Addition Function auto *FuncInst = AVUtilMod->findFuncExports("wasmedge_ffmpeg_avutil_av_add_q"); - EXPECT_NE(FuncInst, nullptr); - EXPECT_TRUE(FuncInst->isHostFunction()); + ASSERT_NE(FuncInst, nullptr); + ASSERT_TRUE(FuncInst->isHostFunction()); auto &HostFuncAVAddQ = FuncInst->getHostFunc(); { @@ -42,8 +42,8 @@ TEST_F(FFmpegTest, AVRational) { // Subtraction Function FuncInst = AVUtilMod->findFuncExports("wasmedge_ffmpeg_avutil_av_sub_q"); - EXPECT_NE(FuncInst, nullptr); - EXPECT_TRUE(FuncInst->isHostFunction()); + ASSERT_NE(FuncInst, nullptr); + ASSERT_TRUE(FuncInst->isHostFunction()); auto &HostFuncAVSubQ = FuncInst->getHostFunc(); { @@ -65,8 +65,8 @@ TEST_F(FFmpegTest, AVRational) { } FuncInst = AVUtilMod->findFuncExports("wasmedge_ffmpeg_avutil_av_mul_q"); - EXPECT_NE(FuncInst, nullptr); - EXPECT_TRUE(FuncInst->isHostFunction()); + ASSERT_NE(FuncInst, nullptr); + ASSERT_TRUE(FuncInst->isHostFunction()); auto &HostFuncAVMulQ = FuncInst->getHostFunc(); { @@ -88,8 +88,8 @@ TEST_F(FFmpegTest, AVRational) { } FuncInst = AVUtilMod->findFuncExports("wasmedge_ffmpeg_avutil_av_div_q"); - EXPECT_NE(FuncInst, nullptr); - EXPECT_TRUE(FuncInst->isHostFunction()); + ASSERT_NE(FuncInst, nullptr); + ASSERT_TRUE(FuncInst->isHostFunction()); auto &HostFuncAVDivQ = FuncInst->getHostFunc(); { @@ -113,8 +113,8 @@ TEST_F(FFmpegTest, AVRational) { // How to Pass a Double functions. FuncInst = AVUtilMod->findFuncExports("wasmedge_ffmpeg_avutil_av_d2q"); - EXPECT_NE(FuncInst, nullptr); - EXPECT_TRUE(FuncInst->isHostFunction()); + ASSERT_NE(FuncInst, nullptr); + ASSERT_TRUE(FuncInst->isHostFunction()); auto &HostFuncAVD2Q = FuncInst->getHostFunc(); { @@ -135,8 +135,8 @@ TEST_F(FFmpegTest, AVRational) { } FuncInst = AVUtilMod->findFuncExports("wasmedge_ffmpeg_avutil_av_q2d"); - EXPECT_NE(FuncInst, nullptr); - EXPECT_TRUE(FuncInst->isHostFunction()); + ASSERT_NE(FuncInst, nullptr); + ASSERT_TRUE(FuncInst->isHostFunction()); auto &HostFuncAVQ2d = FuncInst->getHostFunc(); { @@ -153,8 +153,8 @@ TEST_F(FFmpegTest, AVRational) { } FuncInst = AVUtilMod->findFuncExports("wasmedge_ffmpeg_avutil_av_inv_q"); - EXPECT_NE(FuncInst, nullptr); - EXPECT_TRUE(FuncInst->isHostFunction()); + ASSERT_NE(FuncInst, nullptr); + ASSERT_TRUE(FuncInst->isHostFunction()); auto &HostFuncInvQ = FuncInst->getHostFunc(); { @@ -175,8 +175,8 @@ TEST_F(FFmpegTest, AVRational) { } FuncInst = AVUtilMod->findFuncExports("wasmedge_ffmpeg_avutil_av_q2intfloat"); - EXPECT_NE(FuncInst, nullptr); - EXPECT_TRUE(FuncInst->isHostFunction()); + ASSERT_NE(FuncInst, nullptr); + ASSERT_TRUE(FuncInst->isHostFunction()); auto &HostFuncAVQ2IntFloat = FuncInst->getHostFunc(); { @@ -190,8 +190,8 @@ TEST_F(FFmpegTest, AVRational) { } FuncInst = AVUtilMod->findFuncExports("wasmedge_ffmpeg_avutil_av_nearer_q"); - EXPECT_NE(FuncInst, nullptr); - EXPECT_TRUE(FuncInst->isHostFunction()); + ASSERT_NE(FuncInst, nullptr); + ASSERT_TRUE(FuncInst->isHostFunction()); auto &HostFuncAVNearerQ = FuncInst->getHostFunc(); { @@ -233,8 +233,8 @@ TEST_F(FFmpegTest, AVRational) { } FuncInst = AVUtilMod->findFuncExports("wasmedge_ffmpeg_avutil_av_cmp_q"); - EXPECT_NE(FuncInst, nullptr); - EXPECT_TRUE(FuncInst->isHostFunction()); + ASSERT_NE(FuncInst, nullptr); + ASSERT_TRUE(FuncInst->isHostFunction()); auto &HostFuncAVCmpQ = FuncInst->getHostFunc(); { @@ -273,8 +273,8 @@ TEST_F(FFmpegTest, AVRational) { } FuncInst = AVUtilMod->findFuncExports("wasmedge_ffmpeg_avutil_av_reduce"); - EXPECT_NE(FuncInst, nullptr); - EXPECT_TRUE(FuncInst->isHostFunction()); + ASSERT_NE(FuncInst, nullptr); + ASSERT_TRUE(FuncInst->isHostFunction()); auto &HostFuncAVReduce = FuncInst->getHostFunc(); { diff --git a/test/plugins/wasmedge_ffmpeg/avutil/avSampleFmt.cpp b/test/plugins/wasmedge_ffmpeg/avutil/avSampleFmt.cpp index a856e10d..dcf76ce2 100644 --- a/test/plugins/wasmedge_ffmpeg/avutil/avSampleFmt.cpp +++ b/test/plugins/wasmedge_ffmpeg/avutil/avSampleFmt.cpp @@ -23,6 +23,8 @@ TEST_F(FFmpegTest, AVSampleFmt) { uint32_t SampleFmtId = 1; // AV_SAMPLE_FMT_S32 auto *FuncInst = AVUtilMod->findFuncExports( "wasmedge_ffmpeg_avutil_av_get_packed_sample_fmt"); + ASSERT_NE(FuncInst, nullptr); + ASSERT_TRUE(FuncInst->isHostFunction()); auto &HostFuncAVGetPackedSampleFmt = FuncInst->getHostFunc(); { @@ -35,6 +37,8 @@ TEST_F(FFmpegTest, AVSampleFmt) { FuncInst = AVUtilMod->findFuncExports( "wasmedge_ffmpeg_avutil_av_get_planar_sample_fmt"); + ASSERT_NE(FuncInst, nullptr); + ASSERT_TRUE(FuncInst->isHostFunction()); auto &HostFuncAVGetPlanarSampleFmt = FuncInst->getHostFunc(); { @@ -47,6 +51,8 @@ TEST_F(FFmpegTest, AVSampleFmt) { FuncInst = AVUtilMod->findFuncExports( "wasmedge_ffmpeg_avutil_av_sample_fmt_is_planar"); + ASSERT_NE(FuncInst, nullptr); + ASSERT_TRUE(FuncInst->isHostFunction()); auto &HostFuncAVSampleFmtIsPlanar = FuncInst->getHostFunc(); { @@ -59,6 +65,8 @@ TEST_F(FFmpegTest, AVSampleFmt) { FuncInst = AVUtilMod->findFuncExports( "wasmedge_ffmpeg_avutil_av_get_bytes_per_sample"); + ASSERT_NE(FuncInst, nullptr); + ASSERT_TRUE(FuncInst->isHostFunction()); auto &HostFuncAVGetBytesPerSample = FuncInst->getHostFunc(); { @@ -71,6 +79,8 @@ TEST_F(FFmpegTest, AVSampleFmt) { FuncInst = AVUtilMod->findFuncExports("wasmedge_ffmpeg_avutil_av_get_sample_fmt"); + ASSERT_NE(FuncInst, nullptr); + ASSERT_TRUE(FuncInst->isHostFunction()); auto &HostFuncAVGetSampleFmt = FuncInst->getHostFunc(); uint32_t SampleFmtStart = 100; @@ -89,6 +99,8 @@ TEST_F(FFmpegTest, AVSampleFmt) { FuncInst = AVUtilMod->findFuncExports( "wasmedge_ffmpeg_avutil_av_samples_get_buffer_size"); + ASSERT_NE(FuncInst, nullptr); + ASSERT_TRUE(FuncInst->isHostFunction()); auto &HostFuncAVSamplesGetBufferSize = FuncInst->getHostFunc(); int32_t NbChannels = 1; @@ -108,6 +120,8 @@ TEST_F(FFmpegTest, AVSampleFmt) { FuncInst = AVUtilMod->findFuncExports( "wasmedge_ffmpeg_avutil_av_samples_alloc_array_and_samples"); + ASSERT_NE(FuncInst, nullptr); + ASSERT_TRUE(FuncInst->isHostFunction()); auto &HostFuncAVSamplesAllocArrayAndSamples = FuncInst->getHostFunc(); { @@ -126,6 +140,8 @@ TEST_F(FFmpegTest, AVSampleFmt) { int32_t Length = 0; FuncInst = AVUtilMod->findFuncExports( "wasmedge_ffmpeg_avutil_av_get_sample_fmt_name_length"); + ASSERT_NE(FuncInst, nullptr); + ASSERT_TRUE(FuncInst->isHostFunction()); auto &HostFuncAVGetSampleFmtNameLength = FuncInst->getHostFunc(); { @@ -139,6 +155,8 @@ TEST_F(FFmpegTest, AVSampleFmt) { FuncInst = AVUtilMod->findFuncExports( "wasmedge_ffmpeg_avutil_av_get_sample_fmt_name"); + ASSERT_NE(FuncInst, nullptr); + ASSERT_TRUE(FuncInst->isHostFunction()); auto &HostFuncAVGetSampleFmtName = FuncInst->getHostFunc(); // Fill Memory with 0. @@ -154,6 +172,8 @@ TEST_F(FFmpegTest, AVSampleFmt) { FuncInst = AVUtilMod->findFuncExports( "wasmedge_ffmpeg_avutil_av_get_sample_fmt_mask"); + ASSERT_NE(FuncInst, nullptr); + ASSERT_TRUE(FuncInst->isHostFunction()); auto &HostFuncAVGetSampleFmtMask = FuncInst->getHostFunc(); { @@ -166,6 +186,8 @@ TEST_F(FFmpegTest, AVSampleFmt) { } FuncInst = AVUtilMod->findFuncExports("wasmedge_ffmpeg_avutil_av_freep"); + ASSERT_NE(FuncInst, nullptr); + ASSERT_TRUE(FuncInst->isHostFunction()); auto &HostFuncAVFreep = FuncInst->getHostFunc(); { diff --git a/test/plugins/wasmedge_ffmpeg/avutil/avutil_func.cpp b/test/plugins/wasmedge_ffmpeg/avutil/avutil_func.cpp index 1adcbd03..07e568b2 100644 --- a/test/plugins/wasmedge_ffmpeg/avutil/avutil_func.cpp +++ b/test/plugins/wasmedge_ffmpeg/avutil/avutil_func.cpp @@ -20,6 +20,8 @@ TEST_F(FFmpegTest, AVUtilFunc) { auto *FuncInst = AVUtilMod->findFuncExports("wasmedge_ffmpeg_avutil_av_log_set_level"); + ASSERT_NE(FuncInst, nullptr); + ASSERT_TRUE(FuncInst->isHostFunction()); auto &HostFuncAVLogSetLevel = FuncInst->getHostFunc(); int32_t LogLvlId = 32; @@ -31,6 +33,8 @@ TEST_F(FFmpegTest, AVUtilFunc) { FuncInst = AVUtilMod->findFuncExports("wasmedge_ffmpeg_avutil_av_log_get_level"); + ASSERT_NE(FuncInst, nullptr); + ASSERT_TRUE(FuncInst->isHostFunction()); auto &HostFuncAVLogGetLevel = FuncInst->getHostFunc(); { @@ -41,6 +45,8 @@ TEST_F(FFmpegTest, AVUtilFunc) { FuncInst = AVUtilMod->findFuncExports("wasmedge_ffmpeg_avutil_av_log_set_flags"); + ASSERT_NE(FuncInst, nullptr); + ASSERT_TRUE(FuncInst->isHostFunction()); auto &HostFuncAVLogSetFlags = FuncInst->getHostFunc(); { @@ -50,6 +56,8 @@ TEST_F(FFmpegTest, AVUtilFunc) { FuncInst = AVUtilMod->findFuncExports("wasmedge_ffmpeg_avutil_av_log_get_flags"); + ASSERT_NE(FuncInst, nullptr); + ASSERT_TRUE(FuncInst->isHostFunction()); auto &HostFuncAVLogGetFlags = FuncInst->getHostFunc(); { @@ -60,6 +68,8 @@ TEST_F(FFmpegTest, AVUtilFunc) { } FuncInst = AVUtilMod->findFuncExports("wasmedge_ffmpeg_avutil_av_rescale_q"); + ASSERT_NE(FuncInst, nullptr); + ASSERT_TRUE(FuncInst->isHostFunction()); auto &HostFuncAVRescaleQ = FuncInst->getHostFunc(); int64_t A = 20; @@ -79,6 +89,8 @@ TEST_F(FFmpegTest, AVUtilFunc) { FuncInst = AVUtilMod->findFuncExports("wasmedge_ffmpeg_avutil_av_rescale_q_rnd"); + ASSERT_NE(FuncInst, nullptr); + ASSERT_TRUE(FuncInst->isHostFunction()); auto &HostFuncAVRescaleQRnd = FuncInst->getHostFunc(); { @@ -93,6 +105,8 @@ TEST_F(FFmpegTest, AVUtilFunc) { FuncInst = AVUtilMod->findFuncExports("wasmedge_ffmpeg_avutil_avutil_version"); + ASSERT_NE(FuncInst, nullptr); + ASSERT_TRUE(FuncInst->isHostFunction()); auto &HostFuncAVUtilVersion = FuncInst->getHostFunc(); { @@ -105,6 +119,8 @@ TEST_F(FFmpegTest, AVUtilFunc) { uint64_t ChannelId = 1; // FRONT_LEFT FuncInst = AVUtilMod->findFuncExports( "wasmedge_ffmpeg_avutil_av_get_channel_layout_nb_channels"); + ASSERT_NE(FuncInst, nullptr); + ASSERT_TRUE(FuncInst->isHostFunction()); auto &HostFuncAVGetChannelLayoutNbChannels = FuncInst->getHostFunc(); { @@ -116,6 +132,8 @@ TEST_F(FFmpegTest, AVUtilFunc) { FuncInst = AVUtilMod->findFuncExports( "wasmedge_ffmpeg_avutil_av_get_default_channel_layout"); + ASSERT_NE(FuncInst, nullptr); + ASSERT_TRUE(FuncInst->isHostFunction()); auto &HostFuncAVGetDefaultChannelLayout = FuncInst->getHostFunc(); { @@ -128,6 +146,8 @@ TEST_F(FFmpegTest, AVUtilFunc) { uint32_t Length = 0; FuncInst = AVUtilMod->findFuncExports( "wasmedge_ffmpeg_avutil_avutil_configuration_length"); + ASSERT_NE(FuncInst, nullptr); + ASSERT_TRUE(FuncInst->isHostFunction()); auto &HostFuncAVUtilConfigurationLength = FuncInst->getHostFunc(); { @@ -142,6 +162,8 @@ TEST_F(FFmpegTest, AVUtilFunc) { fillMemContent(MemInst, NamePtr, Length); FuncInst = AVUtilMod->findFuncExports("wasmedge_ffmpeg_avutil_avutil_configuration"); + ASSERT_NE(FuncInst, nullptr); + ASSERT_TRUE(FuncInst->isHostFunction()); auto &HostFuncAVUtilConfiguration = FuncInst->getHostFunc(); { @@ -153,6 +175,8 @@ TEST_F(FFmpegTest, AVUtilFunc) { FuncInst = AVUtilMod->findFuncExports( "wasmedge_ffmpeg_avutil_avutil_license_length"); + ASSERT_NE(FuncInst, nullptr); + ASSERT_TRUE(FuncInst->isHostFunction()); auto &HostFuncAVUtilLicenseLength = FuncInst->getHostFunc(); { @@ -167,6 +191,8 @@ TEST_F(FFmpegTest, AVUtilFunc) { fillMemContent(MemInst, NamePtr, Length); FuncInst = AVUtilMod->findFuncExports("wasmedge_ffmpeg_avutil_avutil_license"); + ASSERT_NE(FuncInst, nullptr); + ASSERT_TRUE(FuncInst->isHostFunction()); auto &HostFuncAVUtilLicense = FuncInst->getHostFunc(); { @@ -183,6 +209,8 @@ TEST_F(FFmpegTest, AVTime) { auto *FuncInst = AVUtilMod->findFuncExports("wasmedge_ffmpeg_avutil_av_gettime"); + ASSERT_NE(FuncInst, nullptr); + ASSERT_TRUE(FuncInst->isHostFunction()); auto &HostFuncAVGetTime = FuncInst->getHostFunc(); { @@ -194,6 +222,8 @@ TEST_F(FFmpegTest, AVTime) { FuncInst = AVUtilMod->findFuncExports("wasmedge_ffmpeg_avutil_av_gettime_relative"); + ASSERT_NE(FuncInst, nullptr); + ASSERT_TRUE(FuncInst->isHostFunction()); auto &HostFuncAVGetTimeRelative = FuncInst->getHostFunc(); { @@ -205,6 +235,8 @@ TEST_F(FFmpegTest, AVTime) { FuncInst = AVUtilMod->findFuncExports( "wasmedge_ffmpeg_avutil_av_gettime_relative_is_monotonic"); + ASSERT_NE(FuncInst, nullptr); + ASSERT_TRUE(FuncInst->isHostFunction()); auto &HostFuncAVGetTimeRelativeIsMonotonic = FuncInst->getHostFunc(); { @@ -215,6 +247,8 @@ TEST_F(FFmpegTest, AVTime) { } FuncInst = AVUtilMod->findFuncExports("wasmedge_ffmpeg_avutil_av_usleep"); + ASSERT_NE(FuncInst, nullptr); + ASSERT_TRUE(FuncInst->isHostFunction()); auto &HostFuncAVUSleep = FuncInst->getHostFunc(); { diff --git a/test/plugins/wasmedge_ffmpeg/swresample/swresample_func.cpp b/test/plugins/wasmedge_ffmpeg/swresample/swresample_func.cpp index 69557be4..3b945475 100644 --- a/test/plugins/wasmedge_ffmpeg/swresample/swresample_func.cpp +++ b/test/plugins/wasmedge_ffmpeg/swresample/swresample_func.cpp @@ -37,8 +37,8 @@ TEST_F(FFmpegTest, SWResampleFunc) { auto *FuncInst = SWResampleMod->findFuncExports( "wasmedge_ffmpeg_swresample_swresample_version"); - EXPECT_NE(FuncInst, nullptr); - EXPECT_TRUE(FuncInst->isHostFunction()); + ASSERT_NE(FuncInst, nullptr); + ASSERT_TRUE(FuncInst->isHostFunction()); auto &HostFuncSWResampleVersion = FuncInst->getHostFunc(); { @@ -48,8 +48,8 @@ TEST_F(FFmpegTest, SWResampleFunc) { FuncInst = SWResampleMod->findFuncExports( "wasmedge_ffmpeg_swresample_swr_alloc_set_opts"); - EXPECT_NE(FuncInst, nullptr); - EXPECT_TRUE(FuncInst->isHostFunction()); + ASSERT_NE(FuncInst, nullptr); + ASSERT_TRUE(FuncInst->isHostFunction()); auto &HostFuncSwrAllocSetOpts = FuncInst->getHostFunc(); // Testing with Null Old SwrCtx. Hence 2nd argument is 0. @@ -96,8 +96,8 @@ TEST_F(FFmpegTest, SWResampleFunc) { FuncInst = SWResampleMod->findFuncExports("wasmedge_ffmpeg_swresample_swr_free"); - EXPECT_NE(FuncInst, nullptr); - EXPECT_TRUE(FuncInst->isHostFunction()); + ASSERT_NE(FuncInst, nullptr); + ASSERT_TRUE(FuncInst->isHostFunction()); auto &HostFuncSwrFree = FuncInst->getHostFunc(); { @@ -108,8 +108,8 @@ TEST_F(FFmpegTest, SWResampleFunc) { FuncInst = SWResampleMod->findFuncExports("wasmedge_ffmpeg_swresample_swr_init"); - EXPECT_NE(FuncInst, nullptr); - EXPECT_TRUE(FuncInst->isHostFunction()); + ASSERT_NE(FuncInst, nullptr); + ASSERT_TRUE(FuncInst->isHostFunction()); auto &HostFuncSwrInit = FuncInst->getHostFunc(); { @@ -121,8 +121,8 @@ TEST_F(FFmpegTest, SWResampleFunc) { FuncInst = SWResampleMod->findFuncExports( "wasmedge_ffmpeg_swresample_av_opt_set_dict"); - EXPECT_NE(FuncInst, nullptr); - EXPECT_TRUE(FuncInst->isHostFunction()); + ASSERT_NE(FuncInst, nullptr); + ASSERT_TRUE(FuncInst->isHostFunction()); auto &HostFuncAVOptSetDict = FuncInst->getHostFunc(); { @@ -145,8 +145,8 @@ TEST_F(FFmpegTest, SWResampleFunc) { FuncInst = SWResampleMod->findFuncExports( "wasmedge_ffmpeg_swresample_swr_convert_frame"); - EXPECT_NE(FuncInst, nullptr); - EXPECT_TRUE(FuncInst->isHostFunction()); + ASSERT_NE(FuncInst, nullptr); + ASSERT_TRUE(FuncInst->isHostFunction()); auto &HostFuncSwrConvertFrame = FuncInst->getHostFunc(); { @@ -160,8 +160,8 @@ TEST_F(FFmpegTest, SWResampleFunc) { FuncInst = SWResampleMod->findFuncExports( "wasmedge_ffmpeg_swresample_swr_get_delay"); - EXPECT_NE(FuncInst, nullptr); - EXPECT_TRUE(FuncInst->isHostFunction()); + ASSERT_NE(FuncInst, nullptr); + ASSERT_TRUE(FuncInst->isHostFunction()); auto &HostFuncSwrGetDelay = FuncInst->getHostFunc(); { @@ -174,8 +174,8 @@ TEST_F(FFmpegTest, SWResampleFunc) { FuncInst = SWResampleMod->findFuncExports( "wasmedge_ffmpeg_swresample_swresample_configuration_length"); - EXPECT_NE(FuncInst, nullptr); - EXPECT_TRUE(FuncInst->isHostFunction()); + ASSERT_NE(FuncInst, nullptr); + ASSERT_TRUE(FuncInst->isHostFunction()); auto &HostFuncSwrConfigLength = FuncInst->getHostFunc(); int32_t Length = 0; @@ -189,8 +189,8 @@ TEST_F(FFmpegTest, SWResampleFunc) { FuncInst = SWResampleMod->findFuncExports( "wasmedge_ffmpeg_swresample_swresample_configuration"); - EXPECT_NE(FuncInst, nullptr); - EXPECT_TRUE(FuncInst->isHostFunction()); + ASSERT_NE(FuncInst, nullptr); + ASSERT_TRUE(FuncInst->isHostFunction()); auto &HostFuncSwrConfig = FuncInst->getHostFunc(); { @@ -203,8 +203,8 @@ TEST_F(FFmpegTest, SWResampleFunc) { FuncInst = SWResampleMod->findFuncExports( "wasmedge_ffmpeg_swresample_swresample_license_length"); - EXPECT_NE(FuncInst, nullptr); - EXPECT_TRUE(FuncInst->isHostFunction()); + ASSERT_NE(FuncInst, nullptr); + ASSERT_TRUE(FuncInst->isHostFunction()); auto &HostFuncSwrLicenseLen = FuncInst->getHostFunc(); { @@ -218,8 +218,8 @@ TEST_F(FFmpegTest, SWResampleFunc) { FuncInst = SWResampleMod->findFuncExports( "wasmedge_ffmpeg_swresample_swresample_license"); - EXPECT_NE(FuncInst, nullptr); - EXPECT_TRUE(FuncInst->isHostFunction()); + ASSERT_NE(FuncInst, nullptr); + ASSERT_TRUE(FuncInst->isHostFunction()); auto &HostFuncSwrLicense = FuncInst->getHostFunc(); { diff --git a/test/plugins/wasmedge_ffmpeg/swscale/swscale_func.cpp b/test/plugins/wasmedge_ffmpeg/swscale/swscale_func.cpp index 38ba61a5..9e739c14 100644 --- a/test/plugins/wasmedge_ffmpeg/swscale/swscale_func.cpp +++ b/test/plugins/wasmedge_ffmpeg/swscale/swscale_func.cpp @@ -21,8 +21,8 @@ TEST_F(FFmpegTest, SwsContext) { auto *FuncInst = SWScaleMod->findFuncExports("wasmedge_ffmpeg_swscale_sws_getContext"); - EXPECT_NE(FuncInst, nullptr); - EXPECT_TRUE(FuncInst->isHostFunction()); + ASSERT_NE(FuncInst, nullptr); + ASSERT_TRUE(FuncInst->isHostFunction()); auto &HostFuncSwsGetContext = FuncInst->getHostFunc(); uint32_t SWScalePtr = UINT32_C(4); @@ -69,8 +69,8 @@ TEST_F(FFmpegTest, SwsContext) { // Checking correctness of function. Returns Invalid Argument Error. FuncInst = SWScaleMod->findFuncExports("wasmedge_ffmpeg_swscale_sws_scale"); - EXPECT_NE(FuncInst, nullptr); - EXPECT_TRUE(FuncInst->isHostFunction()); + ASSERT_NE(FuncInst, nullptr); + ASSERT_TRUE(FuncInst->isHostFunction()); auto &HostFuncSwsScale = FuncInst->getHostFunc(); { @@ -84,8 +84,8 @@ TEST_F(FFmpegTest, SwsContext) { FuncInst = SWScaleMod->findFuncExports( "wasmedge_ffmpeg_swscale_sws_getCachedContext"); - EXPECT_NE(FuncInst, nullptr); - EXPECT_TRUE(FuncInst->isHostFunction()); + ASSERT_NE(FuncInst, nullptr); + ASSERT_TRUE(FuncInst->isHostFunction()); auto &HostFuncSwsGetCachedContext = FuncInst->getHostFunc(); { @@ -101,8 +101,8 @@ TEST_F(FFmpegTest, SwsContext) { FuncInst = SWScaleMod->findFuncExports( "wasmedge_ffmpeg_swscale_sws_isSupportedInput"); - EXPECT_NE(FuncInst, nullptr); - EXPECT_TRUE(FuncInst->isHostFunction()); + ASSERT_NE(FuncInst, nullptr); + ASSERT_TRUE(FuncInst->isHostFunction()); auto &HostFuncSwsIsSupportedInput = FuncInst->getHostFunc(); { @@ -121,8 +121,8 @@ TEST_F(FFmpegTest, SwsContext) { FuncInst = SWScaleMod->findFuncExports( "wasmedge_ffmpeg_swscale_sws_isSupportedOutput"); - EXPECT_NE(FuncInst, nullptr); - EXPECT_TRUE(FuncInst->isHostFunction()); + ASSERT_NE(FuncInst, nullptr); + ASSERT_TRUE(FuncInst->isHostFunction()); auto &HostFuncSwsIsSupportedOutput = FuncInst->getHostFunc(); { @@ -141,8 +141,8 @@ TEST_F(FFmpegTest, SwsContext) { FuncInst = SWScaleMod->findFuncExports( "wasmedge_ffmpeg_swscale_sws_isSupportedEndiannessConversion"); - EXPECT_NE(FuncInst, nullptr); - EXPECT_TRUE(FuncInst->isHostFunction()); + ASSERT_NE(FuncInst, nullptr); + ASSERT_TRUE(FuncInst->isHostFunction()); auto &HostFuncSwsIsSupportedEndiannessConversion = FuncInst->getHostFunc(); { @@ -155,8 +155,8 @@ TEST_F(FFmpegTest, SwsContext) { FuncInst = SWScaleMod->findFuncExports("wasmedge_ffmpeg_swscale_sws_freeContext"); - EXPECT_NE(FuncInst, nullptr); - EXPECT_TRUE(FuncInst->isHostFunction()); + ASSERT_NE(FuncInst, nullptr); + ASSERT_TRUE(FuncInst->isHostFunction()); auto &HostFuncSwsFreeContext = FuncInst->getHostFunc(); { @@ -190,8 +190,8 @@ TEST_F(FFmpegTest, SwsFilter) { ASSERT_TRUE(SWScaleMod != nullptr); auto *FuncInst = SWScaleMod->findFuncExports( "wasmedge_ffmpeg_swscale_sws_getDefaultFilter"); - EXPECT_NE(FuncInst, nullptr); - EXPECT_TRUE(FuncInst->isHostFunction()); + ASSERT_NE(FuncInst, nullptr); + ASSERT_TRUE(FuncInst->isHostFunction()); auto &HostFuncSwsGetDefaultFilter = FuncInst->getHostFunc(); uint32_t SwsFilterPtr = UINT32_C(40); @@ -217,8 +217,8 @@ TEST_F(FFmpegTest, SwsFilter) { uint32_t FilterId = readUInt32(MemInst, SwsFilterPtr); FuncInst = SWScaleMod->findFuncExports("wasmedge_ffmpeg_swscale_sws_getLumaH"); - EXPECT_NE(FuncInst, nullptr); - EXPECT_TRUE(FuncInst->isHostFunction()); + ASSERT_NE(FuncInst, nullptr); + ASSERT_TRUE(FuncInst->isHostFunction()); auto &HostFuncSwsGetLumaH = FuncInst->getHostFunc(); uint32_t SwsVectorPtr = UINT32_C(20); @@ -233,8 +233,8 @@ TEST_F(FFmpegTest, SwsFilter) { FuncInst = SWScaleMod->findFuncExports("wasmedge_ffmpeg_swscale_sws_getLumaV"); - EXPECT_NE(FuncInst, nullptr); - EXPECT_TRUE(FuncInst->isHostFunction()); + ASSERT_NE(FuncInst, nullptr); + ASSERT_TRUE(FuncInst->isHostFunction()); auto &HostFuncSwsGetLumaV = FuncInst->getHostFunc(); { @@ -249,8 +249,8 @@ TEST_F(FFmpegTest, SwsFilter) { FuncInst = SWScaleMod->findFuncExports("wasmedge_ffmpeg_swscale_sws_getChromaH"); - EXPECT_NE(FuncInst, nullptr); - EXPECT_TRUE(FuncInst->isHostFunction()); + ASSERT_NE(FuncInst, nullptr); + ASSERT_TRUE(FuncInst->isHostFunction()); auto &HostFuncSwsGetChromaH = FuncInst->getHostFunc(); { @@ -264,8 +264,8 @@ TEST_F(FFmpegTest, SwsFilter) { FuncInst = SWScaleMod->findFuncExports("wasmedge_ffmpeg_swscale_sws_getChromaV"); - EXPECT_NE(FuncInst, nullptr); - EXPECT_TRUE(FuncInst->isHostFunction()); + ASSERT_NE(FuncInst, nullptr); + ASSERT_TRUE(FuncInst->isHostFunction()); auto &HostFuncSwsGetChromaV = FuncInst->getHostFunc(); { @@ -279,8 +279,8 @@ TEST_F(FFmpegTest, SwsFilter) { FuncInst = SWScaleMod->findFuncExports("wasmedge_ffmpeg_swscale_sws_freeFilter"); - EXPECT_NE(FuncInst, nullptr); - EXPECT_TRUE(FuncInst->isHostFunction()); + ASSERT_NE(FuncInst, nullptr); + ASSERT_TRUE(FuncInst->isHostFunction()); auto &HostFuncSwsFreeFilter = FuncInst->getHostFunc(); { @@ -302,8 +302,8 @@ TEST_F(FFmpegTest, SwsVector) { auto *FuncInst = SWScaleMod->findFuncExports("wasmedge_ffmpeg_swscale_sws_allocVec"); - EXPECT_NE(FuncInst, nullptr); - EXPECT_TRUE(FuncInst->isHostFunction()); + ASSERT_NE(FuncInst, nullptr); + ASSERT_TRUE(FuncInst->isHostFunction()); auto &HostFuncSwsAllocVec = FuncInst->getHostFunc(); { @@ -319,8 +319,8 @@ TEST_F(FFmpegTest, SwsVector) { FuncInst = SWScaleMod->findFuncExports("wasmedge_ffmpeg_swscale_sws_getGaussianVec"); - EXPECT_NE(FuncInst, nullptr); - EXPECT_TRUE(FuncInst->isHostFunction()); + ASSERT_NE(FuncInst, nullptr); + ASSERT_TRUE(FuncInst->isHostFunction()); auto &HostFuncSwsGetGaussianVec = FuncInst->getHostFunc(); { @@ -338,8 +338,8 @@ TEST_F(FFmpegTest, SwsVector) { FuncInst = SWScaleMod->findFuncExports("wasmedge_ffmpeg_swscale_sws_scaleVec"); - EXPECT_NE(FuncInst, nullptr); - EXPECT_TRUE(FuncInst->isHostFunction()); + ASSERT_NE(FuncInst, nullptr); + ASSERT_TRUE(FuncInst->isHostFunction()); auto &HostFuncSwsScaleVec = FuncInst->getHostFunc(); { @@ -353,8 +353,8 @@ TEST_F(FFmpegTest, SwsVector) { FuncInst = SWScaleMod->findFuncExports("wasmedge_ffmpeg_swscale_sws_normalizeVec"); - EXPECT_NE(FuncInst, nullptr); - EXPECT_TRUE(FuncInst->isHostFunction()); + ASSERT_NE(FuncInst, nullptr); + ASSERT_TRUE(FuncInst->isHostFunction()); auto &HostFuncSwsNormalizeVec = FuncInst->getHostFunc(); { @@ -368,8 +368,8 @@ TEST_F(FFmpegTest, SwsVector) { FuncInst = SWScaleMod->findFuncExports( "wasmedge_ffmpeg_swscale_sws_getCoeffVecLength"); - EXPECT_NE(FuncInst, nullptr); - EXPECT_TRUE(FuncInst->isHostFunction()); + ASSERT_NE(FuncInst, nullptr); + ASSERT_TRUE(FuncInst->isHostFunction()); auto &HostFuncSwsGetCoeffVecLength = FuncInst->getHostFunc(); int Length = 0; @@ -384,8 +384,8 @@ TEST_F(FFmpegTest, SwsVector) { FuncInst = SWScaleMod->findFuncExports("wasmedge_ffmpeg_swscale_sws_getCoeff"); - EXPECT_NE(FuncInst, nullptr); - EXPECT_TRUE(FuncInst->isHostFunction()); + ASSERT_NE(FuncInst, nullptr); + ASSERT_TRUE(FuncInst->isHostFunction()); auto &HostFuncSwsGetCoeff = FuncInst->getHostFunc(); fillMemContent(MemInst, CoeffPtr, Length); @@ -399,8 +399,8 @@ TEST_F(FFmpegTest, SwsVector) { } FuncInst = SWScaleMod->findFuncExports("wasmedge_ffmpeg_swscale_sws_freeVec"); - EXPECT_NE(FuncInst, nullptr); - EXPECT_TRUE(FuncInst->isHostFunction()); + ASSERT_NE(FuncInst, nullptr); + ASSERT_TRUE(FuncInst->isHostFunction()); auto &HostFuncSwsFreeVec = FuncInst->getHostFunc(); { @@ -424,6 +424,8 @@ TEST_F(FFmpegTest, SWScaleVersion) { auto *FuncInst = SWScaleMod->findFuncExports("wasmedge_ffmpeg_swscale_swscale_version"); + ASSERT_NE(FuncInst, nullptr); + ASSERT_TRUE(FuncInst->isHostFunction()); auto &HostFuncSwscaleVersion = FuncInst->getHostFunc(); { @@ -435,6 +437,8 @@ TEST_F(FFmpegTest, SWScaleVersion) { FuncInst = SWScaleMod->findFuncExports( "wasmedge_ffmpeg_swscale_swscale_configuration_length"); + ASSERT_NE(FuncInst, nullptr); + ASSERT_TRUE(FuncInst->isHostFunction()); auto &HostFuncSwscaleConfigurationLength = FuncInst->getHostFunc(); { @@ -450,6 +454,8 @@ TEST_F(FFmpegTest, SWScaleVersion) { fillMemContent(MemInst, NamePtr, Length); FuncInst = SWScaleMod->findFuncExports( "wasmedge_ffmpeg_swscale_swscale_configuration"); + ASSERT_NE(FuncInst, nullptr); + ASSERT_TRUE(FuncInst->isHostFunction()); auto &HostFuncSwscaleConfiguration = FuncInst->getHostFunc(); { @@ -461,6 +467,8 @@ TEST_F(FFmpegTest, SWScaleVersion) { FuncInst = SWScaleMod->findFuncExports( "wasmedge_ffmpeg_swscale_swscale_license_length"); + ASSERT_NE(FuncInst, nullptr); + ASSERT_TRUE(FuncInst->isHostFunction()); auto &HostFuncSwscaleLicenseLength = FuncInst->getHostFunc(); { @@ -475,6 +483,8 @@ TEST_F(FFmpegTest, SWScaleVersion) { fillMemContent(MemInst, NamePtr, Length); FuncInst = SWScaleMod->findFuncExports("wasmedge_ffmpeg_swscale_swscale_license"); + ASSERT_NE(FuncInst, nullptr); + ASSERT_TRUE(FuncInst->isHostFunction()); auto &HostFuncSwscaleLicense = FuncInst->getHostFunc(); { diff --git a/test/plugins/wasmedge_ffmpeg/utils.cpp b/test/plugins/wasmedge_ffmpeg/utils.cpp index e1a1909b..d4ed035c 100644 --- a/test/plugins/wasmedge_ffmpeg/utils.cpp +++ b/test/plugins/wasmedge_ffmpeg/utils.cpp @@ -18,6 +18,8 @@ namespace WasmEdgeFFmpeg { void FFmpegTest::initEmptyFrame(uint32_t FramePtr) { auto *FuncInst = AVUtilMod->findFuncExports("wasmedge_ffmpeg_avutil_av_frame_alloc"); + ASSERT_NE(FuncInst, nullptr); + ASSERT_TRUE(FuncInst->isHostFunction()); auto &HostFuncAVFrameAlloc = FuncInst->getHostFunc(); HostFuncAVFrameAlloc.run( CallFrame, std::initializer_list{FramePtr}, Result); @@ -34,6 +36,8 @@ void FFmpegTest::initFFmpegStructs(uint32_t AVCodecPtr, uint32_t AVFormatCtxPtr, auto *FuncInst = AVFormatMod->findFuncExports( "wasmedge_ffmpeg_avformat_av_find_best_stream"); + ASSERT_NE(FuncInst, nullptr); + ASSERT_TRUE(FuncInst->isHostFunction()); auto &HostFuncAVFindBestStream = FuncInst->getHostFunc(); uint32_t MediaTypeId = 0; // Video uint32_t WantedStream = -1; @@ -50,7 +54,8 @@ void FFmpegTest::initFFmpegStructs(uint32_t AVCodecPtr, uint32_t AVFormatCtxPtr, FuncInst = AVFormatMod->findFuncExports( "wasmedge_ffmpeg_avformat_avStream_codecpar"); - + ASSERT_NE(FuncInst, nullptr); + ASSERT_TRUE(FuncInst->isHostFunction()); auto &HostFuncAVStreamCodecpar = FuncInst->getHostFunc(); HostFuncAVStreamCodecpar.run(CallFrame, @@ -62,6 +67,8 @@ void FFmpegTest::initFFmpegStructs(uint32_t AVCodecPtr, uint32_t AVFormatCtxPtr, FuncInst = AVCodecMod->findFuncExports( "wasmedge_ffmpeg_avcodec_avcodec_alloc_context3"); + ASSERT_NE(FuncInst, nullptr); + ASSERT_TRUE(FuncInst->isHostFunction()); auto &HostFuncAVCodecAllocContext3 = FuncInst->getHostFunc(); HostFuncAVCodecAllocContext3.run( @@ -72,6 +79,8 @@ void FFmpegTest::initFFmpegStructs(uint32_t AVCodecPtr, uint32_t AVFormatCtxPtr, FuncInst = AVCodecMod->findFuncExports( "wasmedge_ffmpeg_avcodec_avcodec_parameters_to_context"); + ASSERT_NE(FuncInst, nullptr); + ASSERT_TRUE(FuncInst->isHostFunction()); auto &HostFuncAVCodecParametersToContext = FuncInst->getHostFunc(); HostFuncAVCodecParametersToContext.run( @@ -82,6 +91,8 @@ void FFmpegTest::initFFmpegStructs(uint32_t AVCodecPtr, uint32_t AVFormatCtxPtr, FuncInst = AVCodecMod->findFuncExports( "wasmedge_ffmpeg_avcodec_avcodeccontext_codec_id"); + ASSERT_NE(FuncInst, nullptr); + ASSERT_TRUE(FuncInst->isHostFunction()); auto &HostFuncAVCodecContextCodecId = FuncInst->getHostFunc(); HostFuncAVCodecContextCodecId.run( @@ -92,6 +103,8 @@ void FFmpegTest::initFFmpegStructs(uint32_t AVCodecPtr, uint32_t AVFormatCtxPtr, FuncInst = AVCodecMod->findFuncExports( "wasmedge_ffmpeg_avcodec_avcodec_find_decoder"); + ASSERT_NE(FuncInst, nullptr); + ASSERT_TRUE(FuncInst->isHostFunction()); auto &HostFuncAVCodecFindDecoder = FuncInst->getHostFunc(); HostFuncAVCodecFindDecoder.run( @@ -102,6 +115,8 @@ void FFmpegTest::initFFmpegStructs(uint32_t AVCodecPtr, uint32_t AVFormatCtxPtr, FuncInst = AVCodecMod->findFuncExports("wasmedge_ffmpeg_avcodec_avcodec_open2"); + ASSERT_NE(FuncInst, nullptr); + ASSERT_TRUE(FuncInst->isHostFunction()); auto &HostFuncAVCodecOpen2 = FuncInst->getHostFunc(); HostFuncAVCodecOpen2.run( @@ -114,18 +129,26 @@ void FFmpegTest::initFFmpegStructs(uint32_t AVCodecPtr, uint32_t AVFormatCtxPtr, FuncInst = AVCodecMod->findFuncExports( "wasmedge_ffmpeg_avcodec_avcodec_receive_frame"); + ASSERT_NE(FuncInst, nullptr); + ASSERT_TRUE(FuncInst->isHostFunction()); auto &HostFuncAVCodecReceiveFrame = FuncInst->getHostFunc(); FuncInst = AVFormatMod->findFuncExports("wasmedge_ffmpeg_avformat_av_read_frame"); + ASSERT_NE(FuncInst, nullptr); + ASSERT_TRUE(FuncInst->isHostFunction()); auto &HostFuncAVReadFrame = FuncInst->getHostFunc(); FuncInst = AVCodecMod->findFuncExports( "wasmedge_ffmpeg_avcodec_avcodec_send_packet"); + ASSERT_NE(FuncInst, nullptr); + ASSERT_TRUE(FuncInst->isHostFunction()); auto &HostFuncAVCodecSendPacket = FuncInst->getHostFunc(); FuncInst = AVCodecMod->findFuncExports( "wasmedge_ffmpeg_avcodec_av_packet_stream_index"); + ASSERT_NE(FuncInst, nullptr); + ASSERT_TRUE(FuncInst->isHostFunction()); auto &HostFuncAVPacketStreamIndex = FuncInst->getHostFunc(); while (true) { @@ -186,6 +209,8 @@ void FFmpegTest::initFormatCtx(uint32_t AVFormatCtxPtr, uint32_t FilePtr, auto *FuncInst = AVFormatMod->findFuncExports( "wasmedge_ffmpeg_avformat_avformat_open_input"); + ASSERT_NE(FuncInst, nullptr); + ASSERT_TRUE(FuncInst->isHostFunction()); auto &HostFuncAVFormatOpenInput = FuncInst->getHostFunc(); HostFuncAVFormatOpenInput.run( CallFrame, @@ -204,6 +229,8 @@ void FFmpegTest::initDict(uint32_t DictPtr, uint32_t KeyPtr, std::string Key, auto *FuncInst = AVUtilMod->findFuncExports("wasmedge_ffmpeg_avutil_av_dict_set"); + ASSERT_NE(FuncInst, nullptr); + ASSERT_TRUE(FuncInst->isHostFunction()); auto &HostFuncAVDictSet = FuncInst->getHostFunc(); HostFuncAVDictSet.run(CallFrame, @@ -215,6 +242,8 @@ void FFmpegTest::initDict(uint32_t DictPtr, uint32_t KeyPtr, std::string Key, void FFmpegTest::allocPacket(uint32_t PacketPtr) { auto *FuncInst = AVCodecMod->findFuncExports("wasmedge_ffmpeg_avcodec_av_packet_alloc"); + ASSERT_NE(FuncInst, nullptr); + ASSERT_TRUE(FuncInst->isHostFunction()); auto &HostFuncAVPacketAlloc = FuncInst->getHostFunc(); HostFuncAVPacketAlloc.run( diff --git a/test/plugins/wasmedge_process/wasmedge_process.cpp b/test/plugins/wasmedge_process/wasmedge_process.cpp index 0503749b..5763187c 100644 --- a/test/plugins/wasmedge_process/wasmedge_process.cpp +++ b/test/plugins/wasmedge_process/wasmedge_process.cpp @@ -82,8 +82,8 @@ TEST(WasmEdgeProcessTest, SetProgName) { // Get the function "wasmedge_process_set_prog_name". auto *FuncInst = ProcMod->findFuncExports("wasmedge_process_set_prog_name"); - EXPECT_NE(FuncInst, nullptr); - EXPECT_TRUE(FuncInst->isHostFunction()); + ASSERT_NE(FuncInst, nullptr); + ASSERT_TRUE(FuncInst->isHostFunction()); auto &HostFuncInst = FuncInst->getHostFunc(); // Test: Run function successfully. @@ -126,8 +126,8 @@ TEST(WasmEdgeProcessTest, AddArg) { // Get the function "wasmedge_process_add_arg". auto *FuncInst = ProcMod->findFuncExports("wasmedge_process_add_arg"); - EXPECT_NE(FuncInst, nullptr); - EXPECT_TRUE(FuncInst->isHostFunction()); + ASSERT_NE(FuncInst, nullptr); + ASSERT_TRUE(FuncInst->isHostFunction()); auto &HostFuncInst = FuncInst->getHostFunc(); // Test: Run function successfully to add "arg1". @@ -189,8 +189,8 @@ TEST(WasmEdgeProcessTest, AddEnv) { // Get the function "wasmedge_process_add_env". auto *FuncInst = ProcMod->findFuncExports("wasmedge_process_add_env"); - EXPECT_NE(FuncInst, nullptr); - EXPECT_TRUE(FuncInst->isHostFunction()); + ASSERT_NE(FuncInst, nullptr); + ASSERT_TRUE(FuncInst->isHostFunction()); auto &HostFuncInst = FuncInst->getHostFunc(); // Test: Run function successfully to add "ENV1", "VALUE1". @@ -243,8 +243,8 @@ TEST(WasmEdgeProcessTest, AddStdIn) { // Get the function "wasmedge_process_add_stdin". auto *FuncInst = ProcMod->findFuncExports("wasmedge_process_add_stdin"); - EXPECT_NE(FuncInst, nullptr); - EXPECT_TRUE(FuncInst->isHostFunction()); + ASSERT_NE(FuncInst, nullptr); + ASSERT_TRUE(FuncInst->isHostFunction()); auto &HostFuncInst = FuncInst->getHostFunc(); // Test: Run function successfully to add "\01\02\03\04". @@ -281,8 +281,8 @@ TEST(WasmEdgeProcessTest, SetTimeOut) { // Get the function "wasmedge_process_set_timeout". auto *FuncInst = ProcMod->findFuncExports("wasmedge_process_set_timeout"); - EXPECT_NE(FuncInst, nullptr); - EXPECT_TRUE(FuncInst->isHostFunction()); + ASSERT_NE(FuncInst, nullptr); + ASSERT_TRUE(FuncInst->isHostFunction()); auto &HostFuncInst = FuncInst->getHostFunc(); // Test: Run function successfully to set timeout 100. @@ -316,8 +316,8 @@ TEST(WasmEdgeProcessTest, Run) { // Get the function "wasmedge_process_run". auto *FuncInst = ProcMod->findFuncExports("wasmedge_process_run"); - EXPECT_NE(FuncInst, nullptr); - EXPECT_TRUE(FuncInst->isHostFunction()); + ASSERT_NE(FuncInst, nullptr); + ASSERT_TRUE(FuncInst->isHostFunction()); auto &HostFuncInst = FuncInst->getHostFunc(); // Return value. @@ -377,8 +377,8 @@ TEST(WasmEdgeProcessTest, TimeoutPrecision) { // Get the function "wasmedge_process_run". auto *FuncInst = ProcMod->findFuncExports("wasmedge_process_run"); - EXPECT_NE(FuncInst, nullptr); - EXPECT_TRUE(FuncInst->isHostFunction()); + ASSERT_NE(FuncInst, nullptr); + ASSERT_TRUE(FuncInst->isHostFunction()); auto &HostFuncRun = FuncInst->getHostFunc(); // Return value. @@ -419,8 +419,8 @@ TEST(WasmEdgeProcessTest, GetExitCode) { // Get the function "wasmedge_process_get_exit_code". auto *FuncInst = ProcMod->findFuncExports("wasmedge_process_get_exit_code"); - EXPECT_NE(FuncInst, nullptr); - EXPECT_TRUE(FuncInst->isHostFunction()); + ASSERT_NE(FuncInst, nullptr); + ASSERT_TRUE(FuncInst->isHostFunction()); auto &HostFuncInst = FuncInst->getHostFunc(); // Test: Run function successfully to get exit code. @@ -449,18 +449,18 @@ TEST(WasmEdgeProcessTest, GetStdOut) { // Get the function "wasmedge_process_run". auto *FuncInst = ProcMod->findFuncExports("wasmedge_process_run"); - EXPECT_NE(FuncInst, nullptr); - EXPECT_TRUE(FuncInst->isHostFunction()); + ASSERT_NE(FuncInst, nullptr); + ASSERT_TRUE(FuncInst->isHostFunction()); auto &HostFuncRun = FuncInst->getHostFunc(); // Get the function "wasmedge_process_run". FuncInst = ProcMod->findFuncExports("wasmedge_process_get_stdout_len"); - EXPECT_NE(FuncInst, nullptr); - EXPECT_TRUE(FuncInst->isHostFunction()); + ASSERT_NE(FuncInst, nullptr); + ASSERT_TRUE(FuncInst->isHostFunction()); auto &HostFuncGetStdOutLen = FuncInst->getHostFunc(); // Get the function "wasmedge_process_run". FuncInst = ProcMod->findFuncExports("wasmedge_process_get_stdout"); - EXPECT_NE(FuncInst, nullptr); - EXPECT_TRUE(FuncInst->isHostFunction()); + ASSERT_NE(FuncInst, nullptr); + ASSERT_TRUE(FuncInst->isHostFunction()); auto &HostFuncGetStdOut = FuncInst->getHostFunc(); // Return value. @@ -511,18 +511,18 @@ TEST(WasmEdgeProcessTest, GetStdErr) { // Get the function "wasmedge_process_run". auto *FuncInst = ProcMod->findFuncExports("wasmedge_process_run"); - EXPECT_NE(FuncInst, nullptr); - EXPECT_TRUE(FuncInst->isHostFunction()); + ASSERT_NE(FuncInst, nullptr); + ASSERT_TRUE(FuncInst->isHostFunction()); auto &HostFuncRun = FuncInst->getHostFunc(); // Get the function "wasmedge_process_run". FuncInst = ProcMod->findFuncExports("wasmedge_process_get_stderr_len"); - EXPECT_NE(FuncInst, nullptr); - EXPECT_TRUE(FuncInst->isHostFunction()); + ASSERT_NE(FuncInst, nullptr); + ASSERT_TRUE(FuncInst->isHostFunction()); auto &HostFuncGetStdErrLen = FuncInst->getHostFunc(); // Get the function "wasmedge_process_run". FuncInst = ProcMod->findFuncExports("wasmedge_process_get_stderr"); - EXPECT_NE(FuncInst, nullptr); - EXPECT_TRUE(FuncInst->isHostFunction()); + ASSERT_NE(FuncInst, nullptr); + ASSERT_TRUE(FuncInst->isHostFunction()); auto &HostFuncGetStdErr = FuncInst->getHostFunc(); // Return value. diff --git a/test/plugins/wasmedge_stablediffusion/wasmedge_stablediffusion.cpp b/test/plugins/wasmedge_stablediffusion/wasmedge_stablediffusion.cpp index f444c7ab..018b666f 100644 --- a/test/plugins/wasmedge_stablediffusion/wasmedge_stablediffusion.cpp +++ b/test/plugins/wasmedge_stablediffusion/wasmedge_stablediffusion.cpp @@ -87,23 +87,23 @@ TEST(WasmEdgeStableDiffusionTest, ModuleFunctions) { // Get the function "convert". auto *FuncInst = SBMod->findFuncExports("convert"); - EXPECT_NE(FuncInst, nullptr); - EXPECT_TRUE(FuncInst->isHostFunction()); + ASSERT_NE(FuncInst, nullptr); + ASSERT_TRUE(FuncInst->isHostFunction()); auto &HostFuncConvert = FuncInst->getHostFunc(); // Get the function "create_context". FuncInst = SBMod->findFuncExports("create_context"); - EXPECT_NE(FuncInst, nullptr); - EXPECT_TRUE(FuncInst->isHostFunction()); + ASSERT_NE(FuncInst, nullptr); + ASSERT_TRUE(FuncInst->isHostFunction()); auto &HostFuncCreateContext = FuncInst->getHostFunc(); // Get the function "text_to_image". FuncInst = SBMod->findFuncExports("text_to_image"); - EXPECT_NE(FuncInst, nullptr); - EXPECT_TRUE(FuncInst->isHostFunction()); + ASSERT_NE(FuncInst, nullptr); + ASSERT_TRUE(FuncInst->isHostFunction()); auto &HostFuncTextToImage = FuncInst->getHostFunc(); // Get the function "image_to_image". FuncInst = SBMod->findFuncExports("image_to_image"); - EXPECT_NE(FuncInst, nullptr); - EXPECT_TRUE(FuncInst->isHostFunction()); + ASSERT_NE(FuncInst, nullptr); + ASSERT_TRUE(FuncInst->isHostFunction()); auto &HostFuncImageToImage = FuncInst->getHostFunc(); std::string Prompt = "a lovely cat"; From f8e7223286923cf57cb5316e4894f7074d5cbb6a Mon Sep 17 00:00:00 2001 From: hydai Date: Thu, 18 Jun 2026 03:46:38 +0800 Subject: [PATCH 14/17] docs(test/plugins/wasm_bpf): correct copied comment to wasm_bpf_map_operate Two comments labelled the lookup as wasm_bpf_map_fd_by_name while the export actually fetched is wasm_bpf_map_operate, a copy-paste leftover that misleads when navigating the test. Assisted-by: Claude (Anthropic) Signed-off-by: hydai --- test/plugins/wasm_bpf/simple_map_test.cpp | 2 +- test/plugins/wasm_bpf/wasm_bpf.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/test/plugins/wasm_bpf/simple_map_test.cpp b/test/plugins/wasm_bpf/simple_map_test.cpp index db128139..f8a711f9 100644 --- a/test/plugins/wasm_bpf/simple_map_test.cpp +++ b/test/plugins/wasm_bpf/simple_map_test.cpp @@ -161,7 +161,7 @@ TEST(WasmBpfTest, SimpleMapTest) { auto mapFd = mapFdResult[0].get(); ASSERT_GE(mapFd, 0); - // Get function `wasm_bpf_map_fd_by_name` + // Get function `wasm_bpf_map_operate` auto *mapOptFunc = module->findFuncExports("wasm_bpf_map_operate"); ASSERT_NE(mapOptFunc, nullptr); ASSERT_TRUE(mapOptFunc->isHostFunction()); diff --git a/test/plugins/wasm_bpf/wasm_bpf.cpp b/test/plugins/wasm_bpf/wasm_bpf.cpp index d8d25c59..0f0dcba6 100644 --- a/test/plugins/wasm_bpf/wasm_bpf.cpp +++ b/test/plugins/wasm_bpf/wasm_bpf.cpp @@ -454,7 +454,7 @@ TEST(WasmBpfTest, RunBpfProgramWithMapOperation) { auto histsFd = mapFdResult[0].get(); EXPECT_GE(histsFd, 0); - // Get function `wasm_bpf_map_fd_by_name` + // Get function `wasm_bpf_map_operate` auto *mapOptFunc = module->findFuncExports("wasm_bpf_map_operate"); ASSERT_NE(mapOptFunc, nullptr); ASSERT_TRUE(mapOptFunc->isHostFunction()); From cf526fa01383ec51f09b9ca3b92b2131638cee87 Mon Sep 17 00:00:00 2001 From: hydai Date: Thu, 18 Jun 2026 18:10:00 +0800 Subject: [PATCH 15/17] test(plugins): assert host-call outputs to preserve devirtualized bindings Replacing the concrete dynamic_cast host-function lookups with getHostFunc() dropped the only check that each export was wired to the correct, same-signature host function: a call that copies bytes into memory or returns a scalar still reports ErrNo::Success when mis-bound. Read the written output back or pin a distinguishing value so every export binding stays observable. wasmedge_ffmpeg name and scalar readbacks: - avPixfmt: av_color_range_name (pc), av_color_transfer_name (smpte170m), av_color_space_name / av_color_primaries_name (bt709), av_pix_format_name (yuv420p). - avCodec: avcodec_get_name (h264) and avcodec_get_long_name. - avSampleFmt: av_get_sample_fmt_name (u8). - avInputFormat: name (mov,mp4,...) and long_name (QuickTime / MOV). - avfilter: avfilter_name (abuffer), description, pad_get_name. - avDictionary: av_dict_get_key_value copies KEY/VALUE; read both back. - avError: av_strerror ran with no arguments; pass the real buffer and assert. - av_log_get_flags ran with a stray argument; call the setter with an empty result span and the getter with none, then assert the flag. - utils: initEmptyFrame asserts the av_frame_alloc run() result. wasmedge_ffmpeg version, configuration/license, and codec-kind sweep: - version exports (avutil, avcodec, avformat, avfilter, swresample, swscale): assert the major-version byte (>> 16) is nonzero, so a swap with a configuration/license length getter no longer passes. - configuration/license copiers (all six modules): read back the buffer and require the configure-flag marker "--" to be present for configuration and absent for license, distinguishing the pair on both sides. - avformatContext duration: replace the tautological check with the sample asset's exact duration. - avcodec find_decoder_by_name / find_encoder_by_name: confirm the returned codec kind via av_codec_is_decoder / av_codec_is_encoder. wasmedge_process: - GetStdErr compares the StdErr buffer instead of the empty StdOut. - GetExitCode seeds a nonzero Env.ExitCode and asserts it. Assisted-by: Claude (Anthropic) Signed-off-by: hydai --- .../wasmedge_ffmpeg/avcodec/avCodec.cpp | 6 ++++ .../wasmedge_ffmpeg/avcodec/avCodecCtx.cpp | 2 +- .../wasmedge_ffmpeg/avcodec/avPacket.cpp | 35 ++++++++++--------- .../wasmedge_ffmpeg/avcodec/avcodec_func.cpp | 22 +++++++++++- .../wasmedge_ffmpeg/avfilter/avfilter.cpp | 13 +++++++ .../avfilter/avfilter_func.cpp | 10 +++++- .../avformat/avInputOutputContext.cpp | 7 ++++ .../avformat/avformatContext.cpp | 2 +- .../avformat/avformat_func.cpp | 10 +++++- .../wasmedge_ffmpeg/avutil/avDictionary.cpp | 7 +++- .../wasmedge_ffmpeg/avutil/avError.cpp | 9 ++--- .../wasmedge_ffmpeg/avutil/avFrame.cpp | 7 ++-- .../wasmedge_ffmpeg/avutil/avPixfmt.cpp | 16 +++++++++ .../wasmedge_ffmpeg/avutil/avSampleFmt.cpp | 3 ++ .../wasmedge_ffmpeg/avutil/avutil_func.cpp | 25 ++++++++----- .../swresample/swresample_func.cpp | 10 +++++- .../wasmedge_ffmpeg/swscale/swscale_func.cpp | 14 ++++++-- test/plugins/wasmedge_ffmpeg/utils.cpp | 4 +-- .../wasmedge_process/wasmedge_process.cpp | 7 ++-- 19 files changed, 163 insertions(+), 46 deletions(-) diff --git a/test/plugins/wasmedge_ffmpeg/avcodec/avCodec.cpp b/test/plugins/wasmedge_ffmpeg/avcodec/avCodec.cpp index 1b40cf31..91fafd42 100644 --- a/test/plugins/wasmedge_ffmpeg/avcodec/avCodec.cpp +++ b/test/plugins/wasmedge_ffmpeg/avcodec/avCodec.cpp @@ -121,6 +121,9 @@ TEST_F(FFmpegTest, AVCodec) { AVCodecId, StringPtr, Length}, Result)); EXPECT_EQ(Result[0].get(), static_cast(ErrNo::Success)); + EXPECT_EQ(std::string_view(MemInst->getPointer(StringPtr), + static_cast(Length)), + "h264"sv); } FuncInst = AVCodecMod->findFuncExports( @@ -154,6 +157,9 @@ TEST_F(FFmpegTest, AVCodec) { Length}, Result)); EXPECT_EQ(Result[0].get(), static_cast(ErrNo::Success)); + EXPECT_EQ(std::string_view(MemInst->getPointer(StringPtr), + static_cast(Length)), + "H.264 / AVC / MPEG-4 AVC / MPEG-4 part 10"sv); } FuncInst = diff --git a/test/plugins/wasmedge_ffmpeg/avcodec/avCodecCtx.cpp b/test/plugins/wasmedge_ffmpeg/avcodec/avCodecCtx.cpp index 530701e9..35f58df1 100644 --- a/test/plugins/wasmedge_ffmpeg/avcodec/avCodecCtx.cpp +++ b/test/plugins/wasmedge_ffmpeg/avcodec/avCodecCtx.cpp @@ -1293,7 +1293,7 @@ TEST_F(FFmpegTest, AVCodecCtx) { EXPECT_TRUE(HostFuncAVCodecCtxColorTrc.run( CallFrame, std::initializer_list{AVCodecCtxId}, Result)); - ASSERT_TRUE(Result[0].get() > 0); + EXPECT_EQ(Result[0].get(), 2); } FuncInst = AVCodecMod->findFuncExports( diff --git a/test/plugins/wasmedge_ffmpeg/avcodec/avPacket.cpp b/test/plugins/wasmedge_ffmpeg/avcodec/avPacket.cpp index 9b6ab307..0ef091d1 100644 --- a/test/plugins/wasmedge_ffmpeg/avcodec/avPacket.cpp +++ b/test/plugins/wasmedge_ffmpeg/avcodec/avPacket.cpp @@ -45,6 +45,20 @@ TEST_F(FFmpegTest, AVPacketTest) { ASSERT_TRUE(PacketId > 0); ASSERT_TRUE(PacketId2 > 0); + uint32_t PacketDataSize = 0; + FuncInst = + AVCodecMod->findFuncExports("wasmedge_ffmpeg_avcodec_av_packet_size"); + ASSERT_NE(FuncInst, nullptr); + ASSERT_TRUE(FuncInst->isHostFunction()); + auto &HostFuncAVPacketSize = FuncInst->getHostFunc(); + auto ExpectPacketSize = [&](uint32_t ExpectedSize) { + EXPECT_TRUE(HostFuncAVPacketSize.run( + CallFrame, std::initializer_list{PacketId}, + Result)); + PacketDataSize = static_cast(Result[0].get()); + EXPECT_EQ(PacketDataSize, ExpectedSize); + }; + FuncInst = AVCodecMod->findFuncExports("wasmedge_ffmpeg_avcodec_av_new_packet"); ASSERT_NE(FuncInst, nullptr); @@ -58,6 +72,7 @@ TEST_F(FFmpegTest, AVPacketTest) { CallFrame, std::initializer_list{PacketId, Size}, Result)); EXPECT_EQ(Result[0].get(), 0); + ExpectPacketSize(Size); } FuncInst = @@ -72,6 +87,7 @@ TEST_F(FFmpegTest, AVPacketTest) { CallFrame, std::initializer_list{PacketId, Size}, Result)); EXPECT_EQ(Result[0].get(), 0); + ExpectPacketSize(80); } FuncInst = @@ -86,6 +102,7 @@ TEST_F(FFmpegTest, AVPacketTest) { CallFrame, std::initializer_list{PacketId, Size}, Result)); EXPECT_EQ(Result[0].get(), 0); + ExpectPacketSize(Size); } uint32_t StreamIdx = 3; @@ -116,21 +133,6 @@ TEST_F(FFmpegTest, AVPacketTest) { EXPECT_EQ(Result[0].get(), StreamIdx); } - uint32_t Size = 0; - FuncInst = - AVCodecMod->findFuncExports("wasmedge_ffmpeg_avcodec_av_packet_size"); - ASSERT_NE(FuncInst, nullptr); - ASSERT_TRUE(FuncInst->isHostFunction()); - auto &HostFuncAVPacketSize = FuncInst->getHostFunc(); - - { - EXPECT_TRUE(HostFuncAVPacketSize.run( - CallFrame, std::initializer_list{PacketId}, - Result)); - Size = Result[0].get(); - EXPECT_TRUE(Size > 0); - } - uint32_t Flags = 5; FuncInst = AVCodecMod->findFuncExports( @@ -290,7 +292,8 @@ TEST_F(FFmpegTest, AVPacketTest) { { EXPECT_TRUE(HostFuncAVPacketData.run( CallFrame, - std::initializer_list{PacketId, DataPtr, Size}, + std::initializer_list{PacketId, DataPtr, + PacketDataSize}, Result)); EXPECT_EQ(Result[0].get(), static_cast(ErrNo::Success)); } diff --git a/test/plugins/wasmedge_ffmpeg/avcodec/avcodec_func.cpp b/test/plugins/wasmedge_ffmpeg/avcodec/avcodec_func.cpp index 5a2a2420..2403fd80 100644 --- a/test/plugins/wasmedge_ffmpeg/avcodec/avcodec_func.cpp +++ b/test/plugins/wasmedge_ffmpeg/avcodec/avcodec_func.cpp @@ -209,6 +209,12 @@ TEST_F(FFmpegTest, AVCodecFunc) { CodecNamePtr, Length}, Result)); EXPECT_EQ(Result[0].get(), static_cast(ErrNo::Success)); + + uint32_t DecoderByNameId = readUInt32(MemInst, CodecDecoderPtr); + EXPECT_TRUE(HostFuncAVCodecIsDecoder.run( + CallFrame, std::initializer_list{DecoderByNameId}, + Result)); + EXPECT_EQ(Result[0].get(), 1); } FuncInst = AVCodecMod->findFuncExports( @@ -227,6 +233,12 @@ TEST_F(FFmpegTest, AVCodecFunc) { CodecNamePtr, Length}, Result)); EXPECT_EQ(Result[0].get(), static_cast(ErrNo::Success)); + + uint32_t EncoderByNameId = readUInt32(MemInst, CodecEncoderPtr); + EXPECT_TRUE(HostFuncAVCodecIsEncoder.run( + CallFrame, std::initializer_list{EncoderByNameId}, + Result)); + EXPECT_EQ(Result[0].get(), 1); } FuncInst = AVCodecMod->findFuncExports( @@ -273,7 +285,7 @@ TEST_F(FFmpegTest, AVCodecFunc) { { EXPECT_TRUE(HostFuncAVCodecVersion.run( CallFrame, std::initializer_list{}, Result)); - EXPECT_TRUE(Result[0].get() > 0); + EXPECT_TRUE((Result[0].get() >> 16) > 0); } FuncInst = AVCodecMod->findFuncExports( @@ -305,6 +317,10 @@ TEST_F(FFmpegTest, AVCodecFunc) { CallFrame, std::initializer_list{StrPtr, Length}, Result)); EXPECT_EQ(Result[0].get(), static_cast(ErrNo::Success)); + EXPECT_NE(std::string_view(MemInst->getPointer(StrPtr), + static_cast(Length)) + .find("--"), + std::string_view::npos); } FuncInst = AVCodecMod->findFuncExports( @@ -336,6 +352,10 @@ TEST_F(FFmpegTest, AVCodecFunc) { CallFrame, std::initializer_list{StrPtr, Length}, Result)); EXPECT_EQ(Result[0].get(), static_cast(ErrNo::Success)); + EXPECT_EQ(std::string_view(MemInst->getPointer(StrPtr), + static_cast(Length)) + .find("--"), + std::string_view::npos); } FuncInst = AVCodecMod->findFuncExports( diff --git a/test/plugins/wasmedge_ffmpeg/avfilter/avfilter.cpp b/test/plugins/wasmedge_ffmpeg/avfilter/avfilter.cpp index 5a719b5b..0878e28a 100644 --- a/test/plugins/wasmedge_ffmpeg/avfilter/avfilter.cpp +++ b/test/plugins/wasmedge_ffmpeg/avfilter/avfilter.cpp @@ -14,6 +14,7 @@ namespace Host { namespace WasmEdgeFFmpeg { TEST_F(FFmpegTest, AVFilterStructs) { + using namespace std::literals::string_view_literals; ASSERT_TRUE(AVFilterMod != nullptr); uint32_t FilterPtr = UINT32_C(8); @@ -82,6 +83,9 @@ TEST_F(FFmpegTest, AVFilterStructs) { std::initializer_list{FilterId, StrPtr, Length}, Result)); EXPECT_EQ(Result[0].get(), static_cast(ErrNo::Success)); + EXPECT_EQ(std::string_view(MemInst->getPointer(StrPtr), + static_cast(Length)), + "abuffer"sv); } FuncInst = AVFilterMod->findFuncExports( @@ -114,6 +118,10 @@ TEST_F(FFmpegTest, AVFilterStructs) { std::initializer_list{FilterId, StrPtr, Length}, Result)); EXPECT_EQ(Result[0].get(), static_cast(ErrNo::Success)); + EXPECT_EQ(std::string_view(MemInst->getPointer(StrPtr), + static_cast(Length)), + "Buffer audio frames, and make them accessible to the " + "filterchain."sv); } FuncInst = AVFilterMod->findFuncExports( @@ -166,12 +174,14 @@ TEST_F(FFmpegTest, AVFilterStructs) { auto &HostFuncAVFilterGetInputsFilterPad = FuncInst->getHostFunc(); { + writeUInt32(MemInst, UINT32_C(0), InputFilterPadPtr); EXPECT_TRUE(HostFuncAVFilterGetInputsFilterPad.run( CallFrame, std::initializer_list{FilterId, InputFilterPadPtr}, Result)); EXPECT_EQ(Result[0].get(), static_cast(ErrNo::Success)); + EXPECT_EQ(readUInt32(MemInst, InputFilterPadPtr), UINT32_C(0)); } FuncInst = AVFilterMod->findFuncExports( @@ -224,6 +234,9 @@ TEST_F(FFmpegTest, AVFilterStructs) { StrPtr, Length}, Result)); EXPECT_EQ(Result[0].get(), static_cast(ErrNo::Success)); + EXPECT_EQ(std::string_view(MemInst->getPointer(StrPtr), + static_cast(Length)), + "default"sv); } FuncInst = AVFilterMod->findFuncExports( diff --git a/test/plugins/wasmedge_ffmpeg/avfilter/avfilter_func.cpp b/test/plugins/wasmedge_ffmpeg/avfilter/avfilter_func.cpp index ead1bd1d..41c4e219 100644 --- a/test/plugins/wasmedge_ffmpeg/avfilter/avfilter_func.cpp +++ b/test/plugins/wasmedge_ffmpeg/avfilter/avfilter_func.cpp @@ -384,7 +384,7 @@ TEST_F(FFmpegTest, AVFilterFunc) { { EXPECT_TRUE(HostFuncAVFilterVersion.run( CallFrame, std::initializer_list{}, Result)); - ASSERT_TRUE(Result[0].get() > 0); + ASSERT_TRUE((Result[0].get() >> 16) > 0); } FuncInst = AVFilterMod->findFuncExports( @@ -414,6 +414,10 @@ TEST_F(FFmpegTest, AVFilterFunc) { CallFrame, std::initializer_list{StrPtr, Length}, Result)); EXPECT_EQ(Result[0].get(), static_cast(ErrNo::Success)); + EXPECT_NE(std::string_view(MemInst->getPointer(StrPtr), + static_cast(Length)) + .find("--"), + std::string_view::npos); } FuncInst = AVFilterMod->findFuncExports( @@ -442,6 +446,10 @@ TEST_F(FFmpegTest, AVFilterFunc) { CallFrame, std::initializer_list{StrPtr, Length}, Result)); EXPECT_EQ(Result[0].get(), static_cast(ErrNo::Success)); + EXPECT_EQ(std::string_view(MemInst->getPointer(StrPtr), + static_cast(Length)) + .find("--"), + std::string_view::npos); } // ================================================================== diff --git a/test/plugins/wasmedge_ffmpeg/avformat/avInputOutputContext.cpp b/test/plugins/wasmedge_ffmpeg/avformat/avInputOutputContext.cpp index 0211fe4c..0345bce0 100644 --- a/test/plugins/wasmedge_ffmpeg/avformat/avInputOutputContext.cpp +++ b/test/plugins/wasmedge_ffmpeg/avformat/avInputOutputContext.cpp @@ -14,6 +14,7 @@ namespace Host { namespace WasmEdgeFFmpeg { TEST_F(FFmpegTest, AVInputFormat) { + using namespace std::literals::string_view_literals; std::string FileName = "ffmpeg-assets/sample_video.mp4"; // 32 chars uint32_t FormatCtxPtr = UINT32_C(24); uint32_t InputFormatPtr = UINT32_C(28); @@ -78,6 +79,9 @@ TEST_F(FFmpegTest, AVInputFormat) { Length}, Result)); EXPECT_EQ(Result[0].get(), static_cast(ErrNo::Success)); + EXPECT_EQ(std::string_view(MemInst->getPointer(StrBuf), + static_cast(Length)), + "mov,mp4,m4a,3gp,3g2,mj2"sv); } FuncInst = AVFormatMod->findFuncExports( @@ -109,6 +113,9 @@ TEST_F(FFmpegTest, AVInputFormat) { Result)); EXPECT_EQ(Result[0].get(), static_cast(ErrNo::Success)); + EXPECT_EQ(std::string_view(MemInst->getPointer(StrBuf), + static_cast(Length)), + "QuickTime / MOV"sv); } FuncInst = AVFormatMod->findFuncExports( diff --git a/test/plugins/wasmedge_ffmpeg/avformat/avformatContext.cpp b/test/plugins/wasmedge_ffmpeg/avformat/avformatContext.cpp index 68795aef..b3146a77 100644 --- a/test/plugins/wasmedge_ffmpeg/avformat/avformatContext.cpp +++ b/test/plugins/wasmedge_ffmpeg/avformat/avformatContext.cpp @@ -92,7 +92,7 @@ TEST_F(FFmpegTest, AVFormatContextStruct) { EXPECT_TRUE(HostFuncAVFormatCtxDuration.run( CallFrame, std::initializer_list{FormatCtxId}, Result)); - EXPECT_TRUE(Result[0].get() >= 0 || Result[0].get() < 0); + EXPECT_EQ(Result[0].get(), INT64_C(2000000)); } FuncInst = AVFormatMod->findFuncExports( diff --git a/test/plugins/wasmedge_ffmpeg/avformat/avformat_func.cpp b/test/plugins/wasmedge_ffmpeg/avformat/avformat_func.cpp index b2bfdd82..dc9ad3a7 100644 --- a/test/plugins/wasmedge_ffmpeg/avformat/avformat_func.cpp +++ b/test/plugins/wasmedge_ffmpeg/avformat/avformat_func.cpp @@ -243,7 +243,7 @@ TEST_F(FFmpegTest, AVInputFormatFunc) { EXPECT_TRUE(HostFuncAVFormatVersion.run( CallFrame, std::initializer_list{}, Result)); - EXPECT_TRUE(Result[0].get() >= 0); + EXPECT_TRUE((Result[0].get() >> 16) > 0); } FuncInst = AVFormatMod->findFuncExports( @@ -274,6 +274,10 @@ TEST_F(FFmpegTest, AVInputFormatFunc) { Result)); EXPECT_TRUE(Result[0].get() >= 0); + EXPECT_NE(std::string_view(MemInst->getPointer(StrPtr), + static_cast(Length)) + .find("--"), + std::string_view::npos); } FuncInst = AVFormatMod->findFuncExports( @@ -304,6 +308,10 @@ TEST_F(FFmpegTest, AVInputFormatFunc) { Result)); EXPECT_TRUE(Result[0].get() >= 0); + EXPECT_EQ(std::string_view(MemInst->getPointer(StrPtr), + static_cast(Length)) + .find("--"), + std::string_view::npos); } } diff --git a/test/plugins/wasmedge_ffmpeg/avutil/avDictionary.cpp b/test/plugins/wasmedge_ffmpeg/avutil/avDictionary.cpp index 43e5bef1..823e5a9b 100644 --- a/test/plugins/wasmedge_ffmpeg/avutil/avDictionary.cpp +++ b/test/plugins/wasmedge_ffmpeg/avutil/avDictionary.cpp @@ -114,7 +114,12 @@ TEST_F(FFmpegTest, AVDictionary) { UINT32_C(3), PrevDictEntryIdx, Flags}, Result)); EXPECT_EQ(Result[0].get(), 1); - // Verify String. Read String from MemInst + EXPECT_EQ(std::string_view(MemInst->getPointer(KeyBufPtr), + static_cast(KeyLen)), + "KEY"sv); + EXPECT_EQ(std::string_view(MemInst->getPointer(ValueBufPtr), + static_cast(ValueLen)), + "VALUE"sv); // Pass a Null Dict and testing. EXPECT_TRUE(HostFuncAVDictGetKeyValue.run( diff --git a/test/plugins/wasmedge_ffmpeg/avutil/avError.cpp b/test/plugins/wasmedge_ffmpeg/avutil/avError.cpp index a30c999e..d191a323 100644 --- a/test/plugins/wasmedge_ffmpeg/avutil/avError.cpp +++ b/test/plugins/wasmedge_ffmpeg/avutil/avError.cpp @@ -29,10 +29,11 @@ TEST_F(FFmpegTest, AVError) { auto &HostFuncAVUtilAVStrError = FuncInst->getHostFunc(); { - HostFuncAVUtilAVStrError.run( - CallFrame, std::initializer_list{}, Result); - - EXPECT_EQ(Result[0].get(), 0); + EXPECT_TRUE(HostFuncAVUtilAVStrError.run( + CallFrame, + std::initializer_list{ErrNum, ErrStartPtr, + ErrSize}, + Result)); } FuncInst = AVUtilMod->findFuncExports("wasmedge_ffmpeg_avutil_AVERROR"); diff --git a/test/plugins/wasmedge_ffmpeg/avutil/avFrame.cpp b/test/plugins/wasmedge_ffmpeg/avutil/avFrame.cpp index 80bfd9d0..eb7ed6cb 100644 --- a/test/plugins/wasmedge_ffmpeg/avutil/avFrame.cpp +++ b/test/plugins/wasmedge_ffmpeg/avutil/avFrame.cpp @@ -36,12 +36,13 @@ TEST_F(FFmpegTest, AVFrame) { ASSERT_TRUE(FuncInst->isHostFunction()); auto &HostFuncAVFrameAlloc = FuncInst->getHostFunc(); - uint32_t EmptyFramePtr = UINT32_C(64); + uint32_t EmptyFramePtr = UINT32_C(88); { - HostFuncAVFrameAlloc.run( + writeUInt32(MemInst, UINT32_C(0), EmptyFramePtr); + EXPECT_TRUE(HostFuncAVFrameAlloc.run( CallFrame, std::initializer_list{EmptyFramePtr}, - Result); + Result)); EXPECT_EQ(Result[0].get(), static_cast(ErrNo::Success)); EXPECT_TRUE(readUInt32(MemInst, EmptyFramePtr) > 0); diff --git a/test/plugins/wasmedge_ffmpeg/avutil/avPixfmt.cpp b/test/plugins/wasmedge_ffmpeg/avutil/avPixfmt.cpp index f71d8397..a7df9b4c 100644 --- a/test/plugins/wasmedge_ffmpeg/avutil/avPixfmt.cpp +++ b/test/plugins/wasmedge_ffmpeg/avutil/avPixfmt.cpp @@ -13,6 +13,7 @@ namespace Host { namespace WasmEdgeFFmpeg { TEST_F(FFmpegTest, AVPixFmt) { + using namespace std::literals::string_view_literals; uint32_t NamePtr = UINT32_C(4); auto *FuncInst = AVUtilMod->findFuncExports( @@ -91,6 +92,9 @@ TEST_F(FFmpegTest, AVPixFmt) { Result); EXPECT_EQ(Result[0].get(), static_cast(ErrNo::Success)); + EXPECT_EQ(std::string_view(MemInst->getPointer(NamePtr), + static_cast(Length)), + "smpte170m"sv); } int32_t ColorRangeId = 2; //; JPEG @@ -124,6 +128,9 @@ TEST_F(FFmpegTest, AVPixFmt) { Result); EXPECT_EQ(Result[0].get(), static_cast(ErrNo::Success)); + EXPECT_EQ(std::string_view(MemInst->getPointer(NamePtr), + static_cast(Length)), + std::string_view("pc"sv)); } int32_t ColorSpaceId = 1; // BT709 @@ -157,6 +164,9 @@ TEST_F(FFmpegTest, AVPixFmt) { Result); EXPECT_EQ(Result[0].get(), static_cast(ErrNo::Success)); + EXPECT_EQ(std::string_view(MemInst->getPointer(NamePtr), + static_cast(Length)), + "bt709"sv); } int32_t ColorPrimariesId = 1; // BT709 @@ -191,6 +201,9 @@ TEST_F(FFmpegTest, AVPixFmt) { Result); EXPECT_EQ(Result[0].get(), static_cast(ErrNo::Success)); + EXPECT_EQ(std::string_view(MemInst->getPointer(NamePtr), + static_cast(Length)), + "bt709"sv); } PixFmtId = 1; // YUV420P @@ -224,6 +237,9 @@ TEST_F(FFmpegTest, AVPixFmt) { Result); EXPECT_EQ(Result[0].get(), static_cast(ErrNo::Success)); + EXPECT_EQ(std::string_view(MemInst->getPointer(NamePtr), + static_cast(Length)), + "yuv420p"sv); } FuncInst = diff --git a/test/plugins/wasmedge_ffmpeg/avutil/avSampleFmt.cpp b/test/plugins/wasmedge_ffmpeg/avutil/avSampleFmt.cpp index dcf76ce2..05e5ac8a 100644 --- a/test/plugins/wasmedge_ffmpeg/avutil/avSampleFmt.cpp +++ b/test/plugins/wasmedge_ffmpeg/avutil/avSampleFmt.cpp @@ -168,6 +168,9 @@ TEST_F(FFmpegTest, AVSampleFmt) { Result); EXPECT_EQ(Result[0].get(), static_cast(ErrNo::Success)); + EXPECT_EQ(std::string_view(MemInst->getPointer(NamePtr), + static_cast(Length)), + "u8"sv); } FuncInst = AVUtilMod->findFuncExports( diff --git a/test/plugins/wasmedge_ffmpeg/avutil/avutil_func.cpp b/test/plugins/wasmedge_ffmpeg/avutil/avutil_func.cpp index 07e568b2..19b582f3 100644 --- a/test/plugins/wasmedge_ffmpeg/avutil/avutil_func.cpp +++ b/test/plugins/wasmedge_ffmpeg/avutil/avutil_func.cpp @@ -49,9 +49,10 @@ TEST_F(FFmpegTest, AVUtilFunc) { ASSERT_TRUE(FuncInst->isHostFunction()); auto &HostFuncAVLogSetFlags = FuncInst->getHostFunc(); + int32_t FlagId = 1; { - HostFuncAVLogSetFlags.run( - CallFrame, std::initializer_list{1}, Result); + EXPECT_TRUE(HostFuncAVLogSetFlags.run( + CallFrame, std::initializer_list{FlagId}, {})); } FuncInst = @@ -61,10 +62,10 @@ TEST_F(FFmpegTest, AVUtilFunc) { auto &HostFuncAVLogGetFlags = FuncInst->getHostFunc(); { - HostFuncAVLogGetFlags.run( - CallFrame, std::initializer_list{1}, Result); + EXPECT_TRUE(HostFuncAVLogGetFlags.run( + CallFrame, std::initializer_list{}, Result)); - EXPECT_EQ(Result[0].get(), 32); + EXPECT_EQ(Result[0].get(), FlagId); } FuncInst = AVUtilMod->findFuncExports("wasmedge_ffmpeg_avutil_av_rescale_q"); @@ -110,10 +111,10 @@ TEST_F(FFmpegTest, AVUtilFunc) { auto &HostFuncAVUtilVersion = FuncInst->getHostFunc(); { - HostFuncAVUtilVersion.run( - CallFrame, std::initializer_list{}, Result); + EXPECT_TRUE(HostFuncAVUtilVersion.run( + CallFrame, std::initializer_list{}, Result)); - EXPECT_TRUE(Result[0].get() > 0); + EXPECT_TRUE((Result[0].get() >> 16) > 0); } uint64_t ChannelId = 1; // FRONT_LEFT @@ -171,6 +172,10 @@ TEST_F(FFmpegTest, AVUtilFunc) { CallFrame, std::initializer_list{NamePtr, Length}, Result); EXPECT_EQ(Result[0].get(), static_cast(ErrNo::Success)); + EXPECT_NE(std::string_view(MemInst->getPointer(NamePtr), + static_cast(Length)) + .find("--"), + std::string_view::npos); } FuncInst = AVUtilMod->findFuncExports( @@ -200,6 +205,10 @@ TEST_F(FFmpegTest, AVUtilFunc) { CallFrame, std::initializer_list{NamePtr, Length}, Result); EXPECT_EQ(Result[0].get(), static_cast(ErrNo::Success)); + EXPECT_EQ(std::string_view(MemInst->getPointer(NamePtr), + static_cast(Length)) + .find("--"), + std::string_view::npos); } } diff --git a/test/plugins/wasmedge_ffmpeg/swresample/swresample_func.cpp b/test/plugins/wasmedge_ffmpeg/swresample/swresample_func.cpp index 3b945475..832f8e72 100644 --- a/test/plugins/wasmedge_ffmpeg/swresample/swresample_func.cpp +++ b/test/plugins/wasmedge_ffmpeg/swresample/swresample_func.cpp @@ -43,7 +43,7 @@ TEST_F(FFmpegTest, SWResampleFunc) { { EXPECT_TRUE(HostFuncSWResampleVersion.run(CallFrame, {}, Result)); - ASSERT_TRUE(Result[0].get() > 0); + ASSERT_TRUE((Result[0].get() >> 16) > 0); } FuncInst = SWResampleMod->findFuncExports( @@ -199,6 +199,10 @@ TEST_F(FFmpegTest, SWResampleFunc) { CallFrame, std::initializer_list{StrPtr, Length}, Result)); EXPECT_EQ(Result[0].get(), static_cast(ErrNo::Success)); + EXPECT_NE(std::string_view(MemInst->getPointer(StrPtr), + static_cast(Length)) + .find("--"), + std::string_view::npos); } FuncInst = SWResampleMod->findFuncExports( @@ -228,6 +232,10 @@ TEST_F(FFmpegTest, SWResampleFunc) { CallFrame, std::initializer_list{StrPtr, Length}, Result)); EXPECT_EQ(Result[0].get(), static_cast(ErrNo::Success)); + EXPECT_EQ(std::string_view(MemInst->getPointer(StrPtr), + static_cast(Length)) + .find("--"), + std::string_view::npos); } } diff --git a/test/plugins/wasmedge_ffmpeg/swscale/swscale_func.cpp b/test/plugins/wasmedge_ffmpeg/swscale/swscale_func.cpp index 9e739c14..90bd473f 100644 --- a/test/plugins/wasmedge_ffmpeg/swscale/swscale_func.cpp +++ b/test/plugins/wasmedge_ffmpeg/swscale/swscale_func.cpp @@ -429,10 +429,10 @@ TEST_F(FFmpegTest, SWScaleVersion) { auto &HostFuncSwscaleVersion = FuncInst->getHostFunc(); { - HostFuncSwscaleVersion.run( - CallFrame, std::initializer_list{}, Result); + EXPECT_TRUE(HostFuncSwscaleVersion.run( + CallFrame, std::initializer_list{}, Result)); - EXPECT_TRUE(Result[0].get() > 0); + EXPECT_TRUE((Result[0].get() >> 16) > 0); } FuncInst = SWScaleMod->findFuncExports( @@ -463,6 +463,10 @@ TEST_F(FFmpegTest, SWScaleVersion) { CallFrame, std::initializer_list{NamePtr, Length}, Result); EXPECT_EQ(Result[0].get(), static_cast(ErrNo::Success)); + EXPECT_NE(std::string_view(MemInst->getPointer(NamePtr), + static_cast(Length)) + .find("--"), + std::string_view::npos); } FuncInst = SWScaleMod->findFuncExports( @@ -492,6 +496,10 @@ TEST_F(FFmpegTest, SWScaleVersion) { CallFrame, std::initializer_list{NamePtr, Length}, Result); EXPECT_EQ(Result[0].get(), static_cast(ErrNo::Success)); + EXPECT_EQ(std::string_view(MemInst->getPointer(NamePtr), + static_cast(Length)) + .find("--"), + std::string_view::npos); } } diff --git a/test/plugins/wasmedge_ffmpeg/utils.cpp b/test/plugins/wasmedge_ffmpeg/utils.cpp index d4ed035c..ce2101df 100644 --- a/test/plugins/wasmedge_ffmpeg/utils.cpp +++ b/test/plugins/wasmedge_ffmpeg/utils.cpp @@ -21,8 +21,8 @@ void FFmpegTest::initEmptyFrame(uint32_t FramePtr) { ASSERT_NE(FuncInst, nullptr); ASSERT_TRUE(FuncInst->isHostFunction()); auto &HostFuncAVFrameAlloc = FuncInst->getHostFunc(); - HostFuncAVFrameAlloc.run( - CallFrame, std::initializer_list{FramePtr}, Result); + ASSERT_TRUE(HostFuncAVFrameAlloc.run( + CallFrame, std::initializer_list{FramePtr}, Result)); } void FFmpegTest::initFFmpegStructs(uint32_t AVCodecPtr, uint32_t AVFormatCtxPtr, diff --git a/test/plugins/wasmedge_process/wasmedge_process.cpp b/test/plugins/wasmedge_process/wasmedge_process.cpp index 5763187c..dfec2a9d 100644 --- a/test/plugins/wasmedge_process/wasmedge_process.cpp +++ b/test/plugins/wasmedge_process/wasmedge_process.cpp @@ -424,9 +424,10 @@ TEST(WasmEdgeProcessTest, GetExitCode) { auto &HostFuncInst = FuncInst->getHostFunc(); // Test: Run function successfully to get exit code. + ProcMod->getEnv().ExitCode = 42; std::array RetVal; EXPECT_TRUE(HostFuncInst.run(DummyCallFrame, {}, RetVal)); - EXPECT_EQ(RetVal[0].get(), 0); + EXPECT_EQ(RetVal[0].get(), 42); } TEST(WasmEdgeProcessTest, GetStdOut) { @@ -547,8 +548,8 @@ TEST(WasmEdgeProcessTest, GetStdErr) { // Test: Run wasmedge_process_get_stdout successfully. EXPECT_TRUE(HostFuncGetStdErr.run( CallFrame, std::initializer_list{UINT32_C(0)}, {})); - EXPECT_TRUE(std::equal(ProcMod->getEnv().StdOut.begin(), - ProcMod->getEnv().StdOut.end(), + EXPECT_TRUE(std::equal(ProcMod->getEnv().StdErr.begin(), + ProcMod->getEnv().StdErr.end(), MemInst.getPointer(0))); } From 2d3f51f9a33b78260d451fe8b26002a1c00832c5 Mon Sep 17 00:00:00 2001 From: hydai Date: Thu, 18 Jun 2026 19:49:17 +0800 Subject: [PATCH 16/17] fix(test/plugins/wasmedge_ffmpeg): expect AV_NOPTS_VALUE for unprobed duration initFormatCtx opens the sample with avformat_open_input only, so AVFormatContext::duration stays AV_NOPTS_VALUE until avformat_find_stream_info runs. The prior EXPECT_EQ(..., 2000000) assumed a probed container duration and failed on every ffmpeg CI job; assert the value the getter actually returns. Assisted-by: Claude (Anthropic) Signed-off-by: hydai --- test/plugins/wasmedge_ffmpeg/avformat/avformatContext.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/plugins/wasmedge_ffmpeg/avformat/avformatContext.cpp b/test/plugins/wasmedge_ffmpeg/avformat/avformatContext.cpp index b3146a77..23c6fcf0 100644 --- a/test/plugins/wasmedge_ffmpeg/avformat/avformatContext.cpp +++ b/test/plugins/wasmedge_ffmpeg/avformat/avformatContext.cpp @@ -92,7 +92,7 @@ TEST_F(FFmpegTest, AVFormatContextStruct) { EXPECT_TRUE(HostFuncAVFormatCtxDuration.run( CallFrame, std::initializer_list{FormatCtxId}, Result)); - EXPECT_EQ(Result[0].get(), INT64_C(2000000)); + EXPECT_EQ(Result[0].get(), AV_NOPTS_VALUE); } FuncInst = AVFormatMod->findFuncExports( From 38d7801109b5521b1b3d48a0f814132a76b05abd Mon Sep 17 00:00:00 2001 From: hydai Date: Thu, 18 Jun 2026 19:49:30 +0800 Subject: [PATCH 17/17] test(plugins/wasmedge_ffmpeg): assert exact getter values to keep bindings observable After dropping the concrete dynamic_cast lookups, several exports were only checked for success or a non-negative result, so a same-signature binding swap would pass undetected. Pin distinguishing values verified against ffmpeg 7.1: - avPixfmt log2_chromaw/h: use YUV422P (1/0) so a width<->height swap fails. - avSampleFmt bytes_per_sample: guest sample format 1 (U8) is exactly 1 byte. - avutil log_set_level: call with an empty result span, assert run() succeeds, and use a non-default level so the getter proves the setter executed. - avutil channel-layout helpers: assert nb_channels and the default mono layout, which differ between the two exports. - avutil av_gettime vs av_gettime_relative: separate the wall-clock epoch from the smaller monotonic clock. - swscale isSupportedInput/Output: PAL8 is input-only, distinguishing the pair. - avStream duration/start_time/nb_frames/disposition: assert the sample's exact per-stream values. Assisted-by: Claude (Anthropic) Signed-off-by: hydai --- .../wasmedge_ffmpeg/avformat/avStream.cpp | 8 ++-- .../wasmedge_ffmpeg/avutil/avPixfmt.cpp | 17 ++++---- .../wasmedge_ffmpeg/avutil/avSampleFmt.cpp | 8 ++-- .../wasmedge_ffmpeg/avutil/avutil_func.cpp | 42 +++++++++++-------- .../wasmedge_ffmpeg/swscale/swscale_func.cpp | 13 ++++++ 5 files changed, 55 insertions(+), 33 deletions(-) diff --git a/test/plugins/wasmedge_ffmpeg/avformat/avStream.cpp b/test/plugins/wasmedge_ffmpeg/avformat/avStream.cpp index b3b9a187..099ebd61 100644 --- a/test/plugins/wasmedge_ffmpeg/avformat/avStream.cpp +++ b/test/plugins/wasmedge_ffmpeg/avformat/avStream.cpp @@ -117,7 +117,7 @@ TEST_F(FFmpegTest, AVStreamStruct) { CallFrame, std::initializer_list{FormatCtxId, StreamIdx}, Result)); - EXPECT_TRUE(Result[0].get() >= 0); + EXPECT_EQ(Result[0].get(), INT64_C(30720)); } FuncInst = AVFormatMod->findFuncExports( @@ -131,7 +131,7 @@ TEST_F(FFmpegTest, AVStreamStruct) { CallFrame, std::initializer_list{FormatCtxId, StreamIdx}, Result)); - EXPECT_TRUE(Result[0].get() >= 0); + EXPECT_EQ(Result[0].get(), INT64_C(0)); } FuncInst = AVFormatMod->findFuncExports( @@ -145,7 +145,7 @@ TEST_F(FFmpegTest, AVStreamStruct) { CallFrame, std::initializer_list{FormatCtxId, StreamIdx}, Result)); - EXPECT_TRUE(Result[0].get() >= 0); + EXPECT_EQ(Result[0].get(), INT64_C(120)); } FuncInst = AVFormatMod->findFuncExports( @@ -159,7 +159,7 @@ TEST_F(FFmpegTest, AVStreamStruct) { CallFrame, std::initializer_list{FormatCtxId, StreamIdx}, Result)); - EXPECT_TRUE(Result[0].get() >= 0); + EXPECT_EQ(Result[0].get(), 1); // AV_DISPOSITION_DEFAULT } FuncInst = AVFormatMod->findFuncExports( diff --git a/test/plugins/wasmedge_ffmpeg/avutil/avPixfmt.cpp b/test/plugins/wasmedge_ffmpeg/avutil/avPixfmt.cpp index a7df9b4c..2d29295c 100644 --- a/test/plugins/wasmedge_ffmpeg/avutil/avPixfmt.cpp +++ b/test/plugins/wasmedge_ffmpeg/avutil/avPixfmt.cpp @@ -38,11 +38,14 @@ TEST_F(FFmpegTest, AVPixFmt) { ASSERT_TRUE(FuncInst->isHostFunction()); auto &HostFuncAvPixFmtDescriptorLog2ChromaW = FuncInst->getHostFunc(); + uint32_t Yuv422PId = 5; // YUV422P: chroma subsampled on width only + { - HostFuncAvPixFmtDescriptorLog2ChromaW.run( - CallFrame, std::initializer_list{1}, Result); + EXPECT_TRUE(HostFuncAvPixFmtDescriptorLog2ChromaW.run( + CallFrame, std::initializer_list{Yuv422PId}, + Result)); - EXPECT_TRUE(Result[0].get() >= 0); + EXPECT_EQ(Result[0].get(), 1); } FuncInst = AVUtilMod->findFuncExports( @@ -52,11 +55,11 @@ TEST_F(FFmpegTest, AVPixFmt) { auto &HostFuncAvPixFmtDescriptorLog2ChromaH = FuncInst->getHostFunc(); { - HostFuncAvPixFmtDescriptorLog2ChromaH.run( - CallFrame, std::initializer_list{PixFmtId}, - Result); + EXPECT_TRUE(HostFuncAvPixFmtDescriptorLog2ChromaH.run( + CallFrame, std::initializer_list{Yuv422PId}, + Result)); - EXPECT_TRUE(Result[0].get() >= 0); + EXPECT_EQ(Result[0].get(), 0); } int32_t Length = 0; diff --git a/test/plugins/wasmedge_ffmpeg/avutil/avSampleFmt.cpp b/test/plugins/wasmedge_ffmpeg/avutil/avSampleFmt.cpp index 05e5ac8a..57d7ebc6 100644 --- a/test/plugins/wasmedge_ffmpeg/avutil/avSampleFmt.cpp +++ b/test/plugins/wasmedge_ffmpeg/avutil/avSampleFmt.cpp @@ -20,7 +20,7 @@ TEST_F(FFmpegTest, AVSampleFmt) { uint32_t NamePtr = UINT32_C(80); uint32_t LinesizePtr = UINT32_C(20); - uint32_t SampleFmtId = 1; // AV_SAMPLE_FMT_S32 + uint32_t SampleFmtId = 1; // AV_SAMPLE_FMT_U8 auto *FuncInst = AVUtilMod->findFuncExports( "wasmedge_ffmpeg_avutil_av_get_packed_sample_fmt"); ASSERT_NE(FuncInst, nullptr); @@ -70,11 +70,11 @@ TEST_F(FFmpegTest, AVSampleFmt) { auto &HostFuncAVGetBytesPerSample = FuncInst->getHostFunc(); { - HostFuncAVGetBytesPerSample.run( + EXPECT_TRUE(HostFuncAVGetBytesPerSample.run( CallFrame, std::initializer_list{SampleFmtId}, - Result); + Result)); - EXPECT_TRUE(Result[0].get() >= 0); + EXPECT_EQ(Result[0].get(), 1); } FuncInst = diff --git a/test/plugins/wasmedge_ffmpeg/avutil/avutil_func.cpp b/test/plugins/wasmedge_ffmpeg/avutil/avutil_func.cpp index 19b582f3..700c4efe 100644 --- a/test/plugins/wasmedge_ffmpeg/avutil/avutil_func.cpp +++ b/test/plugins/wasmedge_ffmpeg/avutil/avutil_func.cpp @@ -24,11 +24,10 @@ TEST_F(FFmpegTest, AVUtilFunc) { ASSERT_TRUE(FuncInst->isHostFunction()); auto &HostFuncAVLogSetLevel = FuncInst->getHostFunc(); - int32_t LogLvlId = 32; + int32_t LogLvlId = 16; // AV_LOG_ERROR, distinct from the default AV_LOG_INFO { - HostFuncAVLogSetLevel.run( - CallFrame, std::initializer_list{LogLvlId}, - Result); + EXPECT_TRUE(HostFuncAVLogSetLevel.run( + CallFrame, std::initializer_list{LogLvlId}, {})); } FuncInst = @@ -38,8 +37,8 @@ TEST_F(FFmpegTest, AVUtilFunc) { auto &HostFuncAVLogGetLevel = FuncInst->getHostFunc(); { - HostFuncAVLogGetLevel.run( - CallFrame, std::initializer_list{}, Result); + EXPECT_TRUE(HostFuncAVLogGetLevel.run( + CallFrame, std::initializer_list{}, Result)); EXPECT_EQ(Result[0].get(), LogLvlId); } @@ -125,10 +124,10 @@ TEST_F(FFmpegTest, AVUtilFunc) { auto &HostFuncAVGetChannelLayoutNbChannels = FuncInst->getHostFunc(); { - HostFuncAVGetChannelLayoutNbChannels.run( + EXPECT_TRUE(HostFuncAVGetChannelLayoutNbChannels.run( CallFrame, std::initializer_list{ChannelId}, - Result); - EXPECT_TRUE(Result[0].get() > 0); + Result)); + EXPECT_EQ(Result[0].get(), 1); } FuncInst = AVUtilMod->findFuncExports( @@ -138,10 +137,11 @@ TEST_F(FFmpegTest, AVUtilFunc) { auto &HostFuncAVGetDefaultChannelLayout = FuncInst->getHostFunc(); { - HostFuncAVGetDefaultChannelLayout.run( + EXPECT_TRUE(HostFuncAVGetDefaultChannelLayout.run( CallFrame, std::initializer_list{ChannelId}, - Result); - EXPECT_TRUE(Result[0].get() > 0); + Result)); + EXPECT_EQ(Result[0].get(), + UINT64_C(67108868)); // guest-encoded AV_CH_LAYOUT_MONO } uint32_t Length = 0; @@ -222,11 +222,14 @@ TEST_F(FFmpegTest, AVTime) { ASSERT_TRUE(FuncInst->isHostFunction()); auto &HostFuncAVGetTime = FuncInst->getHostFunc(); + int64_t AbsTime = 0; { - HostFuncAVGetTime.run( - CallFrame, std::initializer_list{}, Result); + EXPECT_TRUE(HostFuncAVGetTime.run( + CallFrame, std::initializer_list{}, Result)); - EXPECT_TRUE(Result[0].get() > 0); + AbsTime = Result[0].get(); + // Wall-clock epoch microseconds: well past 2020-01-01. + EXPECT_GT(AbsTime, INT64_C(1577836800000000)); } FuncInst = @@ -236,10 +239,13 @@ TEST_F(FFmpegTest, AVTime) { auto &HostFuncAVGetTimeRelative = FuncInst->getHostFunc(); { - HostFuncAVGetTimeRelative.run( - CallFrame, std::initializer_list{}, Result); + EXPECT_TRUE(HostFuncAVGetTimeRelative.run( + CallFrame, std::initializer_list{}, Result)); - EXPECT_TRUE(Result[0].get() > 0); + int64_t RelTime = Result[0].get(); + EXPECT_GT(RelTime, 0); + // Relative monotonic clock is not epoch time; it stays smaller. + EXPECT_LT(RelTime, AbsTime); } FuncInst = AVUtilMod->findFuncExports( diff --git a/test/plugins/wasmedge_ffmpeg/swscale/swscale_func.cpp b/test/plugins/wasmedge_ffmpeg/swscale/swscale_func.cpp index 90bd473f..de140425 100644 --- a/test/plugins/wasmedge_ffmpeg/swscale/swscale_func.cpp +++ b/test/plugins/wasmedge_ffmpeg/swscale/swscale_func.cpp @@ -42,6 +42,7 @@ TEST_F(FFmpegTest, SwsContext) { uint32_t YUV420PId = 1; // YUV420P AVPixFormatId (From Bindings.h) uint32_t RGB24Id = 3; // RGB24 AVPixFormatId (From Bindings.h) uint32_t XVMCId = 174; // XVMC AVPixFormatId (From Bindings.h) + uint32_t PAL8Id = 13; // PAL8 AVPixFormatId (From Bindings.h) uint32_t SrcWidth = 100; uint32_t SrcHeight = 100; @@ -117,6 +118,12 @@ TEST_F(FFmpegTest, SwsContext) { CallFrame, std::initializer_list{XVMCId}, Result)); ASSERT_TRUE(Result[0].get() == 0); + + // AV_PIX_FMT_PAL8 is supported as input but not as output. + EXPECT_TRUE(HostFuncSwsIsSupportedInput.run( + CallFrame, std::initializer_list{PAL8Id}, + Result)); + ASSERT_TRUE(Result[0].get() > 0); } FuncInst = SWScaleMod->findFuncExports( @@ -137,6 +144,12 @@ TEST_F(FFmpegTest, SwsContext) { CallFrame, std::initializer_list{XVMCId}, Result)); ASSERT_TRUE(Result[0].get() == 0); + + // AV_PIX_FMT_PAL8 is supported as input but not as output. + EXPECT_TRUE(HostFuncSwsIsSupportedOutput.run( + CallFrame, std::initializer_list{PAL8Id}, + Result)); + ASSERT_TRUE(Result[0].get() == 0); } FuncInst = SWScaleMod->findFuncExports(