chmod (1518B)
- #!/usr/bin/env atf-sh
- # SPDX-FileCopyrightText: 2017 Haelwenn (lanodan) Monnier <contact+utils@hacktivis.me>
- # SPDX-License-Identifier: MPL-2.0
- atf_test_case octal cleanup
- octal_body() {
- atf_check touch "${TMPDIR}/chmod_octal"
- atf_check -o "inline:chmod: Permissions changed from 00644/-rw-r--r-- to 00000/---------- for '${TMPDIR}/chmod_octal'\n" ../cmd/chmod -v 0 "${TMPDIR}/chmod_octal"
- atf_check -o "inline:chmod: Permissions already set to 00000/---------- for '${TMPDIR}/chmod_octal'\n" ../cmd/chmod -v 00 "${TMPDIR}/chmod_octal"
- atf_check -o "inline:chmod: Permissions already set to 00000/---------- for '${TMPDIR}/chmod_octal'\n" ../cmd/chmod -v 000 "${TMPDIR}/chmod_octal"
- atf_check -o "inline:chmod: Permissions already set to 00000/---------- for '${TMPDIR}/chmod_octal'\n" ../cmd/chmod -v 0000 "${TMPDIR}/chmod_octal"
- atf_check -o "inline:chmod: Permissions changed from 00000/---------- to 00444/-r--r--r-- for '${TMPDIR}/chmod_octal'\n" ../cmd/chmod -v 0444 "${TMPDIR}/chmod_octal"
- atf_check -o "inline:chmod: Permissions changed from 00444/-r--r--r-- to 00777/-rwxrwxrwx for '${TMPDIR}/chmod_octal'\n" ../cmd/chmod -v 0777 "${TMPDIR}/chmod_octal"
- atf_check -s not-exit:0 -e "inline:chmod: Failed parsing mode '0888': contains digit outside of [0-7]\n" ../cmd/chmod -v 0888 "${TMPDIR}/chmod_octal"
- }
- octal_cleanup() {
- atf_check chmod u=rw "${TMPDIR}/chmod_octal"
- atf_check rm "${TMPDIR}/chmod_octal"
- }
- atf_init_test_cases() {
- cd "$(atf_get_srcdir)" || exit 1
- atf_add_test_case octal
- }