Project

General

Profile

Bug #12181

zvol tests should avoid grep -w

Added by Jason King 11 months ago. Updated 10 months ago.

Status:
Closed
Priority:
Normal
Assignee:
-
Category:
tests
Start date:
Due date:
% Done:

100%

Estimated time:
Difficulty:
Medium
Tags:
Gerrit CR:

Description

14:24:38.17 NOTE: Executing: swap -d /dev/zvol/dsk/rpool/swap
14:24:38.67 SUCCESS: zpool create -f testpool c3t0d0
14:24:38.85 SUCCESS: zfs create -V 2g testpool/testvol
...
14:25:22.06 ASSERTION: Verify the sum of swaplow and swaplen is less or equal to volsize
14:25:22.14 /dev/zvol/dsk/testpool/testvol: Overlapping swap files are not allowed
14:25:22.14 ERROR: swap -a /dev/zvol/dsk/testpool/testvol 87088 3511289 exited 2

It almost seems like a prior test might not be cleaning things up fully, causing this to fail


Related issues

Related to illumos gate - Bug #12273: Forward slash foils grep -wNew

Actions
Has duplicate illumos gate - Bug #12182: zfs-test zvol_swap_005_pos can failClosed

Actions
#1

Updated by Jason King 10 months ago

  • Has duplicate Bug #12182: zfs-test zvol_swap_005_pos can fail added
#2

Updated by Jason King 10 months ago

The problem appears to be a change in behavior (unknown if this itself is a bug) in 'grep -w':

The is_swap_inuse function in usr/src/test/zfs-tests/tests/functional/zvol/zvol_common.shlib does the following check:

       swap -l | grep -w $device > /dev/null 2>&1

After a failed zvol_swap_002_pos test:

root@pi:/opt/zfs-tests/tests/functional/zvol# swap -l | grep -w '/dev/zvol/dsk/testpool/testvol'
root@pi:/opt/zfs-tests/tests/functional/zvol# swap -l | /usr/gnu/bin/grep -w '/dev/zvol/dsk/testpool/testvol'
/dev/zvol/dsk/testpool/testvol 266,596        8  4194296  4194296

Changing the is_swap_inuse to use swap -l | grep "^$device" > /dev/null 2>&1 should fix it, but it's unknown if the problem is with zvol_common.shlib or illumos grep.

#3

Updated by Jason King 10 months ago

  • Related to Bug #12273: Forward slash foils grep -w added
#4

Updated by Jason King 10 months ago

  • Subject changed from zvol_swap_005_pos can fail to zvol swap tests should avoid grep -w

Given there's currently no clear answer around the correct behavior of grep -w, it seems simpler to just avoid it.

#5

Updated by Jason King 10 months ago

To test, I ran all of the zvol swap tests w/ this fix combined with the fix for #12281. With both fixes applied, all of the zvol swap tests (including setup and cleanup) now pass. In addition, I verified that after the tests were complete that any temporary swap volumes were removed and the test pool was destroyed.

#6

Updated by Jason King 10 months ago

  • Subject changed from zvol swap tests should avoid grep -w to zvol tests should avoid grep -w
#7

Updated by Jason King 10 months ago

I also ran the zvol misc tests as well, which also passed.

#8

Updated by Electric Monk 10 months ago

  • Status changed from New to Closed
  • % Done changed from 0 to 100

git commit d3879c39d2a534146eaf46dc510b80678ea24023

commit  d3879c39d2a534146eaf46dc510b80678ea24023
Author: Jason King <jason.king@joyent.com>
Date:   2020-02-14T22:47:37.000Z

    12181 zvol tests should avoid grep -w
    12281 zvol_swap_003_pos shouldn't use swapadd in cleanup
    Reviewed by: Kody Kantor <kody@kkantor.com>
    Reviewed by: Andy Stormont <astormont@racktopsystems.com>
    Approved by: Dan McDonald <danmcd@joyent.com>

Also available in: Atom PDF