render / rpms / libvirt

Forked from rpms/libvirt 9 months ago
Clone
Blob Blame History Raw
From 9045e6beec5341e8bff8333106a27fefc5621f78 Mon Sep 17 00:00:00 2001
Message-Id: <9045e6beec5341e8bff8333106a27fefc5621f78@dist-git>
From: Osier Yang <jyang@redhat.com>
Date: Sun, 2 Feb 2014 23:09:44 +0800
Subject: [PATCH] tests: Modify the scsi util tests

https://bugzilla.redhat.com/show_bug.cgi?id=957292

Add tests/virscsidata/sg0 and tests/virscsidata/sg8 as the test
input for constructing scsi->sg_path. And change the scsi generic
number of "1:0:0:0", because it's easy to hide the problem (assuming
most machines have a CDROM drive).

Signed-off-by: Osier Yang <jyang@redhat.com>
(cherry picked from commit 14177ebc2424a0f7d734d9974c557fb75cb6185c)
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
---
 tests/virscsidata/1:0:0:0/block/sdh/dev        | 1 +
 tests/virscsidata/1:0:0:0/block/sr0/dev        | 1 -
 tests/virscsidata/1:0:0:0/scsi_generic/sg1/dev | 1 -
 tests/virscsidata/1:0:0:0/scsi_generic/sg8/dev | 1 +
 tests/virscsidata/sg0                          | 0
 tests/virscsidata/sg8                          | 0
 tests/virscsitest.c                            | 4 ++--
 7 files changed, 4 insertions(+), 4 deletions(-)
 create mode 100644 tests/virscsidata/1:0:0:0/block/sdh/dev
 delete mode 100644 tests/virscsidata/1:0:0:0/block/sr0/dev
 delete mode 100644 tests/virscsidata/1:0:0:0/scsi_generic/sg1/dev
 create mode 100644 tests/virscsidata/1:0:0:0/scsi_generic/sg8/dev
 create mode 100644 tests/virscsidata/sg0
 create mode 100644 tests/virscsidata/sg8

diff --git a/tests/virscsidata/1:0:0:0/block/sdh/dev b/tests/virscsidata/1:0:0:0/block/sdh/dev
new file mode 100644
index 0000000..3d33f0f
--- /dev/null
+++ b/tests/virscsidata/1:0:0:0/block/sdh/dev
@@ -0,0 +1 @@
+11:0
diff --git a/tests/virscsidata/1:0:0:0/block/sr0/dev b/tests/virscsidata/1:0:0:0/block/sr0/dev
deleted file mode 100644
index 3d33f0f..0000000
--- a/tests/virscsidata/1:0:0:0/block/sr0/dev
+++ /dev/null
@@ -1 +0,0 @@
-11:0
diff --git a/tests/virscsidata/1:0:0:0/scsi_generic/sg1/dev b/tests/virscsidata/1:0:0:0/scsi_generic/sg1/dev
deleted file mode 100644
index bd84814..0000000
--- a/tests/virscsidata/1:0:0:0/scsi_generic/sg1/dev
+++ /dev/null
@@ -1 +0,0 @@
-21:1
diff --git a/tests/virscsidata/1:0:0:0/scsi_generic/sg8/dev b/tests/virscsidata/1:0:0:0/scsi_generic/sg8/dev
new file mode 100644
index 0000000..bd84814
--- /dev/null
+++ b/tests/virscsidata/1:0:0:0/scsi_generic/sg8/dev
@@ -0,0 +1 @@
+21:1
diff --git a/tests/virscsidata/sg0 b/tests/virscsidata/sg0
new file mode 100644
index 0000000..e69de29
diff --git a/tests/virscsidata/sg8 b/tests/virscsidata/sg8
new file mode 100644
index 0000000..e69de29
diff --git a/tests/virscsitest.c b/tests/virscsitest.c
index f95898b..612040c 100644
--- a/tests/virscsitest.c
+++ b/tests/virscsitest.c
@@ -43,7 +43,7 @@ test1(const void *data ATTRIBUTE_UNUSED)
                                          "scsi_host1", 0, 0, 0)))
         return -1;
 
-    if (STRNEQ(name, "sr0"))
+    if (STRNEQ(name, "sdh"))
         goto cleanup;
 
     ret = 0;
@@ -72,7 +72,7 @@ test2(const void *data ATTRIBUTE_UNUSED)
     sgname = virSCSIDeviceGetSgName(virscsi_prefix,
                                     "scsi_host1", 0, 0, 0);
 
-    if (!sgname || STRNEQ(sgname, "sg1"))
+    if (!sgname || STRNEQ(sgname, "sg8"))
         goto cleanup;
 
     if (!(dev = virSCSIDeviceNew(virscsi_prefix, "scsi_host1",
-- 
1.8.5.4