aosp12/external/toybox/tests/hostname.test

13 lines
330 B
Bash
Executable File

#!/bin/bash
[ -f testing.sh ] && . testing.sh
#testing "name" "command" "result" "infile" "stdin"
HOST="$(cat /proc/sys/kernel/hostname 2>/dev/null)"
skipnot [ $? -eq 0 ]
testing "get" "hostname" "$HOST\n" "" ""
skipnot [ $(id -u) -eq 0 ]
testing "set" 'hostname "2>&1 | tee"; hostname; hostname "$HOST"' "2>&1 | tee\n" "" ""