diff options
author | bloodstalker <thabogre@gmail.com> | 2018-10-03 14:57:54 +0000 |
---|---|---|
committer | bloodstalker <thabogre@gmail.com> | 2018-10-03 14:57:54 +0000 |
commit | 116bdcba0e6dbade27edcb36fb2f950ffe356fd8 (patch) | |
tree | a6dd4817884fbbbff0fa3d97f0ee008eadc8a5a6 /bruiser/lua-scripts | |
parent | added tests for wasm setters, faultreiber and tablegen now use the same xml f... (diff) | |
download | mutator-116bdcba0e6dbade27edcb36fb2f950ffe356fd8.tar.gz mutator-116bdcba0e6dbade27edcb36fb2f950ffe356fd8.zip |
wip, working on fixing the setters, need to test all of them to see if they are working.some of them are working now.
Diffstat (limited to 'bruiser/lua-scripts')
-rw-r--r-- | bruiser/lua-scripts/wasm.lua | 204 | ||||
-rw-r--r-- | bruiser/lua-scripts/wasmtest.lua | 34 |
2 files changed, 34 insertions, 204 deletions
diff --git a/bruiser/lua-scripts/wasm.lua b/bruiser/lua-scripts/wasm.lua deleted file mode 100644 index 88588a6..0000000 --- a/bruiser/lua-scripts/wasm.lua +++ /dev/null @@ -1,204 +0,0 @@ --- automatically generated by luatablegen -local wasm = {} - -setmetatable(init_expr_t, {__call = - function(self, arg0, arg1) - local t = self.new(arg0, arg1) - return t - end - } -) - -setmetatable(resizable_limit_t, {__call = - function(self, arg0, arg1, arg2) - local t = self.new(arg0, arg1, arg2) - return t - end - } -) - -setmetatable(global_type_t, {__call = - function(self, arg0, arg1) - local t = self.new(arg0, arg1) - return t - end - } -) - -setmetatable(table_type_t, {__call = - function(self, arg0, arg1) - local t = self.new(arg0, arg1) - return t - end - } -) - -setmetatable(memory_type_t, {__call = - function(self, arg0) - local t = self.new(arg0) - return t - end - } -) - -setmetatable(W_Type_Section_Entry, {__call = - function(self, arg0, arg1, arg2, arg3, arg4) - local t = self.new(arg0, arg1, arg2, arg3, arg4) - return t - end - } -) - -setmetatable(W_Type_Section, {__call = - function(self, arg0, arg1) - local t = self.new(arg0, arg1) - return t - end - } -) - -setmetatable(W_Import_Section_Entry, {__call = - function(self, arg0, arg1, arg2, arg3, arg4, arg5) - local t = self.new(arg0, arg1, arg2, arg3, arg4, arg5) - return t - end - } -) - -setmetatable(W_Import_Section, {__call = - function(self, arg0, arg1) - local t = self.new(arg0, arg1) - return t - end - } -) - -setmetatable(W_Function_Section, {__call = - function(self, arg0, arg1) - local t = self.new(arg0, arg1) - return t - end - } -) - -setmetatable(W_Table_Section, {__call = - function(self, arg0, arg1) - local t = self.new(arg0, arg1) - return t - end - } -) - -setmetatable(W_Memory_Section, {__call = - function(self, arg0, arg1) - local t = self.new(arg0, arg1) - return t - end - } -) - -setmetatable(W_Global_Entry, {__call = - function(self, arg0, arg1) - local t = self.new(arg0, arg1) - return t - end - } -) - -setmetatable(W_Global_Section, {__call = - function(self, arg0, arg1) - local t = self.new(arg0, arg1) - return t - end - } -) - -setmetatable(W_Export_Entry, {__call = - function(self, arg0, arg1, arg2, arg3) - local t = self.new(arg0, arg1, arg2, arg3) - return t - end - } -) - -setmetatable(W_Export_Section, {__call = - function(self, arg0, arg1) - local t = self.new(arg0, arg1) - return t - end - } -) - -setmetatable(W_Start_Section, {__call = - function(self, arg0) - local t = self.new(arg0) - return t - end - } -) - -setmetatable(W_Elem_Segment, {__call = - function(self, arg0, arg1, arg2, arg3) - local t = self.new(arg0, arg1, arg2, arg3) - return t - end - } -) - -setmetatable(W_Element_Section, {__call = - function(self, arg0, arg1) - local t = self.new(arg0, arg1) - return t - end - } -) - -setmetatable(W_Local_Entry, {__call = - function(self, arg0, arg1) - local t = self.new(arg0, arg1) - return t - end - } -) - -setmetatable(W_Function_Body, {__call = - function(self, arg0, arg1, arg2, arg3) - local t = self.new(arg0, arg1, arg2, arg3) - return t - end - } -) - -setmetatable(W_Code_Section, {__call = - function(self, arg0, arg1) - local t = self.new(arg0, arg1) - return t - end - } -) - -setmetatable(W_Data_Segment, {__call = - function(self, arg0, arg1, arg2, arg3) - local t = self.new(arg0, arg1, arg2, arg3) - return t - end - } -) - -setmetatable(W_Data_Section, {__call = - function(self, arg0, arg1) - local t = self.new(arg0, arg1) - return t - end - } -) - -setmetatable(Wasm_Module, {__call = - function(self, arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12) - local t = self.new(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12) - return t - end - } -) - -return wasm diff --git a/bruiser/lua-scripts/wasmtest.lua b/bruiser/lua-scripts/wasmtest.lua index 50dfa4f..fef8858 100644 --- a/bruiser/lua-scripts/wasmtest.lua +++ b/bruiser/lua-scripts/wasmtest.lua @@ -284,6 +284,7 @@ end function libwasm.demo_setters(wasm_path) local a = getwasmobj(wasm_path) + wasmextra = require("wasmextra") --type section setters do @@ -333,6 +334,9 @@ function libwasm.demo_setters(wasm_path) pre = a["type_section"]:count() a["type_section"]:set_count(13) post = a["type_section"]:count() + -- not necessary anymore since the library code checks for null before dereferencing + -- though that only works if we used calloc instead of malloc + a["type_section"]:set_count(pre) if pre == post then io.write(colors("%{red}".."type_section:count:failure\n")) success = false @@ -341,6 +345,36 @@ function libwasm.demo_setters(wasm_path) end --FIXME-entries + --for k,v in pairs(W_Type_Section_Entry) do + --print(k, v) + --end + print(#a["type_section"]:entries()) + local entry1 = W_Type_Section_Entry(1,2,3,4,5) + local entry2 = W_Type_Section_Entry(1,2,3,4,5) + local entry3 = W_Type_Section_Entry(1,2,3,4,5) + local new_entries = {} + new_entries[1] = entry1 + new_entries[2] = entry2 + new_entries[3] = entry2 + pre = a["type_section"]:entries() + a["type_section"]:set_entries(new_entries) + a["type_section"]:set_count(3) + print(#a["type_section"]:entries()) + post = a["type_section"]:entries() + if pre == post then + io.write(colors("%{red}".."type_section:entries:failure\n")) + success = false + else + io.write(colors("%{green}".."type_section:entries:pass\n")) + end + for k,v in pairs(a["type_section"]:entries()) do + print("fuckkkkk") + print("form:"..v:form()) + print("param_count:"..v:param_count()) + print("param_types:"..v:param_types()) + print("return_count:"..v:return_count()) + print("return_types:"..v:return_types()) + end end end |