logo

utils-extra

Collection of extra tools for Unixes

sname (922B)


  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. # sed is because of FreeBSD
  7. atf_check -o "inline:machine $(uname -m)
  8. nodename $(uname -n)
  9. release $(uname -r)
  10. sysname $(uname -s)
  11. version $(uname -v | sed 's; *$;;')
  12. " \
  13. ../cmd/sname
  14. }
  15. atf_test_case devfull
  16. devfull_body() {
  17. has_glibc && atf_expect_fail "glibc ignoring write errors for puts()"
  18. [ "$(uname -s)" = "NetBSD" ] && atf_expect_fail "NetBSD ignoring write errors for puts()"
  19. [ "$(uname -s)" = "FreeBSD" ] && atf_expect_fail "FreeBSD ignoring write errors for puts()"
  20. atf_check -s exit:1 -e 'inline:sname: printf: No space left on device\n' sh -c '../cmd/sname >/dev/full'
  21. }
  22. atf_init_test_cases() {
  23. cd "$(atf_get_srcdir)" || exit 1
  24. . ../test_functions.sh
  25. atf_add_test_case generic
  26. atf_add_test_case devfull
  27. }