svn commit: r319385 - in stable/10: etc/mtree usr.bin/getconf usr.bin/getconf/tests

Ngie Cooper ngie at FreeBSD.org
Thu Jun 1 06:41:29 UTC 2017


Author: ngie
Date: Thu Jun  1 06:41:27 2017
New Revision: 319385
URL: https://svnweb.freebsd.org/changeset/base/319385

Log:
  MFC r318436:
  
  usr.bin/getconf: add some initial tests
  
  Items tested via this commit are:
  - Some basic POSIX constants.
  - Some valid programming environments with -v.
  - Some invalid programming environments via -v.
  
  NOTE: this test makes assumptions about ILP32/LP32 vs LP64 that are
  currently not true on all architectures to avoid hardcoding some
  architectures in the tests. I'm working on improving getconf(1) to be
  more sane about handling ILP32/LP32 vs LP64. Future commits are coming
  soon to address this.
  
  Tested with:	amd64, i386

Added:
  stable/10/usr.bin/getconf/tests/
     - copied from r318436, head/usr.bin/getconf/tests/
Modified:
  stable/10/etc/mtree/BSD.tests.dist
  stable/10/usr.bin/getconf/Makefile
  stable/10/usr.bin/getconf/getconf.h
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/etc/mtree/BSD.tests.dist
==============================================================================
--- stable/10/etc/mtree/BSD.tests.dist	Thu Jun  1 06:41:24 2017	(r319384)
+++ stable/10/etc/mtree/BSD.tests.dist	Thu Jun  1 06:41:27 2017	(r319385)
@@ -588,6 +588,8 @@
         ..
         file2c
         ..
+        getconf
+        ..
         grep
         ..
         gzip

Modified: stable/10/usr.bin/getconf/Makefile
==============================================================================
--- stable/10/usr.bin/getconf/Makefile	Thu Jun  1 06:41:24 2017	(r319384)
+++ stable/10/usr.bin/getconf/Makefile	Thu Jun  1 06:41:27 2017	(r319385)
@@ -1,5 +1,7 @@
 # $FreeBSD$
 
+.include <bsd.own.mk>
+
 PROG=	getconf
 
 SRCS=	confstr.c getconf.c limits.c pathconf.c progenv.c sysconf.c
@@ -34,5 +36,9 @@ conflicting.names:	confstr.names limits.names sysconf.
 
 unique.names:		conflicting.names
 	LC_ALL=C sort -u ${.ALLSRC} >${.TARGET}
+
+.if ${MK_TESTS} != "no"
+SUBDIR+=	tests
+.endif
 
 .include <bsd.prog.mk>

Modified: stable/10/usr.bin/getconf/getconf.h
==============================================================================
--- stable/10/usr.bin/getconf/getconf.h	Thu Jun  1 06:41:24 2017	(r319384)
+++ stable/10/usr.bin/getconf/getconf.h	Thu Jun  1 06:41:27 2017	(r319385)
@@ -36,8 +36,15 @@ typedef long long intmax_t;
 #include <inttypes.h>
 #endif
 
+typedef enum {
+	PROG_ENV_VALID_NO_ALT_PATH = -1,
+	PROG_ENV_INVALID = 0,
+	PROG_ENV_VALID_HAS_ALT_PATH = 1,
+	PROG_ENV_UNKNOWN = 2,
+} prog_env_validity;
+
 int	find_confstr(const char *name, int *key);
 int	find_limit(const char *name, intmax_t *value);
 int	find_pathconf(const char *name, int *key);
-int	find_progenv(const char *name, const char **alt_path);
+prog_env_validity	find_progenv(const char *name, const char **alt_path);
 int	find_sysconf(const char *name, int *key);


More information about the svn-src-all mailing list