diff --git a/auditd/1.0.0/Makefile b/auditd/1.0.0/Makefile index d4f98dd..d82fe27 100644 --- a/auditd/1.0.0/Makefile +++ b/auditd/1.0.0/Makefile @@ -1,16 +1,14 @@ test: - soldr-busted --exclude-tags=integration . + $(SOLDR_MODULES)/bin/busted --exclude-tags=root . -OS_LIST :=$(subst docker/Dockerfile.,,$(wildcard docker/Dockerfile.*)) +OS_LIST := $(subst docker/Dockerfile.,,$(wildcard docker/Dockerfile.*)) test-inside-all: $(OS_LIST:%=test-inside-%) -test-inside-%: docker-build-% +test-inside-%: docker/Dockerfile.% @echo Run testing inside: $* + @docker build -q -t test/$* -f docker/Dockerfile.$* . >&- @docker run --rm \ -e SOLDR_MODULES=/src \ -v $(SOLDR_MODULES):/src:ro \ -w /src/auditd/1.0.0 \ - test/$* /src/bin/soldr-busted . - -docker-build-%: docker/Dockerfile.% - docker build -q -t test/$* -f docker/Dockerfile.$* . >&- + test/$* /src/bin/busted . diff --git a/auditd/1.0.0/cmodule/exec_spec.lua b/auditd/1.0.0/cmodule/exec_spec.lua index 5b51dcb..327585b 100644 --- a/auditd/1.0.0/cmodule/exec_spec.lua +++ b/auditd/1.0.0/cmodule/exec_spec.lua @@ -7,8 +7,7 @@ end describe("exec", function() it("runs a given command", function() - local ok, err = exec("true") - assert(ok, "unexpected error: "..tostring(err)) + assert(exec("true")) end) it("must fail unless the exit code is 0", function() diff --git a/auditd/1.0.0/cmodule/pkg_spec.lua b/auditd/1.0.0/cmodule/pkg_spec.lua index 29f9f32..7863c1d 100644 --- a/auditd/1.0.0/cmodule/pkg_spec.lua +++ b/auditd/1.0.0/cmodule/pkg_spec.lua @@ -1,5 +1,10 @@ package.path = package.path .. ";cmodule/?.lua" local pkg = require "pkg" +local exec = require "exec" + +local function is_installed(name) + return exec("type "..name) +end describe("format_cmd", function() local format_cmd = pkg.testing.format_cmd @@ -26,13 +31,17 @@ describe("format_cmd", function() end) end) -describe("#integration package manager", function() +describe("package manager #root", function() setup(function() pm = assert(pkg.find_manager()) assert(pm:sync()) end) test("install()", function() - assert(pm:install("less")) + local package = "less" + assert(not is_installed(package), + string.format("expected %q to be not installed", package)) + assert(pm:install(package)) + assert(is_installed(package)) end) end) diff --git a/bin/busted b/bin/busted new file mode 100755 index 0000000..55619f9 --- /dev/null +++ b/bin/busted @@ -0,0 +1,6 @@ +#!/bin/sh + +# Configurable by user: +SOLDR_MODULES="${SOLDR_MODULES:-$PWD}" + +exec "$SOLDR_MODULES/bin/luajit" "$SOLDR_MODULES/tests_framework/lua/bin/busted" "$@" diff --git a/bin/soldr-luajit b/bin/luajit similarity index 61% rename from bin/soldr-luajit rename to bin/luajit index 7855fe9..e647ddf 100755 --- a/bin/soldr-luajit +++ b/bin/luajit @@ -2,9 +2,9 @@ # Configurable by user: SOLDR_MODULES="${SOLDR_MODULES:-$PWD}" -SOLDR_PLATFORM="${SOLDR_PLATFORM:-linux64}" +LUAPOWER_PLATFORM="${LUAPOWER_PLATFORM:-linux64}" -LUA_BIN="$SOLDR_MODULES/luapower/bin/$SOLDR_PLATFORM/luajit-bin" +LUA_BIN="$SOLDR_MODULES/luapower/bin/$LUAPOWER_PLATFORM/luajit-bin" export LUA_PATH="\ $SOLDR_MODULES/tests_framework/lua/?.lua;\ @@ -16,8 +16,8 @@ $SOLDR_MODULES/utils/?/init.lua;\ $LUA_PATH" export LUA_CPATH="\ -$SOLDR_MODULES/luapower/bin/$SOLDR_PLATFORM/lib?.dylib;\ -$SOLDR_MODULES/luapower/bin/$SOLDR_PLATFORM/clib/?.so;\ +$SOLDR_MODULES/luapower/bin/$LUAPOWER_PLATFORM/lib?.dylib;\ +$SOLDR_MODULES/luapower/bin/$LUAPOWER_PLATFORM/clib/?.so;\ $LUA_CPATH" exec "$LUA_BIN" "$@" diff --git a/bin/soldr-busted b/bin/soldr-busted deleted file mode 100755 index 4f44cb7..0000000 --- a/bin/soldr-busted +++ /dev/null @@ -1,7 +0,0 @@ -#!/bin/sh - -# Configurable by user: -SOLDR_MODULES="${SOLDR_MODULES:-$PWD}" - -PATH="$SOLDR_MODULES/bin:$PATH" exec \ - soldr-luajit "$SOLDR_MODULES/tests_framework/lua/bin/busted" "$@" diff --git a/luapower b/luapower index b8b4cc0..d791823 160000 --- a/luapower +++ b/luapower @@ -1 +1 @@ -Subproject commit b8b4cc03d1e6e261bbccfe9f9d2f4cd85902bcc3 +Subproject commit d7918238f43af6ba58344867b34eda1857c2c307