-
Notifications
You must be signed in to change notification settings - Fork 7
Expand file tree
/
Copy pathtest-integration.sh
More file actions
executable file
·64 lines (47 loc) · 1.68 KB
/
Copy pathtest-integration.sh
File metadata and controls
executable file
·64 lines (47 loc) · 1.68 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
#!/usr/bin/env bash
set -euo pipefail
# semquery integration test script
# Usage: cargo build && ./test-integration.sh
#
# Runs with a temporary workspace and user config.
# Models use the shared cache. The first run downloads them.
# Windows semquery uses LocalAppData through the Known Folder API.
# HOME and XDG_CONFIG_HOME cannot isolate that config path.
case "$(uname -s)" in
CYGWIN* | MINGW* | MSYS*)
echo "error: test-integration.sh supports Unix-like semquery binaries only." >&2
exit 1
;;
esac
SEMQ=./target/debug/semq
if [[ ! -x "$SEMQ" ]]; then
echo "error: $SEMQ not found. Run 'cargo build' first." >&2
exit 1
fi
TEST_ROOT="$(mktemp -d)"
trap 'rm -rf "$TEST_ROOT"' EXIT
WORKSPACE="$TEST_ROOT/workspace"
# Save this path before HOME changes.
MODEL_CACHE="${SEMQ_MODEL_CACHE:-$HOME/.cache/semq/models}"
export HOME="$TEST_ROOT/home"
export XDG_CONFIG_HOME="$TEST_ROOT/config"
mkdir -p "$HOME" "$XDG_CONFIG_HOME"
SEMQ_ARGS=(
--workspace "$WORKSPACE"
--model-cache "$MODEL_CACHE"
)
GREEN='\033[0;32m'
RESET='\033[0m'
echo -e "\n${GREEN}=== Init (workspace: $WORKSPACE) ===${RESET}"
"$SEMQ" "${SEMQ_ARGS[@]}" init
echo -e "\n${GREEN}=== Add collection ===${RESET}"
"$SEMQ" "${SEMQ_ARGS[@]}" add ./testdata/md --name notes
echo -e "\n${GREEN}=== Index ===${RESET}"
"$SEMQ" "${SEMQ_ARGS[@]}" index -v --log-stdout
echo -e "\n${GREEN}=== Ask ===${RESET}"
"$SEMQ" "${SEMQ_ARGS[@]}" ask "What are the improvements of Multi-Paxos over the Paxos algorithm?" -vv
echo -e "\n${GREEN}=== Search ===${RESET}"
"$SEMQ" "${SEMQ_ARGS[@]}" search "Multi-Paxos" --explain
echo -e "\n${GREEN}=== Status ===${RESET}"
"$SEMQ" "${SEMQ_ARGS[@]}" status
echo -e "\n${GREEN}=== Done ===${RESET}"