Skip to content

Commit

Permalink
TestSuite changes
Browse files Browse the repository at this point in the history
- Fiu decoder `code.name` changed to `code.opname`.
- Fiu test runner now uses `luau_settings`.
- Added new export validations for new api interface from Fiu.
  • Loading branch information
SnorlaxAssist committed Mar 27, 2024
1 parent 635d5ba commit da71cc9
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 6 deletions.
6 changes: 4 additions & 2 deletions tests/Config.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,10 @@ bool DEBUG_LUAU_ENABLE_PRINT = false;
bool DEBUG_LUAU_ENABLE_WARN = false;

FIU_EXPORT {
{"luau_load", "function"},
{"luau_deserialize", "function"}
{"luau_newsettings", "function"},
{"luau_validatesettings", "function"},
{"luau_deserialize", "function"},
{"luau_load", "function"}
};

FIU_TESTCASES {
Expand Down
4 changes: 3 additions & 1 deletion tests/Utils/Fiu.h
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,8 @@ void fiuDecodeCode(lua_State* L, const char* src, size_t srcLen)
lua_newtable(L);
lua_pushunsigned(L, stoul(string(src + 1, srcLen - 1)));
lua_setfield(L, -2, "value");
lua_pushstring(L, "auxvalue");
lua_setfield(L, -2, "opname");
return;
}

Expand Down Expand Up @@ -218,7 +220,7 @@ void fiuDecodeCode(lua_State* L, const char* src, size_t srcLen)

string opname = opList.at(opcode);
lua_pushstring(L, opname.c_str());
lua_setfield(L, -2, "name");
lua_setfield(L, -2, "opname");
}

void fiuDecodeProto(lua_State* L, string src, vector<string> protoCode)
Expand Down
17 changes: 14 additions & 3 deletions tests/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -450,11 +450,20 @@ TestResult RUN_TEST(string testName, string fileName)
if (deserialize != 0)
return deserialize;

lua_getfield(L, -2, "luau_load");
lua_pushvalue(L, -2);
lua_getfield(L, -2, "luau_newsettings");
int newsettings = lua_pcall(L, 0, 1, 0);
if (newsettings != 0)
return newsettings;

lua_pushboolean(L, false);
lua_setfield(L, -2, "errorHandling");

lua_getfield(L, -3, "luau_load");
lua_pushvalue(L, -3);
lua_pushvalue(L, LUA_GLOBALSINDEX);
lua_pushvalue(L, -4);

int load = lua_pcall(L, 2, 1, 0);
int load = lua_pcall(L, 3, 1, 0);
if (load != 0)
return load;

Expand Down Expand Up @@ -693,6 +702,8 @@ int main(int argc, char* argv[])
lua_close(L);
}

printf("\n");

if (strcmp(mode, "mdt") == 0)
{
if (buildSourceDirectory.empty() || !filesystem::exists(buildSourceDirectory) || !filesystem::is_directory(buildSourceDirectory))
Expand Down

0 comments on commit da71cc9

Please sign in to comment.