feat: add android-fs5 CLI toolset
- 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)
This commit is contained in:
@@ -0,0 +1,43 @@
|
||||
#!/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 ]
|
||||
}
|
||||
Reference in New Issue
Block a user