37 lines
1017 B
Bash
37 lines
1017 B
Bash
#!/usr/bin/env bash
|
|||
|
|
set -euo pipefail
|
||
|
|
|
||
|
|
if [ -f /etc/os-release ]; then
|
||
|
|
# shellcheck source=/dev/null
|
||
|
|
. /etc/os-release
|
||
|
|
fi
|
||
|
|
|
||
|
|
echo "Running tests inside distro: ${ID:-unknown}"
|
||
|
|
|
||
|
|
if [ -f "/nix/var/nix/profiles/default/etc/profile.d/nix-daemon.sh" ]; then
|
||
|
|
# shellcheck source=/dev/null
|
||
|
|
. "/nix/var/nix/profiles/default/etc/profile.d/nix-daemon.sh"
|
||
|
|
fi
|
||
|
|
|
||
|
|
if [ -f "$HOME/.nix-profile/etc/profile.d/nix.sh" ]; then
|
||
|
|
# shellcheck source=/dev/null
|
||
|
|
. "$HOME/.nix-profile/etc/profile.d/nix.sh"
|
||
|
|
fi
|
||
|
|
|
||
|
|
PATH="/nix/var/nix/profiles/default/bin:$HOME/.nix-profile/bin:$PATH"
|
||
|
|
|
||
|
|
command -v nix >/dev/null || {
|
||
|
|
echo "ERROR: nix not found."
|
||
|
|
exit 1
|
||
|
|
}
|
||
|
|
|
||
|
|
if command -v git >/dev/null 2>&1; then
|
||
|
|
git config --global --add safe.directory /opt/src/pkgmgr || true
|
||
|
|
git config --global --add safe.directory /opt/src/pkgmgr/.git || true
|
||
|
|
git config --global --add safe.directory "*" || true
|
||
|
|
fi
|
||
|
|
|
||
|
|
nix develop .#default --no-write-lock-file -c \
|
||
|
|
python3 -m unittest discover \
|
||
|
|
-s /opt/src/pkgmgr/tests/e2e \
|
||
|
|
-p "$TEST_PATTERN"
|