Buildroot Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: "Yann E. MORIN" <yann.morin.1998@free.fr>
To: buildroot@buildroot.org
Subject: Re: [Buildroot] [PATCH] support/testing: new runtime test for bash
Date: Mon, 8 May 2023 23:53:43 +0200	[thread overview]
Message-ID: <20230508215343.GX252090@scaer> (raw)
In-Reply-To: <20230424215106.1202752-1-yann.morin.1998@free.fr>

All,

On 2023-04-24 23:51 +0200, Yann E. MORIN spake thusly:
> Commit 2dff6e93ca2a (package/readline: add upstream patch to fix crash
> with invalid locale specification) fixed a regression in readline 8.2
> [0], that could have been caught with a runtime test. readline is a
> library, so we need an executable that exercises readline.
> 
> Since readline and bash are developped in tandem [1], it is only logical
> to use bash to test readline.
> 
> Add a new runtime test for bash, that checks that we can indeed run an
> interactive shell, and that an non-existing locale does not cause the
> dreaded segfault. We do not use the default configuration, because it
> uses a uclibc toolchain, and we want to reproduce against a glibc one.
> 
> [0] https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1021109
> [1] https://tiswww.case.edu/php/chet/readline/rltop.html#Bugs
> 
> Signed-off-by: Yann E. MORIN <yann.morin.1998@free.fr>

Applied to master, thanks.

Regards,
Yann E. MORIN.

> ---
>  support/testing/tests/package/test_bash.py | 47 ++++++++++++++++++++++
>  1 file changed, 47 insertions(+)
>  create mode 100644 support/testing/tests/package/test_bash.py
> 
> diff --git a/support/testing/tests/package/test_bash.py b/support/testing/tests/package/test_bash.py
> new file mode 100644
> index 0000000000..f0ee8cadc1
> --- /dev/null
> +++ b/support/testing/tests/package/test_bash.py
> @@ -0,0 +1,47 @@
> +import os
> +
> +import infra.basetest
> +
> +
> +class TestBash(infra.basetest.BRTest):
> +    config = \
> +        """
> +        BR2_arm=y
> +        BR2_TOOLCHAIN_EXTERNAL=y
> +        BR2_TOOLCHAIN_EXTERNAL_BOOTLIN=y
> +        BR2_ENABLE_LOCALE_WHITELIST=""
> +        BR2_PACKAGE_BUSYBOX_SHOW_OTHERS=y
> +        BR2_PACKAGE_BASH=y
> +        BR2_TARGET_ROOTFS_CPIO=y
> +        # BR2_TARGET_ROOTFS_TAR is not set
> +        """
> +
> +    def test_run(self):
> +        cpio_file = os.path.join(self.builddir, "images", "rootfs.cpio")
> +        self.emulator.boot(arch="armv5",
> +                           kernel="builtin",
> +                           options=["-initrd", cpio_file])
> +        self.emulator.login()
> +
> +        # Check that we are indeed not (yet) running bash
> +        out, _ = self.emulator.run('echo "${BASH}"')
> +        self.assertEqual(out[0], "", "Already running bash instead of busybox' sh")
> +
> +        self.assertRunOk("bash -il")
> +        # Twist! The above command is still runing, it's just that
> +        # bash did display the prompt we expect. Check we are indeed
> +        # actually bash
> +        out, _ = self.emulator.run('echo "${BASH}"')
> +        self.assertEqual(out[0], "/bin/bash", "Not running bash")
> +        # Exit bash, back to busybox' shell
> +        self.emulator.run("exit 0")
> +
> +        # Check that we are indeed no longer running bash
> +        out, _ = self.emulator.run('echo "${BASH}"')
> +        self.assertEqual(out[0], "", "Still running bash instead of busybox' sh")
> +
> +        # Try to run with a non-available locale
> +        self.assertRunOk("LC_ALL=en_US bash -il")
> +        out, _ = self.emulator.run('echo "${BASH}"')
> +        self.assertEqual(out[0], "/bin/bash", "Not running bash")
> +        self.emulator.run("exit 0")
> -- 
> 2.25.1
> 
> _______________________________________________
> buildroot mailing list
> buildroot@buildroot.org
> https://lists.buildroot.org/mailman/listinfo/buildroot

-- 
.-----------------.--------------------.------------------.--------------------.
|  Yann E. MORIN  | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: |
| +33 662 376 056 | Software  Designer | \ / CAMPAIGN     |  ___               |
| +33 561 099 427 `------------.-------:  X  AGAINST      |  \e/  There is no  |
| http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL    |   v   conspiracy.  |
'------------------------------^-------^------------------^--------------------'
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

  reply	other threads:[~2023-05-08 21:53 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-04-24 21:51 [Buildroot] [PATCH] support/testing: new runtime test for bash Yann E. MORIN
2023-05-08 21:53 ` Yann E. MORIN [this message]
2023-06-09  9:09 ` Peter Korsgaard

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230508215343.GX252090@scaer \
    --to=yann.morin.1998@free.fr \
    --cc=buildroot@buildroot.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox