Page MenuHomeFreeBSD

D34056.diff
No OneTemporary

D34056.diff

diff --git a/tests/sys/ses/common.h b/tests/sys/ses/common.h
--- a/tests/sys/ses/common.h
+++ b/tests/sys/ses/common.h
@@ -34,26 +34,36 @@
glob_t g;
int r;
unsigned i;
- bool tested = false;
g.gl_pathc = 0;
g.gl_pathv = NULL;
g.gl_offs = 0;
- r = glob("/dev/ses*", GLOB_NOSORT, NULL, &g);
+ r = glob("/dev/ses*", GLOB_NOCHECK | GLOB_NOSORT, NULL, &g);
ATF_REQUIRE_EQ(r, 0);
+ if (g.gl_matchc == 0)
+ return;
- for(i = 0; i < g.gl_pathc; i++) {
+ for(i = 0; i < g.gl_matchc; i++) {
int fd;
fd = open(g.gl_pathv[i], oflags);
ATF_REQUIRE(fd >= 0);
- tested |= cb(g.gl_pathv[i], fd);
+ cb(g.gl_pathv[i], fd);
close(fd);
}
- if (!tested)
- atf_tc_skip("No supported devices found");
-
globfree(&g);
}
+
+static bool
+has_ses()
+{
+ glob_t g;
+ int r;
+
+ r = glob("/dev/ses*", GLOB_NOCHECK | GLOB_NOSORT, NULL, &g);
+ ATF_REQUIRE_EQ(r, 0);
+
+ return (g.gl_matchc != 0);
+}
diff --git a/tests/sys/ses/destructive.c b/tests/sys/ses/destructive.c
--- a/tests/sys/ses/destructive.c
+++ b/tests/sys/ses/destructive.c
@@ -53,10 +53,10 @@
g.gl_pathv = NULL;
g.gl_offs = 0;
- r = glob("/dev/ses*", GLOB_NOSORT, NULL, &g);
+ r = glob("/dev/ses*", GLOB_NOCHECK | GLOB_NOSORT, NULL, &g);
ATF_REQUIRE_EQ(r, 0);
- if (g.gl_pathc == 0)
- atf_tc_skip("No ses devices found");
+ if (g.gl_matchc == 0)
+ return;
fd = open(g.gl_pathv[0], O_RDWR);
ATF_REQUIRE(fd >= 0);
@@ -84,7 +84,6 @@
for (elm_idx = 0; elm_idx < nobj; elm_idx++) {
encioc_elm_status_t elmstat;
struct ses_ctrl_dev_slot *cslot;
- struct ses_status_dev_slot *sslot;
if (last_elm_type != map[elm_idx].elm_type) {
/* skip overall elements */
@@ -99,7 +98,6 @@
ATF_REQUIRE_EQ(r, 0);
cslot = (struct ses_ctrl_dev_slot*)&elmstat.cstat[0];
- sslot = (struct ses_status_dev_slot*)&elmstat.cstat[0];
ses_ctrl_common_set_select(&cslot->common, 1);
ses_ctrl_dev_slot_set_rqst_ident(cslot, 1);
@@ -203,10 +201,16 @@
}
ATF_TC_BODY(setelmstat, tc)
{
+ if (!has_ses())
+ atf_tc_skip("No ses devices found");
+
for_one_ses_dev(do_setelmstat);
}
ATF_TC_CLEANUP(setelmstat, tc)
{
+ if (!has_ses())
+ return;
+
for_one_ses_dev(do_setelmstat_cleanup);
}
@@ -262,6 +266,9 @@
}
ATF_TC_BODY(setencstat, tc)
{
+ if (!has_ses())
+ atf_tc_skip("No ses devices found");
+
for_each_ses_dev(do_setencstat, O_RDWR);
}
ATF_TC_CLEANUP(setencstat, tc)
diff --git a/tests/sys/ses/nondestructive.c b/tests/sys/ses/nondestructive.c
--- a/tests/sys/ses/nondestructive.c
+++ b/tests/sys/ses/nondestructive.c
@@ -120,6 +120,8 @@
}
ATF_TC_BODY(getelmdesc, tc)
{
+ if (!has_ses())
+ atf_tc_skip("No ses devices found");
for_each_ses_dev(do_getelmdesc, O_RDONLY);
}
@@ -221,6 +223,8 @@
}
ATF_TC_BODY(getelmdevnames, tc)
{
+ if (!has_ses())
+ atf_tc_skip("No ses devices found");
for_each_ses_dev(do_getelmdevnames, O_RDONLY);
}
@@ -311,6 +315,8 @@
}
ATF_TC_BODY(getelmmap, tc)
{
+ if (!has_ses())
+ atf_tc_skip("No ses devices found");
for_each_ses_dev(do_getelmmap, O_RDONLY);
}
@@ -380,6 +386,8 @@
}
ATF_TC_BODY(getelmstat, tc)
{
+ if (!has_ses())
+ atf_tc_skip("No ses devices found");
for_each_ses_dev(do_getelmstat, O_RDONLY);
}
@@ -428,6 +436,8 @@
}
ATF_TC_BODY(getencid, tc)
{
+ if (!has_ses())
+ atf_tc_skip("No ses devices found");
for_each_ses_dev(do_getencid, O_RDONLY);
}
@@ -472,6 +482,8 @@
}
ATF_TC_BODY(getencname, tc)
{
+ if (!has_ses())
+ atf_tc_skip("No ses devices found");
for_each_ses_dev(do_getencname, O_RDONLY);
}
@@ -513,6 +525,8 @@
}
ATF_TC_BODY(getencstat, tc)
{
+ if (!has_ses())
+ atf_tc_skip("No ses devices found");
for_each_ses_dev(do_getencstat, O_RDONLY);
}
@@ -559,6 +573,8 @@
}
ATF_TC_BODY(getnelm, tc)
{
+ if (!has_ses())
+ atf_tc_skip("No ses devices found");
for_each_ses_dev(do_getnelm, O_RDONLY);
}
@@ -609,6 +625,8 @@
}
ATF_TC_BODY(getstring, tc)
{
+ if (!has_ses())
+ atf_tc_skip("No ses devices found");
atf_tc_expect_fail("Bug 258188 ENCIO_GETSTRING does not set the string's returned size");
for_each_ses_dev(do_getstring, O_RDWR);
}

File Metadata

Mime Type
text/plain
Expires
Fri, Nov 8, 7:28 AM (21 h, 22 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
14530351
Default Alt Text
D34056.diff (3 KB)

Event Timeline