From patchwork Sat Jul 20 14:19:05 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sam Ravnborg X-Patchwork-Id: 2830824 Return-Path: X-Original-To: patchwork-linux-kbuild@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id EC8619F3EB for ; Sat, 20 Jul 2013 14:19:15 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 6110C2014C for ; Sat, 20 Jul 2013 14:19:14 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 8AECD2014B for ; Sat, 20 Jul 2013 14:19:10 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754092Ab3GTOTI (ORCPT ); Sat, 20 Jul 2013 10:19:08 -0400 Received: from smtp.snhosting.dk ([87.238.248.203]:27744 "EHLO smtp.domainteam.dk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754072Ab3GTOTI (ORCPT ); Sat, 20 Jul 2013 10:19:08 -0400 Received: from merkur.ravnborg.org (unknown [188.228.89.252]) by smtp.domainteam.dk (Postfix) with ESMTPA id 62924F1A9D for ; Sat, 20 Jul 2013 16:19:06 +0200 (CEST) Date: Sat, 20 Jul 2013 16:19:05 +0200 From: Sam Ravnborg To: linux-kbuild Subject: Kconfig test scripts Message-ID: <20130720141905.GA10229@merkur.ravnborg.org> MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.5.18 (2008-05-17) Sender: linux-kbuild-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kbuild@vger.kernel.org X-Spam-Status: No, score=-7.3 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Hi all. Often when I hack on Kconfig I have missed a set of test cases, that would allow me to verify that I did not introduce any regressions. I have not anything fancy in my mind and I spent a little time on the attached today. The following is obviously missing a lot a features - but this would allow me to get started adding simple test cases. The idea is that each test cases consist of a full Kconfig file and the resulting output. Anyone have something better than this, or maybe some brilliant ideas how to do this much better? Sam --- To unsubscribe from this list: send the line "unsubscribe linux-kbuild" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/scripts/kconfig/tests/run.sh b/scripts/kconfig/tests/run.sh new file mode 100644 index 0000000..fbd7613 --- /dev/null +++ b/scripts/kconfig/tests/run.sh @@ -0,0 +1,20 @@ +# set up test environment +mkdir -p include/config +mkdir -p include/generated + +tests="single_symbol.sh two_symbols.sh" + + +for t in ${tests}; do + + rm -f dot_config.expect + + sh $t + + if [ -f dot_config.expect ]; then + grep -v ^# .config > dot_config.actual + if ! cmp -s dot_config.actual dot_config.expect ; then + diff -u dot_config.expect dot_config.actual + fi + fi +done diff --git a/scripts/kconfig/tests/single_symbol.sh b/scripts/kconfig/tests/single_symbol.sh new file mode 100644 index 0000000..6459fcf --- /dev/null +++ b/scripts/kconfig/tests/single_symbol.sh @@ -0,0 +1,11 @@ +cat << EOF > Kconfig.test +config SINGLE + def_bool y + +EOF + +cat << EOF > dot_config.expect +CONFIG_SINGLE=y +EOF + +../conf Kconfig.test > /dev/null diff --git a/scripts/kconfig/tests/two_symbols.sh b/scripts/kconfig/tests/two_symbols.sh new file mode 100644 index 0000000..c31902d --- /dev/null +++ b/scripts/kconfig/tests/two_symbols.sh @@ -0,0 +1,14 @@ +cat << EOF > Kconfig.test +config FIRST + def_bool y + +config SECOND + def_bool y +EOF + +cat << EOF > dot_config.expect +CONFIG_FIRST=y +CONFIG_SECOND=y +EOF + +../conf Kconfig.test > /dev/null