logo

utils-std

Collection of commonly available Unix tools git clone https://anongit.hacktivis.me/git/utils-std.git

df (1276B)


  1. #!/usr/bin/env atf-sh
  2. # SPDX-FileCopyrightText: 2017 Haelwenn (lanodan) Monnier <contact+utils@hacktivis.me>
  3. # SPDX-License-Identifier: MPL-2.0
  4. atf_test_case posix
  5. posix_body() {
  6. # stderr ignored because not all filesystems allow statvfs from a normal user.
  7. # For example tracefs aka "/sys/kernel/debug/tracing" on Linux.
  8. atf_check -e ignore -o 'match:Filesystem 512-blocks Used Available Capacity Mounted on' sh -c '../cmd/df -P | head -n 1'
  9. atf_check -e ignore -o 'match:Filesystem 1024-blocks Used Available Capacity Mounted on' sh -c '../cmd/df -Pk | head -n 1'
  10. atf_check -e ignore -o 'match:^[^ ]* [0-9]* [0-9]* [0-9]* [0-9]*% [^ ]$' sh -c '../cmd/df -P | sed -n 2,\$p'
  11. atf_check -e ignore -o 'match:^[^ ]* [0-9]* [0-9]* [0-9]* [0-9]*% [^ ]$' sh -c '../cmd/df -Pk | sed -n 2,\$p'
  12. atf_check -e ignore -o 'match:^[^ ]* [0-9]* [0-9]* [0-9]* [0-9]*% [^ ]$' sh -c '../cmd/df -Pa | sed -n 2,\$p'
  13. atf_check -e ignore -o 'match:^[^ ]* [0-9]* [0-9]* [0-9]* [0-9]*% [^ ]$' sh -c '../cmd/df -Pak | sed -n 2,\$p'
  14. }
  15. atf_test_case args
  16. args_body() {
  17. atf_check -e ignore -o 'match:^[^ ]* [0-9]* [0-9]* [0-9]* [0-9]*% /$' sh -c '../cmd/df -P / | sed -n 2,\$p'
  18. }
  19. atf_init_test_cases() {
  20. cd "$(atf_get_srcdir)" || exit 1
  21. atf_add_test_case posix
  22. atf_add_test_case args
  23. }