aboutsummaryrefslogtreecommitdiffstats
path: root/bruiser/lua-scripts/wasmtest.lua
diff options
context:
space:
mode:
authorbloodstalker <thabogre@gmail.com>2018-10-03 14:57:54 +0000
committerbloodstalker <thabogre@gmail.com>2018-10-03 14:57:54 +0000
commit116bdcba0e6dbade27edcb36fb2f950ffe356fd8 (patch)
treea6dd4817884fbbbff0fa3d97f0ee008eadc8a5a6 /bruiser/lua-scripts/wasmtest.lua
parentadded tests for wasm setters, faultreiber and tablegen now use the same xml f... (diff)
downloadmutator-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 '')
-rw-r--r--bruiser/lua-scripts/wasmtest.lua34
1 files changed, 34 insertions, 0 deletions
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