Return-Path: X-Original-To: apmail-hadoop-common-dev-archive@www.apache.org Delivered-To: apmail-hadoop-common-dev-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id DB139E3AB for ; Fri, 14 Dec 2012 18:57:36 +0000 (UTC) Received: (qmail 22728 invoked by uid 500); 14 Dec 2012 18:57:35 -0000 Delivered-To: apmail-hadoop-common-dev-archive@hadoop.apache.org Received: (qmail 22604 invoked by uid 500); 14 Dec 2012 18:57:35 -0000 Mailing-List: contact common-dev-help@hadoop.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: common-dev@hadoop.apache.org Delivered-To: mailing list common-dev@hadoop.apache.org Received: (qmail 22596 invoked by uid 99); 14 Dec 2012 18:57:35 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 14 Dec 2012 18:57:35 +0000 X-ASF-Spam-Status: No, hits=-0.7 required=5.0 tests=RCVD_IN_DNSWL_LOW,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: domain of rarecactus@gmail.com designates 74.125.83.48 as permitted sender) Received: from [74.125.83.48] (HELO mail-ee0-f48.google.com) (74.125.83.48) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 14 Dec 2012 18:57:28 +0000 Received: by mail-ee0-f48.google.com with SMTP id b57so2198319eek.35 for ; Fri, 14 Dec 2012 10:57:08 -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 :x-google-sender-auth:message-id:subject:from:to:content-type; bh=s2Zb/sOWEvgPyMoVWfAERZhAhoL/46+bDHTDsKLD13U=; b=w3sJ6vdV/aq+mE80GD/iXLBZ4bKCn95BQ18o/SVhHA9mxZUhUitZK0qxuKNnNlp2WW HRJv/L/RwMgXebBycBYUmug78Hf/t+LRNtu8q12y9cnRu0HChcyL0uxghk/oa1rDM4lO rNJEbx5oOvbkPSbZAHWgFDqDkLufIL/BCooBCtccmqHsQeZT5QOCBY7zUVsgIRBU7xmM e+528JYTMqZAHA9K6jHB+zPMBgy08z/6pZk5krc+3arPdsJxAZdV49H/hYDkV+DzHL/0 w49562QTWimvk9V064OQnnqcPVVWA2TUBKiB2P8aykGy3Zp+G0GqBXQfZi7idsYUpZLM Ws7Q== MIME-Version: 1.0 Received: by 10.14.221.65 with SMTP id q41mr17153121eep.30.1355511428157; Fri, 14 Dec 2012 10:57:08 -0800 (PST) Sender: rarecactus@gmail.com Received: by 10.14.203.195 with HTTP; Fri, 14 Dec 2012 10:57:08 -0800 (PST) In-Reply-To: References: Date: Fri, 14 Dec 2012 10:57:08 -0800 X-Google-Sender-Auth: zYSCKpIAnBOGEbgky9Bigt7cpvo Message-ID: Subject: Re: making a hadoop-common test run if a property is set From: Colin McCabe To: common-dev@hadoop.apache.org Content-Type: text/plain; charset=ISO-8859-1 X-Virus-Checked: Checked by ClamAV on apache.org One approach we've taken in the past is making the junit test skip itself when some precondition is not true. Then, we often create a property which people can use to cause the skipped tests to become a hard error. For example, all the tests that rely on libhadoop start with these lines: > @Test > public void myTest() { > Assume.assumeTrue(NativeCodeLoader.isNativeCodeLoaded()); > ... > } This causes them to be silently skipped when libhadoop.so is not available or loaded (perhaps because it hasn't been built.) However, if you want to cause this to be a hard error, you simply run > mvn test -Drequire.test.libhadoop See TestHdfsNativeCodeLoader.java to see how this is implemented. The main idea is that your Jenkins build slaves use all the -Drequire lines, but people running tests locally are not inconvenienced by the need to build libhadoop.so in every case. This is especially good because libhadoop.so isn't known to build on certain platforms like AIX, etc. It seems to be a good tradeoff so far. I imagine that s3 could do something similar. cheers, Colin On Fri, Dec 14, 2012 at 9:56 AM, Steve Loughran wrote: > The swiftfs tests need only to run if there's a target filesystem; copying > the s3/s3n tests, something like > > > test.fs.swift.name > swift://your-object-store-herel/ > > > How does one actually go about making junit tests optional in mvn-land? > Should the probe/skip logic be in the code -which can make people think the > test passed when it didn't actually run? Or can I turn it on/off in maven? > > -steve