Skip to content

Commit

Permalink
[Test] Add the extended-const proposal tests.
Browse files Browse the repository at this point in the history
Signed-off-by: YiYing He <[email protected]>
  • Loading branch information
q82419 committed May 16, 2022
1 parent 375d90b commit 50c97c8
Show file tree
Hide file tree
Showing 6 changed files with 24 additions and 4 deletions.
1 change: 1 addition & 0 deletions include/common/enum.inc
Original file line number Diff line number Diff line change
Expand Up @@ -556,6 +556,7 @@ P(MultiMemories, "Multiple memories")
P(Annotations, "Custom Annotation Syntax in the Text Format")
P(Memory64, "Memory64")
P(ExceptionHandling, "Exception handling")
P(ExtendedConst, "Extended const")
P(Threads, "Threads")
P(FunctionReferences, "Typed Function References")
#undef P
Expand Down
7 changes: 3 additions & 4 deletions test/api/helper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,9 @@
namespace WasmEdge {

static Proposal ProposalList[] = {
Proposal::TailCall, Proposal::MultiMemories,
Proposal::Annotations, Proposal::Memory64,
Proposal::ExceptionHandling, Proposal::Threads,
Proposal::FunctionReferences};
Proposal::TailCall, Proposal::MultiMemories, Proposal::Annotations,
Proposal::Memory64, Proposal::ExceptionHandling, Proposal::ExtendedConst,
Proposal::Threads, Proposal::FunctionReferences};

WasmEdge_ConfigureContext *createConf(const Configure &Conf) {
auto *Cxt = WasmEdge_ConfigureCreate();
Expand Down
5 changes: 5 additions & 0 deletions test/spec/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,11 @@ file(COPY
DESTINATION
${CMAKE_CURRENT_BINARY_DIR}/testSuites
)
file(COPY
${wasmedge_unit_test_SOURCE_DIR}/extended-const
DESTINATION
${CMAKE_CURRENT_BINARY_DIR}/testSuites
)

wasmedge_add_library(wasmedgeTestSpec
spectest.cpp
Expand Down
1 change: 1 addition & 0 deletions test/spec/spectest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -218,6 +218,7 @@ static const TestsuiteProposal TestsuiteProposals[] = {
{"core"sv, {}},
{"multi-memory"sv, {Proposal::MultiMemories}},
{"tail-call"sv, {Proposal::TailCall}},
{"extended-const"sv, {Proposal::ExtendedConst}},
};

} // namespace
Expand Down
7 changes: 7 additions & 0 deletions tools/wasmedge/wasmedgec.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,8 @@ int main(int Argc, const char *Argv[]) {
PO::Description("Enable Multiple memories proposal"sv));
PO::Option<PO::Toggle> PropTailCall(
PO::Description("Enable Tail-call proposal"sv));
PO::Option<PO::Toggle> PropExtendConst(
PO::Description("Enable Extended-const proposal"sv));
PO::Option<PO::Toggle> PropAll(PO::Description("Enable all features"sv));

auto Parser = PO::ArgumentParser();
Expand All @@ -86,6 +88,7 @@ int main(int Argc, const char *Argv[]) {
.add_option("disable-simd"sv, PropSIMD)
.add_option("enable-multi-memory"sv, PropMultiMem)
.add_option("enable-tail-call"sv, PropTailCall)
.add_option("enable-extended-const"sv, PropExtendConst)
.add_option("enable-all"sv, PropAll)
.parse(Argc, Argv)) {
return EXIT_FAILURE;
Expand Down Expand Up @@ -123,9 +126,13 @@ int main(int Argc, const char *Argv[]) {
if (PropTailCall.value()) {
Conf.addProposal(WasmEdge::Proposal::TailCall);
}
if (PropExtendConst.value()) {
Conf.addProposal(WasmEdge::Proposal::ExtendedConst);
}
if (PropAll.value()) {
Conf.addProposal(WasmEdge::Proposal::MultiMemories);
Conf.addProposal(WasmEdge::Proposal::TailCall);
Conf.addProposal(WasmEdge::Proposal::ExtendedConst);
}

std::filesystem::path InputPath = std::filesystem::absolute(WasmName.value());
Expand Down
7 changes: 7 additions & 0 deletions tools/wasmedge/wasmedger.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,8 @@ int main(int Argc, const char *Argv[]) {
PO::Description("Enable Multiple memories proposal"sv));
PO::Option<PO::Toggle> PropTailCall(
PO::Description("Enable Tail-call proposal"sv));
PO::Option<PO::Toggle> PropExtendConst(
PO::Description("Enable Extended-const proposal"sv));
PO::Option<PO::Toggle> PropAll(PO::Description("Enable all features"sv));

PO::Option<PO::Toggle> ConfEnableInstructionCounting(PO::Description(
Expand Down Expand Up @@ -116,6 +118,7 @@ int main(int Argc, const char *Argv[]) {
.add_option("disable-simd"sv, PropSIMD)
.add_option("enable-multi-memory"sv, PropMultiMem)
.add_option("enable-tail-call"sv, PropTailCall)
.add_option("enable-extended-const"sv, PropExtendConst)
.add_option("enable-all"sv, PropAll)
.add_option("time-limit"sv, TimeLim)
.add_option("gas-limit"sv, GasLim)
Expand Down Expand Up @@ -160,9 +163,13 @@ int main(int Argc, const char *Argv[]) {
if (PropTailCall.value()) {
Conf.addProposal(WasmEdge::Proposal::TailCall);
}
if (PropExtendConst.value()) {
Conf.addProposal(WasmEdge::Proposal::ExtendedConst);
}
if (PropAll.value()) {
Conf.addProposal(WasmEdge::Proposal::MultiMemories);
Conf.addProposal(WasmEdge::Proposal::TailCall);
Conf.addProposal(WasmEdge::Proposal::ExtendedConst);
}

std::optional<std::chrono::system_clock::time_point> Timeout;
Expand Down

0 comments on commit 50c97c8

Please sign in to comment.