testufs 647 B

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. #!/bin/rc
  2. # Regression tests for devufs
  3. fn tidyup {
  4. if (test -d /dev/ufs/0) echo unmount > /dev/ufs/0/ctl
  5. if (test -f $img) rm $img
  6. }
  7. fn pass {
  8. tidyup
  9. echo PASS
  10. exit PASS
  11. }
  12. fn fail {
  13. if (! $2 = notidy) tidyup
  14. echo FAIL - $1
  15. exit FAIL
  16. }
  17. img=testufsimg
  18. if (test -f $img) fail $img^' already exists' notidy
  19. if (! test -d /dev/ufs) fail '/dev/ufs does not exist' notidy
  20. if (test -d /dev/ufs/0) fail '/dev/ufs/0 already exists' notidy
  21. # Create and mount
  22. newfs $img
  23. if (! ~ $status '') fail 'Could not create fs image'
  24. echo $img > /dev/ufs/mount
  25. if (! test -d /dev/ufs/0) fail 'Could not mount'
  26. # Tests
  27. cat /dev/ufs/0/stats
  28. pass