toybox/tests/hostname.test
<<
>>
Prefs
   1#!/bin/bash
   2
   3[ -f testing.sh ] && . testing.sh
   4
   5#testing "name" "command" "result" "infile" "stdin"
   6
   7HOST="$(cat /proc/sys/kernel/hostname 2>/dev/null)"
   8skipnot [ $? -eq 0 ]
   9testing "get" "hostname" "$HOST\n" "" ""
  10
  11skipnot [ $(id -u) -eq 0 ]
  12testing "set" 'hostname "2>&1 | tee"; hostname; hostname "$HOST"' "2>&1 | tee\n" "" ""
  13