From owner-svn-src-stable-11@freebsd.org Thu Jun 1 06:41:26 2017 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id B562BB7D240; Thu, 1 Jun 2017 06:41:26 +0000 (UTC) (envelope-from ngie@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 5C5C7666E5; Thu, 1 Jun 2017 06:41:26 +0000 (UTC) (envelope-from ngie@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v516fPjW081036; Thu, 1 Jun 2017 06:41:25 GMT (envelope-from ngie@FreeBSD.org) Received: (from ngie@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v516fPkk081032; Thu, 1 Jun 2017 06:41:25 GMT (envelope-from ngie@FreeBSD.org) Message-Id: <201706010641.v516fPkk081032@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ngie set sender to ngie@FreeBSD.org using -f From: Ngie Cooper Date: Thu, 1 Jun 2017 06:41:25 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r319384 - in stable/11: etc/mtree usr.bin/getconf usr.bin/getconf/tests X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 01 Jun 2017 06:41:26 -0000 Author: ngie Date: Thu Jun 1 06:41:24 2017 New Revision: 319384 URL: https://svnweb.freebsd.org/changeset/base/319384 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/11/usr.bin/getconf/tests/ - copied from r318436, head/usr.bin/getconf/tests/ Modified: stable/11/etc/mtree/BSD.tests.dist stable/11/usr.bin/getconf/Makefile stable/11/usr.bin/getconf/getconf.h Directory Properties: stable/11/ (props changed) Modified: stable/11/etc/mtree/BSD.tests.dist ============================================================================== --- stable/11/etc/mtree/BSD.tests.dist Thu Jun 1 06:39:57 2017 (r319383) +++ stable/11/etc/mtree/BSD.tests.dist Thu Jun 1 06:41:24 2017 (r319384) @@ -608,6 +608,8 @@ .. file2c .. + getconf + .. grep .. gzip Modified: stable/11/usr.bin/getconf/Makefile ============================================================================== --- stable/11/usr.bin/getconf/Makefile Thu Jun 1 06:39:57 2017 (r319383) +++ stable/11/usr.bin/getconf/Makefile Thu Jun 1 06:41:24 2017 (r319384) @@ -1,5 +1,7 @@ # $FreeBSD$ +.include + 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 Modified: stable/11/usr.bin/getconf/getconf.h ============================================================================== --- stable/11/usr.bin/getconf/getconf.h Thu Jun 1 06:39:57 2017 (r319383) +++ stable/11/usr.bin/getconf/getconf.h Thu Jun 1 06:41:24 2017 (r319384) @@ -36,8 +36,15 @@ typedef long long intmax_t; #include #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);