Module Name:    src
Committed By:   pgoyette
Date:           Thu May  7 01:35:35 UTC 2015

Modified Files:
        src/tests/include: t_paths.c

Log Message:
Don't fail if open() of sysmon devices returns ENODEV.  This can
occur if sysmon subcomponents are not included in the kernel and
autoloading of modules is not allowed or not supported.


To generate a diff of this commit:
cvs rdiff -u -r1.14 -r1.15 src/tests/include/t_paths.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/tests/include/t_paths.c
diff -u src/tests/include/t_paths.c:1.14 src/tests/include/t_paths.c:1.15
--- src/tests/include/t_paths.c:1.14	Tue Nov  4 00:20:19 2014
+++ src/tests/include/t_paths.c	Thu May  7 01:35:35 2015
@@ -1,4 +1,4 @@
-/*	$NetBSD: t_paths.c,v 1.14 2014/11/04 00:20:19 justin Exp $ */
+/*	$NetBSD: t_paths.c,v 1.15 2015/05/07 01:35:35 pgoyette Exp $ */
 
 /*-
  * Copyright (c) 2011 The NetBSD Foundation, Inc.
@@ -29,7 +29,7 @@
  * POSSIBILITY OF SUCH DAMAGE.
  */
 #include <sys/cdefs.h>
-__RCSID("$NetBSD: t_paths.c,v 1.14 2014/11/04 00:20:19 justin Exp $");
+__RCSID("$NetBSD: t_paths.c,v 1.15 2015/05/07 01:35:35 pgoyette Exp $");
 
 #include <sys/param.h>
 #include <sys/stat.h>
@@ -47,6 +47,7 @@ __RCSID("$NetBSD: t_paths.c,v 1.14 2014/
 #define PATH_DIR	__BIT(1)	/* A directory		*/
 #define PATH_FILE	__BIT(2)	/* A file		*/
 #define PATH_ROOT	__BIT(3)	/* Access for root only */
+#define PATH_OPT	__BIT(3)	/* Optional, ENODEV if not supported */
 
 static const struct {
 	const char	*path;
@@ -82,7 +83,7 @@ static const struct {
 	{ _PATH_MIXER,		PATH_DEV		},
 	{ _PATH_MIXER0,		PATH_DEV		},
 	{ _PATH_NOLOGIN,	PATH_FILE		},
-	{ _PATH_POWER,		PATH_DEV | PATH_ROOT	},
+	{ _PATH_POWER,		PATH_DEV | PATH_ROOT | PATH_OPT	},
 	{ _PATH_PRINTCAP,	PATH_FILE		},
 	{ _PATH_PUD,		PATH_DEV | PATH_ROOT	},
 	{ _PATH_PUFFS,		PATH_DEV | PATH_ROOT	},
@@ -92,12 +93,13 @@ static const struct {
 	{ _PATH_SKEYKEYS,	PATH_FILE | PATH_ROOT	},
 	{ _PATH_SOUND,		PATH_DEV		},
 	{ _PATH_SOUND0,		PATH_DEV		},
-	{ _PATH_SYSMON,		PATH_DEV		},
+	{ _PATH_SYSMON,		PATH_DEV | PATH_OPT	},
 	{ _PATH_TTY,		PATH_DEV		},
 	{ _PATH_UNIX,		PATH_FILE | PATH_ROOT	},
 	{ _PATH_URANDOM,	PATH_DEV		},
 	{ _PATH_VIDEO,		PATH_DEV		},
 	{ _PATH_VIDEO0,		PATH_DEV		},
+	{ _PATH_WATCHDOG,	PATH_DEV | PATH_OPT	},
 
 	{ _PATH_DEV,		PATH_DIR		},
 	{ _PATH_DEV_PTS,	PATH_DIR		},
@@ -143,13 +145,22 @@ ATF_TC_BODY(paths, tc)
 
 			switch (errno) {
 
+			case ENODEV:
+				if ((paths[i].flags & PATH_OPT) == 0) {
+
+					atf_tc_fail("Required path %s does "
+					    "not exist", paths[i].path);
+				}
+				break;
+
 			case EPERM:	/* FALLTHROUGH */
 			case EACCES:	/* FALLTHROUGH */
 
 				if ((paths[i].flags & PATH_ROOT) == 0) {
 
-					atf_tc_fail("UID %u failed to open %s",
-					    (uint32_t)uid, paths[i].path);
+					atf_tc_fail("UID %u failed to open %s, "
+					    "error %d", (uint32_t)uid,
+					     paths[i].path, error);
 				}
 
 			case EBUSY:	/* FALLTHROUGH */

Reply via email to