zram02.sh 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. #!/bin/sh
  2. # Copyright (c) 2015 Oracle and/or its affiliates. All Rights Reserved.
  3. # Copyright (c) 2019 Petr Vorel <pvorel@suse.cz>
  4. # Author: Alexey Kodanev <alexey.kodanev@oracle.com>
  5. #
  6. # Test checks that we can create swap zram device.
  7. TST_CNT=5
  8. TST_TESTFUNC="do_test"
  9. . zram_lib.sh
  10. # Test will create the following number of zram devices:
  11. dev_num=1
  12. # This is a list of parameters for zram devices.
  13. # Number of items must be equal to 'dev_num' parameter.
  14. zram_max_streams="2"
  15. # The zram sysfs node 'disksize' value can be either in bytes,
  16. # or you can use mem suffixes. But in some old kernels, mem
  17. # suffixes are not supported, for example, in RHEL6.6GA's kernel
  18. # layer, it uses strict_strtoull() to parse disksize which does
  19. # not support mem suffixes, in some newer kernels, they use
  20. # memparse() which supports mem suffixes. So here we just use
  21. # bytes to make sure everything works correctly.
  22. zram_sizes="107374182400" # 100GB
  23. zram_mem_limits="1M"
  24. do_test()
  25. {
  26. case $1 in
  27. 1) zram_max_streams;;
  28. 2) zram_set_disksizes;;
  29. 3) zram_set_memlimit;;
  30. 4) zram_makeswap;;
  31. 5) zram_swapoff;;
  32. esac
  33. }
  34. tst_run