From owner-freebsd-testing@FreeBSD.ORG Tue Feb 25 16:47:55 2014 Return-Path: Delivered-To: freebsd-testing@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 3C6FEABE for ; Tue, 25 Feb 2014 16:47:55 +0000 (UTC) Received: from mail-wi0-x22c.google.com (mail-wi0-x22c.google.com [IPv6:2a00:1450:400c:c05::22c]) (using TLSv1 with cipher ECDHE-RSA-RC4-SHA (128/128 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id CB0421D59 for ; Tue, 25 Feb 2014 16:47:54 +0000 (UTC) Received: by mail-wi0-f172.google.com with SMTP id e4so4761339wiv.11 for ; Tue, 25 Feb 2014 08:47:53 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:sender:in-reply-to:references:date:message-id:subject :from:to:cc:content-type; bh=akVBzOMOXAlFxsYGziAqYJoXM/fs6pRkDH/tIGFTgbA=; b=aDDYjcDIVHI7nH8rC6qb8FgBfmRNG5zf8CvAoH6Ip9EBd2Qzcn7wWd++1Me8/0TZsQ nZdgGGgijoO+MvlnLyl4BoQXTt0PLKpkMGJmpPEv+Vu8QvxOqfuG3lpUmot+xHXYweq7 uMb/iebAhd33Pf3aP/j6TVUw0pYqKX8igrodpLwWYxpHq+sibmrEPADaqXtPLJ9ApaYD /5sDULAvzM0JMyv7HEq6QfJz6IYATwcUv6yPP/UoZQjhuMrcsEX2gwa+U3G2tyt962kN y98c9yYm7Tt5JqEdc8z0OA5fcU7t0QvOGonbvZT1De29xC9j0SY3om23eXt+L3mp688+ AjFw== MIME-Version: 1.0 X-Received: by 10.180.97.37 with SMTP id dx5mr3898185wib.53.1393346873005; Tue, 25 Feb 2014 08:47:53 -0800 (PST) Sender: asomers@gmail.com Received: by 10.194.168.197 with HTTP; Tue, 25 Feb 2014 08:47:52 -0800 (PST) In-Reply-To: <20140225161129.GA59741@x2.osted.lan> References: <20140225161129.GA59741@x2.osted.lan> Date: Tue, 25 Feb 2014 09:47:52 -0700 X-Google-Sender-Auth: CpCYweCU5BKrkAoRT3fdnS8R6Nc Message-ID: Subject: Re: My first ATF test From: Alan Somers To: Peter Holm Content-Type: text/plain; charset=ISO-8859-1 Cc: "freebsd-testing@freebsd.org" X-BeenThere: freebsd-testing@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: Testing on FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 25 Feb 2014 16:47:55 -0000 On Tue, Feb 25, 2014 at 9:11 AM, Peter Holm wrote: > In order to understand how ATF works I wrote a small test so I had > something to work with: > http://people.freebsd.org/~pho/kern_descrip_test.diff > Did I get it right? ATF-wise, it looks good. However, it's a bad idea to use random numbers in test code, except in stress tests. Random numbers result in irreproducible tests. How about replacing the body of dup2_r234131 with something like this? int fd1, fd2, ret; fd1 = open("/etc/passwd", O_RDONLY); fd2 = INT_MAX; ret = dup2(fd1, fd2); ATF_CHECK_EQ(-1, ret); ATF_CHECK_EQ(EBADF, errno); On a side note, perhaps WARNS should be set in atf.test.mk, so we won't have to set it in every other Makefile. -Alan