]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - tests/zfs-tests/tests/functional/cli_root/zdb/zdb_006_pos.ksh
Vendor import of openzfs master @ 184df27eef0abdc7ab2105b21257f753834b936b
[FreeBSD/FreeBSD.git] / tests / zfs-tests / tests / functional / cli_root / zdb / zdb_006_pos.ksh
1 #!/bin/ksh
2
3 #
4 # This file and its contents are supplied under the terms of the
5 # Common Development and Distribution License ("CDDL"), version 1.0.
6 # You may only use this file in accordance with the terms of version
7 # 1.0 of the CDDL.
8 #
9 # A full copy of the text of the CDDL should have accompanied this
10 # source.  A copy of the CDDL is also available via the Internet at
11 # http://www.illumos.org/license/CDDL.
12 #
13
14 #
15 # Copyright (c) 2018 by Nutanix. All rights reserved.
16 #
17
18 . $STF_SUITE/include/libtest.shlib
19
20 #
21 # Description:
22 # zdb -d will work on imported/exported pool with pool/dataset argument
23 #
24 # Strategy:
25 # 1. Create a pool
26 # 2. Run zdb -d with pool and dataset arguments.
27 # 3. Export the pool
28 # 4. Run zdb -ed with pool and dataset arguments.
29 #
30
31 function cleanup
32 {
33         datasetexists $TESTPOOL && destroy_pool $TESTPOOL
34         for DISK in $DISKS; do
35                 zpool labelclear -f $DEV_RDSKDIR/$DISK
36         done
37 }
38
39 log_assert "Verify zdb -d works on imported/exported pool with pool/dataset argument"
40 log_onexit cleanup
41
42 verify_runnable "global"
43 verify_disk_count "$DISKS" 2
44
45 default_mirror_setup_noexit $DISKS
46 log_must zfs snap $TESTPOOL/$TESTFS@snap
47
48 log_must zdb -d $TESTPOOL
49 log_must zdb -d $TESTPOOL/
50 log_must zdb -d $TESTPOOL/$TESTFS
51 log_must zdb -d $TESTPOOL/$TESTFS@snap
52
53 log_must zpool export $TESTPOOL
54
55 log_must zdb -ed $TESTPOOL
56 log_must zdb -ed $TESTPOOL/
57 log_must zdb -ed $TESTPOOL/$TESTFS
58 log_must zdb -ed $TESTPOOL/$TESTFS@snap
59
60 log_must zpool import $TESTPOOL
61
62 cleanup
63
64 log_pass "zdb -d works on imported/exported pool with pool/dataset argument"