- fs5 entrypoint with status, push, pull, app, shell, logs commands - lib/adb.sh: ADB wrapper functions with idempotency and --force guards - lib/output.sh: human + JSON output formatting via Python - 33 bats tests (6 status, 9 transfer, 7 app, 5 shell, 6 logs) — all passing - Zero shellcheck warnings - .env-based config (device serial, log path) - Spec-Driven Development artifacts in specs/001-android-fs5-management/ Device: exone GmbH FS5 (RD51QE202392, Android 9)
44 lines
1002 B
Bash
44 lines
1002 B
Bash
#!/usr/bin/env bats
|
|
# tests/test_shell.bats — Tests for 'fs5 shell' command (US4)
|
|
|
|
bats_require_minimum_version 1.5.0
|
|
|
|
SCRIPT="${BATS_TEST_DIRNAME}/../fs5"
|
|
|
|
setup() {
|
|
export DEVICE_SERIAL="RD51QE202392"
|
|
export LOG_FILE="/tmp/fs5-test-$$.log"
|
|
}
|
|
|
|
teardown() {
|
|
rm -f "${LOG_FILE}"
|
|
}
|
|
|
|
@test "shell: executes echo command on device" {
|
|
run "${SCRIPT}" shell "echo hello-from-device"
|
|
[ "${status}" -eq 0 ]
|
|
[[ "${output}" == *"hello-from-device"* ]]
|
|
}
|
|
|
|
@test "shell: forwards exit code from device command" {
|
|
run "${SCRIPT}" shell "exit 0"
|
|
[ "${status}" -eq 0 ]
|
|
}
|
|
|
|
@test "shell: returns device hostname/uname" {
|
|
run "${SCRIPT}" shell "uname -s"
|
|
[ "${status}" -eq 0 ]
|
|
[[ "${output}" == *"Linux"* ]]
|
|
}
|
|
|
|
@test "shell: --help shows usage" {
|
|
run "${SCRIPT}" shell --help
|
|
[ "${status}" -eq 0 ]
|
|
[[ "${output}" == *"shell"* ]]
|
|
}
|
|
|
|
@test "shell: exits with code 2 when device not connected" {
|
|
DEVICE_SERIAL="INVALID_SERIAL_000" run "${SCRIPT}" shell "echo test"
|
|
[ "${status}" -eq 2 ]
|
|
}
|