From Fedora Project Wiki

(initial writeup)
 
(category)
 
(3 intermediate revisions by 2 users not shown)
Line 1: Line 1:
{{QA/Test_Case
{{QA/Test_Case
|description=Test enable swap-on-zram with a custom configuration.
|description=Test swap-on-zram with a custom configuration.
 
|setup=
# Make sure your system has swap-on-zram [[QA:Testcase SwapOnZRAM install and enable|installed and enabled]].


|actions=
|actions=
<ol>
<ol>
<li> swap-on-zram should be enabled and running to start this test.
<li> Create a custom configuration file, which will override the default configuration file:
<li> Create a custom configuration file.
<pre>sudo cp /usr/share/doc/zram-generator/zram-generator.conf.example /etc/systemd/zram-generator.conf</pre>
<pre>$ sudo cp /usr/share/doc/zram-generator/zram-generator.conf.example /etc/systemd/zram-generator.conf
<li> Edit the configuration file, read the included documentation, and set custom values. (Pay attention to `host-memory-limit`, if you have more total memory than this value, the zram device will not get created at all).
$ sudo nano /etc/systemd/zram-generator.conf
<pre>sudo nano /etc/systemd/zram-generator.conf</pre>
<li> Confirm you're getting the results you expect.
<li> Restart the swap-on-zram service to apply your changes:
<pre>
<pre>sudo systemctl restart swap-create@zram0.service</pre>
$ sudo systemctl status swap-create@zram0
<li> Confirm the swap-on-zram service was run correctly (its status is `active (exited)`):
<pre>$ sudo systemctl status swap-create@zram0.service
● swap-create@zram0.service - Create swap on /dev/zram0
● swap-create@zram0.service - Create swap on /dev/zram0
     Loaded: loaded (/usr/lib/systemd/system/swap-create@.service; static; vendor preset: disabled)
     Loaded: loaded (/usr/lib/systemd/system/swap-create@.service; static; vendor preset: disabled)
Line 24: Line 28:
Jun 28 19:52:48 fmac.local zram-generator[653]: no label, UUID=72991b9c-f8fd-459c-9bb8-6e8ac19a16c2
Jun 28 19:52:48 fmac.local zram-generator[653]: no label, UUID=72991b9c-f8fd-459c-9bb8-6e8ac19a16c2
Jun 28 19:52:48 fmac.local systemd[1]: Finished Create swap on /dev/zram0.
Jun 28 19:52:48 fmac.local systemd[1]: Finished Create swap on /dev/zram0.
$ zramctl
</pre>
<li> Look at `zramctl` and `swapon` output and confirm the zram device is configured according to your custom values you've set in the configuration file.
<pre>$ zramctl
NAME      ALGORITHM DISKSIZE DATA COMPR TOTAL STREAMS MOUNTPOINT
NAME      ALGORITHM DISKSIZE DATA COMPR TOTAL STREAMS MOUNTPOINT
/dev/zram0 lzo-rle      512M  4K  73B  12K      8 [SWAP]
/dev/zram0 lzo-rle      512M  4K  73B  12K      8 [SWAP]
$ swapon
$ swapon
NAME      TYPE      SIZE USED PRIO
NAME      TYPE      SIZE USED PRIO
/dev/sda5  partition 10.4G  0B  -2
/dev/sda5  partition 10.4G  0B  -2
/dev/zram0 partition  512M  0B  100
/dev/zram0 partition  512M  0B  100
$ </pre>
</pre>
<li> After you verified this test case, return back to the original state by deleting the custom configuration file and again restarting the service (or rebooting):
<pre>sudo rm /etc/systemd/zram-generator.conf
sudo systemctl restart swap-create@zram0.service
</pre>
</ol>
</ol>


|results=
|results=
# Status should be active (exited).  
# The swap-on-zram service should start correctly.
# There should be a `/dev/zram0` device listed for the `zramctl` properly sized, with the compression algorithm you specified in the configuration file.
# The values you set in the configuration file should correctly affect the zram swap device (size, algorithm, whether it exists at all, etc).
# The `/dev/zram0` device should appear for the `swapon` command, with the proper size and a priority of 100.
}}
}}


[[Category:Test Days Test Cases]]
[[Category:Test Days Test Cases]] [[Category:Package_rust-zram-generator_test_cases]]

Latest revision as of 07:03, 8 July 2020

Description

Test swap-on-zram with a custom configuration.

Setup

  1. Make sure your system has swap-on-zram installed and enabled.

How to test

  1. Create a custom configuration file, which will override the default configuration file:
    sudo cp /usr/share/doc/zram-generator/zram-generator.conf.example /etc/systemd/zram-generator.conf
  2. Edit the configuration file, read the included documentation, and set custom values. (Pay attention to host-memory-limit, if you have more total memory than this value, the zram device will not get created at all).
    sudo nano /etc/systemd/zram-generator.conf
  3. Restart the swap-on-zram service to apply your changes:
    sudo systemctl restart swap-create@zram0.service
  4. Confirm the swap-on-zram service was run correctly (its status is active (exited)):
    $ sudo systemctl status swap-create@zram0.service
    ● swap-create@zram0.service - Create swap on /dev/zram0
         Loaded: loaded (/usr/lib/systemd/system/swap-create@.service; static; vendor preset: disabled)
         Active: active (exited) since Sun 2020-06-28 19:52:48 MDT; 1min 0s ago
           Docs: man:zram-generator(8)
                 man:zram-generator.conf(5)
        Process: 650 ExecStart=/usr/lib/systemd/system-generators/zram-generator --setup-device zram0 (code=exited, status=0/SUCCESS)
       Main PID: 650 (code=exited, status=0/SUCCESS)
            CPU: 28ms
    
    Jun 28 19:52:48 fmac.local systemd[1]: Starting Create swap on /dev/zram0...
    Jun 28 19:52:48 fmac.local zram-generator[653]: Setting up swapspace version 1, size = 512 MiB (536866816 bytes)
    Jun 28 19:52:48 fmac.local zram-generator[653]: no label, UUID=72991b9c-f8fd-459c-9bb8-6e8ac19a16c2
    Jun 28 19:52:48 fmac.local systemd[1]: Finished Create swap on /dev/zram0.
    
  5. Look at zramctl and swapon output and confirm the zram device is configured according to your custom values you've set in the configuration file.
    $ zramctl
    NAME       ALGORITHM DISKSIZE DATA COMPR TOTAL STREAMS MOUNTPOINT
    /dev/zram0 lzo-rle       512M   4K   73B   12K       8 [SWAP]
    
    $ swapon
    NAME       TYPE       SIZE USED PRIO
    /dev/sda5  partition 10.4G   0B   -2
    /dev/zram0 partition  512M   0B  100
    
  6. After you verified this test case, return back to the original state by deleting the custom configuration file and again restarting the service (or rebooting):
    sudo rm /etc/systemd/zram-generator.conf
    sudo systemctl restart swap-create@zram0.service
    

Expected Results

  1. The swap-on-zram service should start correctly.
  2. The values you set in the configuration file should correctly affect the zram swap device (size, algorithm, whether it exists at all, etc).