sname (922B)
- #!/usr/bin/env atf-sh
- # SPDX-FileCopyrightText: 2017-2022 Haelwenn (lanodan) Monnier <contact+utils@hacktivis.me>
- # SPDX-License-Identifier: MPL-2.0
- atf_test_case generic
- generic_body() {
- # sed is because of FreeBSD
- atf_check -o "inline:machine $(uname -m)
- nodename $(uname -n)
- release $(uname -r)
- sysname $(uname -s)
- version $(uname -v | sed 's; *$;;')
- " \
- ../cmd/sname
- }
- atf_test_case devfull
- devfull_body() {
- has_glibc && atf_expect_fail "glibc ignoring write errors for puts()"
- [ "$(uname -s)" = "NetBSD" ] && atf_expect_fail "NetBSD ignoring write errors for puts()"
- [ "$(uname -s)" = "FreeBSD" ] && atf_expect_fail "FreeBSD ignoring write errors for puts()"
- atf_check -s exit:1 -e 'inline:sname: printf: No space left on device\n' sh -c '../cmd/sname >/dev/full'
- }
- atf_init_test_cases() {
- cd "$(atf_get_srcdir)" || exit 1
- . ../test_functions.sh
- atf_add_test_case generic
- atf_add_test_case devfull
- }