Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F166585016
D13185.id35610.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
1 KB
Referenced Files
None
Subscribers
None
D13185.id35610.diff
View Options
Index: head/lib/libcam/tests/libcam_test.c
===================================================================
--- head/lib/libcam/tests/libcam_test.c
+++ head/lib/libcam/tests/libcam_test.c
@@ -129,6 +129,33 @@
ATF_REQUIRE(parsed_unit == expected_unit);
}
+/*
+ * sa(4) uniquely creates nsa and esa device nodes for non-rewind operations
+ * and eject-on-close operations. cam_get_device must special case these nodes
+ * to always return the base device.
+ */
+ATF_TC_WITHOUT_HEAD(cam_get_device_sa_test);
+ATF_TC_BODY(cam_get_device_sa_test, tc)
+{
+ char parsed_dev_name[DEV_IDLEN + 1];
+ int parsed_unit;
+
+ ATF_REQUIRE_MSG(cam_get_device("nsa99", parsed_dev_name,
+ nitems(parsed_dev_name), &parsed_unit) == 0,
+ "cam_get_device failed");
+ ATF_REQUIRE_STREQ(parsed_dev_name, "sa");
+ ATF_REQUIRE(parsed_unit == 99);
+
+ strcpy(parsed_dev_name, "");
+ parsed_unit = -1;
+
+ ATF_REQUIRE_MSG(cam_get_device("esa99", parsed_dev_name,
+ nitems(parsed_dev_name), &parsed_unit) == 0,
+ "cam_get_device failed");
+ ATF_REQUIRE_STREQ(parsed_dev_name, "sa");
+ ATF_REQUIRE(parsed_unit == 99);
+}
+
ATF_TC(cam_open_device_negative_test_O_RDONLY);
ATF_TC_HEAD(cam_open_device_negative_test_O_RDONLY, tc)
{
@@ -282,6 +309,7 @@
ATF_TP_ADD_TC(tp, cam_get_device_negative_test_nul_path);
ATF_TP_ADD_TC(tp, cam_get_device_negative_test_root);
ATF_TP_ADD_TC(tp, cam_get_device_positive_test);
+ ATF_TP_ADD_TC(tp, cam_get_device_sa_test);
ATF_TP_ADD_TC(tp, cam_open_device_negative_test_O_RDONLY);
ATF_TP_ADD_TC(tp, cam_open_device_negative_test_nonexistent);
ATF_TP_ADD_TC(tp, cam_open_device_negative_test_unprivileged);
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sat, Aug 15, 6:15 PM (15 h, 35 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
36787840
Default Alt Text
D13185.id35610.diff (1 KB)
Attached To
Mode
D13185: Add a test case for cam_get_device with sa(4) devices
Attached
Detach File
Event Timeline
Log In to Comment