diff --git a/flake.nix b/flake.nix index 178de8f..b28c6c1 100644 --- a/flake.nix +++ b/flake.nix @@ -48,9 +48,9 @@ }; defaultPackage = self.packages.${system}.lsyncd; - devShell = pkgs.mkShell { - buildInputs = defaultDeps ++ buildTypes.lua5_3; - }; + # devShell = pkgs.mkShell { + # buildInputs = defaultDeps ++ buildTypes.lua5_3; + # }; } ); } \ No newline at end of file diff --git a/tests/ci-run.sh b/tests/ci-run.sh new file mode 100755 index 0000000..31a1343 --- /dev/null +++ b/tests/ci-run.sh @@ -0,0 +1,12 @@ +#!/usr/bin/env bash + +set -ex + +SRC=`pwd` +BUILD_FOLDER=`mktemp -d` +echo "Build folder: $BUILD_FOLDER" +cd $BUILD_FOLDER +cmake $SRC +make VERBOSE=1 +make tests +rm -rf $BUILD_FOLDER \ No newline at end of file diff --git a/tests/testlib.lua b/tests/testlib.lua index 7930fc8..42eb77b 100644 --- a/tests/testlib.lua +++ b/tests/testlib.lua @@ -3,6 +3,7 @@ posix = require( 'posix' ) string = require( 'string' ) path = require( 'pl.path' ) stringx = require( 'pl.stringx' ) +local sys_stat = require "posix.sys.stat" -- escape codes to colorize output on terminal local c1='\027[47;34m' @@ -97,7 +98,18 @@ function script_path() -- local str = debug.getinfo(2, "S").source:sub(2) -- return str:match("(.*/)") return path.dirname(path.abspath(debug.getinfo(1).short_src)) - end +end + +function which(exec) + local path = os.getenv("PATH") + for match in (path..':'):gmatch("(.-)"..':') do + local fname = match..'/'..exec + local s = sys_stat.stat(fname) + if s ~= nil then + return fname + end + end +end -- -- Starts test ssh server @@ -135,10 +147,9 @@ function startSshd() PidFile ]] .. sshdPath .. [[sshd.pid ]]) f:close( ) - local which = io.popen("which sshd") - local path = which:read("a") - local exePath = string.sub(path, 0, #path - 1 ) - -- local sshPath = which:read("a*") + --local which = io.popen("which sshd") + exePath = which('sshd') + cwriteln("Using sshd: "..exePath) local pid = spawn(exePath, "-f", sshdPath .. "sshd_config") cwriteln( 'spawned sshd server: ' .. pid)