summaryrefslogtreecommitdiff
path: root/bin
diff options
context:
space:
mode:
authorDaniel Silverstone <dsilvers@digital-scurf.org>2016-05-30 15:06:38 +0100
committerDaniel Silverstone <dsilvers@digital-scurf.org>2016-05-30 15:06:38 +0100
commitefb95e0f4d4e026b63209c48f59e9c9ca59cb29c (patch)
tree6895c96626604c666142d507f4e7ac65e4931fa3 /bin
parent0f666265b87f68f3dfe938e5f9915c32659a3fc3 (diff)
downloadgitano-efb95e0f4d4e026b63209c48f59e9c9ca59cb29c.tar.gz
Ensure that supple works during gitano-setup to early-warn if something's odd
Diffstat (limited to 'bin')
-rw-r--r--bin/gitano-setup.in34
1 files changed, 34 insertions, 0 deletions
diff --git a/bin/gitano-setup.in b/bin/gitano-setup.in
index 038276c..b39a6b5 100644
--- a/bin/gitano-setup.in
+++ b/bin/gitano-setup.in
@@ -62,6 +62,40 @@ end
gitano.log.chat("Welcome to the Gitano setup process")
+gitano.log.chat("Performing system checks")
+
+-- Check that Supple functions properly
+local ok, msg = pcall(function()
+ gitano.log.chat("... Checking supple sandboxing")
+ local s = require 'supple'
+ local ok, a, b, c = s.host.run("return ...", "test", 12, 'hello', true)
+ if not ok then
+ gitano.log.chat("... Supple unable to run trivial sandboxed code")
+ os.exit(1)
+ end
+ if a ~= 12 or b ~= "hello" or c ~= true then
+ gitano.log.chat("... Supple unable to pass trivial values in and out")
+ os.exit(1)
+ end
+ local ok, v = s.host.run("local a = ...\nreturn a.banana", "test", {banana=14})
+ if not ok then
+ gitano.log.chat("... Supple unable to run trivial sandboxed code")
+ os.exit(1)
+ end
+ if v ~= 14 then
+ gitano.log.chat("... Supple unable to communicate bidirectionally")
+ os.exit(1)
+ end
+end)
+
+if not ok then
+ gitano.log.chat("... Unable to run supple test")
+ gitano.log.chat("... " .. tostring(msg))
+ os.exit(1)
+end
+
+gitano.log.chat("System checks out")
+
function get(key)
return conf.settings[key]
end