logo

utils

~/.local/bin tools and git-hooks git clone https://hacktivis.me/git/utils.git

sname (934B)


  1. #!/usr/bin/env atf-sh
  2. # SPDX-FileCopyrightText: 2017-2022 Haelwenn (lanodan) Monnier <contact+utils@hacktivis.me>
  3. # SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only
  4. atf_test_case generic
  5. generic_body() {
  6. # sed is because of FreeBSD
  7. atf_check -o "inline:\
  8. sysname=$(uname -s)
  9. nodename=$(uname -n)
  10. release=$(uname -r)
  11. version=$(uname -v | sed 's; *$;;')
  12. machine=$(uname -m)
  13. " ../bin/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: No space left on device\n' sh -c '../bin/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. }