Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 01137C001DC for ; Wed, 19 Jul 2023 23:51:39 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id A7FB186702; Thu, 20 Jul 2023 01:50:26 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.b="N8Rcvbbx"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 7D2D9867B9; Thu, 20 Jul 2023 01:50:12 +0200 (CEST) Received: from mail-io1-xd31.google.com (mail-io1-xd31.google.com [IPv6:2607:f8b0:4864:20::d31]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 81A5286797 for ; Thu, 20 Jul 2023 01:50:05 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=sjg@chromium.org Received: by mail-io1-xd31.google.com with SMTP id ca18e2360f4ac-76c64da0e46so9497939f.0 for ; Wed, 19 Jul 2023 16:50:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1689810604; x=1690415404; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=rKF+HcmJ7OUTibYMevqRJS6Dis2KBhhlzUprq3t9MA0=; b=N8RcvbbxIVLB/JEL3Bee0CL4VrxfmGr9ReZp2/fnsm+bSHGvAphBb/z1cMMSF04SaL myUZkVL5WjE5C0VoOei1TpSz/0G2mGAkPSOtUVhOAw7XAltgB9xOJ9U2X/cGJH8HvFoO q6a0MtAeMp8C02SMo0l8PFzbGenpN0VYdox1k= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1689810604; x=1690415404; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=rKF+HcmJ7OUTibYMevqRJS6Dis2KBhhlzUprq3t9MA0=; b=d0vb++zDbon3lSbj6yyEwazplACK5OTFVFzgCZom7g9UbnjUq8A7rEUO1vpWm2/OMH 2hLDROTlTS9NME7FJWyc9L4RdJyJ8ctSPa581N6XPoXtpNhT54WQUyangcsCVf1zvDCd mUxesIuHEvoUJPNlccD9yK/A4yjTwjDa7lcXkhewI8iQJQUOcqCsQmLpwOuMrGGGRWUR QWwXm/nrrvT7XBP0O+fDYJJiCUW1bBGA/FCNnHrlChJqIgZy1q6f6+cucgWaH9rUYbau JYIlaoEm5WRN301/XClUBtEeVxGC5y4evjyVkSWT6xSh9hpAFSRZf8td2U9JMOkTHY+R Li4Q== X-Gm-Message-State: ABy/qLaeL41PP1EcCYQ6u6a2DxMulamum2YOsf67HFqBaPAiCkw5muj4 DlEEyR1If3NtyQzclFdMex8sW3DNKufVKnT+GFU= X-Google-Smtp-Source: APBJJlGMxNXqvbRXKW+jdSj+ir4ioIWOrXZuGbE0Q6l3YmQWQYPCP11UTQbSgIVFnA6HfEoOLXAsgg== X-Received: by 2002:a6b:6603:0:b0:787:34d:f223 with SMTP id a3-20020a6b6603000000b00787034df223mr4016436ioc.11.1689810604073; Wed, 19 Jul 2023 16:50:04 -0700 (PDT) Received: from sjg1.lan (c-73-14-173-85.hsd1.co.comcast.net. [73.14.173.85]) by smtp.gmail.com with ESMTPSA id ed16-20020a056638291000b0042bb1779c18sm1551779jab.151.2023.07.19.16.50.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 19 Jul 2023 16:50:03 -0700 (PDT) From: Simon Glass To: U-Boot Mailing List Cc: Mike Frysinger , Simon Glass Subject: [PATCH v4 07/83] buildman: Add a test for Boards.scan_defconfigs() Date: Wed, 19 Jul 2023 17:48:15 -0600 Message-ID: <20230719234953.796101-8-sjg@chromium.org> X-Mailer: git-send-email 2.41.0.487.g6d72f3e995-goog In-Reply-To: <20230719234953.796101-1-sjg@chromium.org> References: <20230719234953.796101-1-sjg@chromium.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.103.8 at phobos.denx.de X-Virus-Status: Clean Add a test for this code. It requires some defconfig files and a test Kconfig to work with, so copy these into the temporary directory at the start. Signed-off-by: Simon Glass --- (no changes since v3) Changes in v3: - Add new patch with a test for Boards.scan_defconfigs() tools/buildman/func_test.py | 37 ++++++++++ tools/buildman/test/Kconfig | 72 ++++++++++++++++++++ tools/buildman/test/configs/board0_defconfig | 1 + tools/buildman/test/configs/board2_defconfig | 1 + 4 files changed, 111 insertions(+) create mode 100644 tools/buildman/test/Kconfig create mode 100644 tools/buildman/test/configs/board0_defconfig create mode 100644 tools/buildman/test/configs/board2_defconfig diff --git a/tools/buildman/func_test.py b/tools/buildman/func_test.py index aa7f69a54691..d423457ea24a 100644 --- a/tools/buildman/func_test.py +++ b/tools/buildman/func_test.py @@ -209,6 +209,12 @@ class TestFunctional(unittest.TestCase): # Set to True to report missing blobs self._missing = False + self._buildman_dir = os.path.dirname(os.path.realpath(sys.argv[0])) + self._test_dir = os.path.join(self._buildman_dir, 'test') + + # Set up some fake source files + shutil.copytree(self._test_dir, self._git_dir) + # Avoid sending any output and clear all terminal output terminal.set_print_test_mode() terminal.get_print_test_lines() @@ -779,3 +785,34 @@ Some images are invalid''' CONFIG_LOCALVERSION=y ''', cfg_data) self.assertIn('Not dropping LOCALVERSION_AUTO', stdout.getvalue()) + + def test_scan_defconfigs(self): + """Test scanning the defconfigs to obtain all the boards""" + src = self._git_dir + + # Scan the test directory which contains a Kconfig and some *_defconfig + # files + params = self._boards.scan_defconfigs(src, src) + + # We should get two boards + self.assertEquals(2, len(params)) + first = 0 if params[0]['target'] == 'board0' else 1 + board0 = params[first] + board2 = params[1 - first] + + self.assertEquals('arm', board0['arch']) + self.assertEquals('armv7', board0['cpu']) + self.assertEquals('-', board0['soc']) + self.assertEquals('Tester', board0['vendor']) + self.assertEquals('ARM Board 0', board0['board']) + self.assertEquals('config0', board0['config']) + self.assertEquals('board0', board0['target']) + + self.assertEquals('powerpc', board2['arch']) + self.assertEquals('ppc', board2['cpu']) + self.assertEquals('mpc85xx', board2['soc']) + self.assertEquals('Tester', board2['vendor']) + self.assertEquals('PowerPC board 1', board2['board']) + self.assertEquals('config2', board2['config']) + self.assertEquals('board2', board2['target']) + diff --git a/tools/buildman/test/Kconfig b/tools/buildman/test/Kconfig new file mode 100644 index 000000000000..a87660ce457d --- /dev/null +++ b/tools/buildman/test/Kconfig @@ -0,0 +1,72 @@ +# Board properties +config SYS_ARCH + string + +config SYS_CPU + string + +config SYS_SOC + string + +config SYS_VENDOR + string + +config SYS_BOARD + string + +config SYS_CONFIG_NAME + string + + +# Available targets +config TARGET_BOARD0 + bool "board 9" + +config TARGET_BOARD2 + bool "board 2" + + +# Settings for each board +if TARGET_BOARD0 + +config SYS_ARCH + default "arm" + +config SYS_CPU + default "armv7" + +#config SYS_SOC +# string + +config SYS_VENDOR + default "Tester" + +config SYS_BOARD + default "ARM Board 0" + +config SYS_CONFIG_NAME + default "config0" + +endif + +if TARGET_BOARD2 + +config SYS_ARCH + default "powerpc" + +config SYS_CPU + default "ppc" + +config SYS_SOC + default "mpc85xx" + +config SYS_VENDOR + default "Tester" + +config SYS_BOARD + default "PowerPC board 1" + +config SYS_CONFIG_NAME + default "config2" + +endif diff --git a/tools/buildman/test/configs/board0_defconfig b/tools/buildman/test/configs/board0_defconfig new file mode 100644 index 000000000000..50e562e53b2d --- /dev/null +++ b/tools/buildman/test/configs/board0_defconfig @@ -0,0 +1 @@ +CONFIG_TARGET_BOARD0=y diff --git a/tools/buildman/test/configs/board2_defconfig b/tools/buildman/test/configs/board2_defconfig new file mode 100644 index 000000000000..8b76c0ae1d0f --- /dev/null +++ b/tools/buildman/test/configs/board2_defconfig @@ -0,0 +1 @@ +CONFIG_TARGET_BOARD2=y -- 2.41.0.487.g6d72f3e995-goog