logo

utils

Old programs, got split in utils-std and utils-extra git clone https://hacktivis.me/git/utils.git

sname (1072B)


  1. #!/usr/bin/env atf-sh
  2. # SPDX-FileCopyrightText: 2017-2022 Haelwenn (lanodan) Monnier <contact+utils@hacktivis.me>
  3. # SPDX-License-Identifier: MPL-2.0
  4. atf_test_case generic
  5. generic_body() {
  6. domainname=""
  7. if [ "$(uname -s)" = "Linux" ]; then
  8. domainname="$(hostname -d)"
  9. domainname="domainname ${domainname:-(none)}\n"
  10. fi
  11. # sed is because of FreeBSD
  12. atf_check -o "inline:${domainname}\
  13. machine $(uname -m)
  14. nodename $(uname -n)
  15. release $(uname -r)
  16. sysname $(uname -s)
  17. version $(uname -v | sed 's; *$;;')
  18. " ../cmd/sname
  19. }
  20. atf_test_case devfull
  21. devfull_body() {
  22. has_glibc && atf_expect_fail "glibc ignoring write errors for puts()"
  23. [ "$(uname -s)" = "NetBSD" ] && atf_expect_fail "NetBSD ignoring write errors for puts()"
  24. [ "$(uname -s)" = "FreeBSD" ] && atf_expect_fail "FreeBSD ignoring write errors for puts()"
  25. atf_check -s exit:1 -e 'inline:sname: printf: No space left on device\n' sh -c '../cmd/sname >/dev/full'
  26. }
  27. atf_init_test_cases() {
  28. cd "$(atf_get_srcdir)" || exit 1
  29. . ../test_functions.sh
  30. atf_add_test_case generic
  31. atf_add_test_case devfull
  32. }