tests: initial integration tests
Signed-off-by: NotAShelf <raf@notashelf.dev> Change-Id: I09ed2eea568edfaecdb800197bc36c416a6a6964
This commit is contained in:
parent
347175bb86
commit
8bce6c27b5
6 changed files with 148 additions and 0 deletions
76
tests/integration/run.sh
Executable file
76
tests/integration/run.sh
Executable file
|
|
@ -0,0 +1,76 @@
|
|||
#!/usr/bin/env bash
|
||||
set -euo pipefail
|
||||
|
||||
echo "=== Phase 6: Integration Testing ==="
|
||||
echo ""
|
||||
|
||||
PLUGIN_PATH="$(pwd)/build/nix-ir-plugin.so"
|
||||
TEST_DIR="$(pwd)/tests/integration"
|
||||
|
||||
if [ ! -f "$PLUGIN_PATH" ]; then
|
||||
echo "ERROR: Plugin not found at $PLUGIN_PATH"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo "Plugin path: $PLUGIN_PATH"
|
||||
echo ""
|
||||
|
||||
echo "Test 1: Plugin Loading"
|
||||
echo "----------------------"
|
||||
if nix-instantiate --plugin-files "$PLUGIN_PATH" --eval "$TEST_DIR/simple_eval.nix" 2>&1 | grep -q "30"; then
|
||||
echo "[PASS] Plugin loads and evaluates correctly"
|
||||
else
|
||||
echo "[FAIL] Plugin failed to load or evaluate"
|
||||
exit 1
|
||||
fi
|
||||
echo ""
|
||||
|
||||
echo "Test 2: Normal Nix Evaluation (No Plugin)"
|
||||
echo "------------------------------------------"
|
||||
result=$(nix-instantiate --eval --strict --json "$TEST_DIR/regression_normal_nix.nix" 2>&1)
|
||||
if echo "$result" | grep -q '"math":7'; then
|
||||
echo "[PASS] Normal Nix evaluation works without plugin"
|
||||
else
|
||||
echo "[FAIL] Normal Nix evaluation broken"
|
||||
echo "$result"
|
||||
exit 1
|
||||
fi
|
||||
echo ""
|
||||
|
||||
echo "Test 3: Normal Nix Evaluation (With Plugin)"
|
||||
echo "--------------------------------------------"
|
||||
result=$(nix-instantiate --plugin-files "$PLUGIN_PATH" --eval --strict --json "$TEST_DIR/regression_normal_nix.nix" 2>&1)
|
||||
if echo "$result" | grep -q '"math":7'; then
|
||||
echo "[PASS] Normal Nix evaluation works with plugin loaded"
|
||||
else
|
||||
echo "[FAIL] Plugin breaks normal Nix evaluation"
|
||||
echo "$result"
|
||||
exit 1
|
||||
fi
|
||||
echo ""
|
||||
|
||||
echo "Test 4: Import Builtin"
|
||||
echo "----------------------"
|
||||
cd "$TEST_DIR"
|
||||
result=$(nix-instantiate --plugin-files "$PLUGIN_PATH" --eval --strict --json import_test.nix 2>&1)
|
||||
if echo "$result" | grep -q '"value":142'; then
|
||||
echo "[PASS] Import builtin works correctly"
|
||||
else
|
||||
echo "[FAIL] Import builtin broken"
|
||||
echo "$result"
|
||||
exit 1
|
||||
fi
|
||||
cd - >/dev/null
|
||||
echo ""
|
||||
|
||||
echo "Test 5: IR Builtins Available"
|
||||
echo "------------------------------"
|
||||
result=$(nix-instantiate --plugin-files "$PLUGIN_PATH" --eval "$TEST_DIR/ir_builtins_test.nix" 2>&1)
|
||||
if echo "$result" | grep -q "info.*="; then
|
||||
echo "[PASS] IR builtins (nixIR_info, nixIR_compile, nixIR_loadIR) available"
|
||||
else
|
||||
echo "[WARN] IR builtins may not be available (check plugin initialization)"
|
||||
fi
|
||||
echo ""
|
||||
|
||||
echo "Integration Tests Complete"
|
||||
Loading…
Add table
Add a link
Reference in a new issue