aboutsummaryrefslogtreecommitdiff
path: root/tests/hostname.test
blob: d94f480aef20eed50cf70a241e5cdd6983f79172 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
#!/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" "" ""