aboutsummaryrefslogtreecommitdiff
path: root/tests/hostname.test
blob: ba65a398c5c742cb32fb480914a91a5c755a2abb (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
#!/bin/bash

[ -f testing.sh ] && . testing.sh

#testing "name" "command" "result" "infile" "stdin"

HOST="$(cat /proc/sys/kernel/hostname)"
testing "get" "hostname" "$HOST\n" "" ""

if [ "$(id -u)" -ne 0 ]
then
  echo "$SHOWSKIP: groupdel (not root)"
  return 2>/dev/null
  exit
fi

testing "set" 'hostname "2>&1 | tee"; hostname; hostname "$HOST"' "2>&1 | tee\n" "" ""