diff --git a/test/treegen.lua b/test/treegen.lua
index 00ad7b3376e48fdb1174628a522d7a2a8c022002..f0e8f8f4566c3e119ebde240d77b1cb2662b5a7a 100644
--- a/test/treegen.lua
+++ b/test/treegen.lua
@@ -58,6 +58,7 @@ function treegen.write_script(dir, script, body)
     local fh = fio.open(script_abspath, flags, mode)
     fh:write(body)
     fh:close()
+    return script_abspath
 end
 
 -- Generate a script that follows a template and write it at the