[Buildroot] [git commit] support/testing: add git runtime test

Arnout Vandecappelle arnout at rnout.be
Wed Apr 16 21:10:39 UTC 2025


On 25/03/2025 19:34, Julien Olivain wrote:
> commit: https://git.buildroot.net/buildroot/commit/?id=24efb23a1074b920fe32763ae455a4694410eb6e
> branch: https://git.buildroot.net/buildroot/commit/?id=refs/heads/master
>
> Signed-off-by: Julien Olivain <ju.o at free.fr>

  Applied to 2025.02.x, 2024.11.x and 2024.02.x, thanks.

  Regards,
  Arnout

> ---
>   DEVELOPERS                                |  1 +
>   support/testing/tests/package/test_git.py | 57 +++++++++++++++++++++++++++++++
>   2 files changed, 58 insertions(+)
>
> diff --git a/DEVELOPERS b/DEVELOPERS
> index c080608bcf..44f7684c97 100644
> --- a/DEVELOPERS
> +++ b/DEVELOPERS
> @@ -1900,6 +1900,7 @@ F:	support/testing/tests/package/test_fwts.py
>   F:	support/testing/tests/package/test_gawk.py
>   F:	support/testing/tests/package/test_ghostscript.py
>   F:	support/testing/tests/package/test_ghostscript/
> +F:	support/testing/tests/package/test_git.py
>   F:	support/testing/tests/package/test_glslsandbox_player.py
>   F:	support/testing/tests/package/test_glslsandbox_player/
>   F:	support/testing/tests/package/test_gnupg2.py
> diff --git a/support/testing/tests/package/test_git.py b/support/testing/tests/package/test_git.py
> new file mode 100644
> index 0000000000..878c4c8092
> --- /dev/null
> +++ b/support/testing/tests/package/test_git.py
> @@ -0,0 +1,57 @@
> +import os
> +
> +import infra.basetest
> +
> +
> +class TestGit(infra.basetest.BRTest):
> +    config = infra.basetest.BASIC_TOOLCHAIN_CONFIG + \
> +        """
> +        BR2_PACKAGE_GIT=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 the program can execute.
> +        self.assertRunOk("git --version")
> +
> +        # Initialize some git global configuration.
> +        git_cfg = [
> +            ("user.name", "Build Root"),
> +            ("user.email", "build.root at localhost.localdomain"),
> +            ("color.ui", "false"),
> +            ("init.defaultBranch", "master"),
> +            ("core.pager", "")
> +        ]
> +        for cfg_name, cfg_value in git_cfg:
> +            cmd = f"git config --global {cfg_name} '{cfg_value}'"
> +            self.assertRunOk(cmd)
> +
> +        # Run a sequence of few git commands.
> +        commands = [
> +            "mkdir workdir",
> +            "cd workdir",
> +            "git init",
> +            "echo 'Hello World' > file.txt",
> +            "git add file.txt",
> +            "git commit -as -m 'Initial commit'",
> +            "git checkout -b my_branch",
> +            "sed -i 's/World/Buildroot/g' file.txt",
> +            "git status",
> +            "git commit -as -m 'Replace World by Buildroot'",
> +            "git format-patch -M -n -s -o patches master",
> +            "ls -al patches/*.patch",
> +            "git checkout -b another_branch master",
> +            "git am patches/*.patch",
> +            "git diff --exit-code my_branch another_branch",
> +            "git tag -a -m 'Tagged v1.0' v1.0",
> +            "git log"
> +        ]
> +        for cmd in commands:
> +            self.assertRunOk(cmd)
> _______________________________________________
> buildroot mailing list
> buildroot at buildroot.org
> https://lists.buildroot.org/mailman/listinfo/buildroot


More information about the buildroot mailing list