From owner-freebsd-testing@freebsd.org Tue Jan 17 23:11:19 2017 Return-Path: Delivered-To: freebsd-testing@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 A9308CB54CD for ; Tue, 17 Jan 2017 23:11:19 +0000 (UTC) (envelope-from asomers@gmail.com) Received: from mailman.ysv.freebsd.org (mailman.ysv.freebsd.org [IPv6:2001:1900:2254:206a::50:5]) by mx1.freebsd.org (Postfix) with ESMTP id 876F612B1 for ; Tue, 17 Jan 2017 23:11:19 +0000 (UTC) (envelope-from asomers@gmail.com) Received: by mailman.ysv.freebsd.org (Postfix) id 86CDECB54CC; Tue, 17 Jan 2017 23:11:19 +0000 (UTC) Delivered-To: testing@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 86748CB54CB for ; Tue, 17 Jan 2017 23:11:19 +0000 (UTC) (envelope-from asomers@gmail.com) Received: from mail-yw0-x232.google.com (mail-yw0-x232.google.com [IPv6:2607:f8b0:4002:c05::232]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4574A12AC for ; Tue, 17 Jan 2017 23:11:19 +0000 (UTC) (envelope-from asomers@gmail.com) Received: by mail-yw0-x232.google.com with SMTP id l75so101122698ywb.0 for ; Tue, 17 Jan 2017 15:11:19 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:sender:in-reply-to:references:from:date:message-id :subject:to:cc:content-transfer-encoding; bh=o724LwPDQwWu3RiwaPjofqiB+2x5N5rncarnW5Qp2G4=; b=CVKBePQNMD7g6/8pq7gzv8DyNwyjgCPlyopoE/CPu/ibPtLV6f8FvJCMW0K9NPztwO D1i/QeK1aFJvZIeshaCNkVZZlcOnWH14ak5yttB9EIjPdGqGhgQVIv1sFJE3HgmZeklX kbd/ciJm2KvWJ8V/yI8eOaozh1Md3BFPRCq25lKzEgHdZe+xW2isYhtgNLZMAH80utzG Iimn9ltYw91iN2QqkS+IKlWXom47VGjw6xVoyo1a1y4x019by55D6BHeLRQ6/j5pbVES G1NBdhPAtVa0sZUKo7GDITAlFThr54vG4VXsDxUughNIOYNKV+wRxdAkA3IgjTvYya36 DfhA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:sender:in-reply-to:references:from :date:message-id:subject:to:cc:content-transfer-encoding; bh=o724LwPDQwWu3RiwaPjofqiB+2x5N5rncarnW5Qp2G4=; b=MVBLK9h8t1HcZmjaUd9GEZwb0tbIA8wg1M+qmXcJ8DOR3D4BhXpRFSZYQmTOLVVQbQ BwZWDWhajnZ8KCQVz5skMxUV8pi756RIE8vu0M7gZKhZGYGVSCNGIysBtHyY1YdJohWk qRA+5piqaBrSe2dJ/5EqtlUVJmFVPinJglU6Cu8Pwus1Bqc8aBR+t8I0eQT7AM6+h3rs d+dKeBA3mzAe3elE6g9BJZp341zVJgPHjfaPjBo2rnkRpP2ojOzd/ogHrK/yrs5LMIdC Eas5dZ+8WA1MFR8GRub4wB2s/rrGZlw58rj34nSioNnBrhTJ0tdMTVn8xD/pCPitYz/r qO2Q== X-Gm-Message-State: AIkVDXKOt6pLtgwPW/XXf01+Fpjags+8Tc7MXRqxINOA+Bn9ySKIXz4KJsCc5czIUpe2T5XkymNWWHlNXgO7Qg== X-Received: by 10.129.76.74 with SMTP id z71mr81161ywa.307.1484694678487; Tue, 17 Jan 2017 15:11:18 -0800 (PST) MIME-Version: 1.0 Sender: asomers@gmail.com Received: by 10.129.38.133 with HTTP; Tue, 17 Jan 2017 15:11:18 -0800 (PST) In-Reply-To: <45D23581-C780-4C55-80CF-19A81813D672@gmail.com> References: <45D23581-C780-4C55-80CF-19A81813D672@gmail.com> From: Alan Somers Date: Tue, 17 Jan 2017 16:11:18 -0700 X-Google-Sender-Auth: BDDyML5cH_G7hSA-xqWoUnY9fmU Message-ID: Subject: Re: Looking at replacing ATF/Kyua (in a limited fashion) with Google Test/shunit2 To: "Ngie Cooper (yaneurabeya)" Cc: "freebsd-testing@freebsd.org" Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-BeenThere: freebsd-testing@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Testing on FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 17 Jan 2017 23:11:19 -0000 On Tue, Jan 17, 2017 at 4:01 PM, Ngie Cooper (yaneurabeya) wrote: > Hello all, > > I had an initial discussion with a handful of other test stakehol= ders and due to the number of caveats with ATF/Kyua and a variety of issues= in contributing back to the ATF/Kyua projects (time on maintainer=E2=80=99= s end, legal issues, technical issues, etc), I'm seriously considering repl= acing parts of ATF/Kyua with GoogleTest and shunit2. In particular, I want = to do these things [better]: > > - Detecting kernels features and modules. It is ad hoc and done o= n a per-testcase basis or in ad hoc common routines, which bloats tests unn= ecessarily. > - Detecting network interfaces. My employer desires that =E2=80= =94 we had something in use internally for detecting interfaces in tests, b= ut it was really messy; it would be nice if there was a clean, generalized = way to do this. > - Adding test fixtures to ease testing on a per-suite basis. For = example, setting up a service like bsnmpd for testing, running pjdfstest in= different configurations, (a temporarily setup UFS or ZFS filesystem, etc)= , collecting core files after tests for analysis purposes, etc. > Why these frameworks? > > GoogleTest: > - It is easier to extend upon. > - It is better documented than ATF/Kyua. > - It has more brevity in terms of writing testcases. > - It has features that I (and others who write tests) really want= . > - It is very similar to atf-c-api in core ways, in terms of macro= s. > - It has been accepted by multiple open source projects, like cla= ng/llvm, so including them in the FreeBSD Test Suite is more trivial after = the porting and integrating work. > - It is lightweight and a good candidate for inclusion in the bas= e system. > - Google and other groups are actively maintaining the project. > > shunit2: > - It has more brevity in terms of writing testcases. > - It has features that I (and others who write tests) really want= . > - It has syntactic sugar/API construction patterned after JUnit/X= Unit in other ways, so it=E2=80=99s familiar to testers who have written JU= nit/XUnit tests. > > Some concerns that have been brought up: > > Q: Why those frameworks? Have you considered other options? > A: Yes. A number of users have provided a matrix on Wikipedia and= I=E2=80=99ve looked at the list to try and determine : > a. C: https://en.wikipedia.org/wiki/List_of_unit_testing_= frameworks#C > b. C++: https://en.wikipedia.org/wiki/List_of_unit_testin= g_frameworks#C.2B.2B > c. sh: https://en.wikipedia.org/wiki/List_of_unit_testing= _frameworks#Shell > > Q: Google sometimes tinkers with projects, then abandons them lat= er. Is GoogleTest one of those projects? > A: As far as I can tell, no. This is widely used internally and d= eveloped on by their engineers. It is used external to Google by larger pro= jects like LLVM, so even if Google disappeared tomorrow I believe there=E2= =80=99s enough inertia and interest to keep things going here. > > Q: What about C test integration? > A: I=E2=80=99m trying to see how far I can get with GoogleTest in= tegration on the C API side, and if replacing atf-c-api is possible/doable = using C integration in libc++ (the syntax/API construction for atf-c-api an= d GoogleTest is similar in some regards). > > I=E2=80=99m really early on in the evaluation phase, so if anyone= has any input to provide with the direction I=E2=80=99m going, I would rea= lly love the input. Writing tests for bsnmp will be my first proof of conce= pt (I hope to use both GoogleTest and shunit2). > > Thank you, > -Ngie Before you get to far, you should ask yourself how much test case isolation you desire. Googletest is great, but I think it'll be hard to get the strong isolation between testcases provided by ATF. Perhaps it'll be find if GoogleTest tests provide no per-testcase isolation; most C/C++ programmers don't expect it anyway. But many of FreeBSD's atf-sh tests depend on it. Also, how are you planning to hook up GoogleTest and shunit2 to Kyua? -Alan