[Linux-kernel-mentees] POC script to apply patches into a test-branch and run clang-format

Lukas Bulwahn lukas.bulwahn at gmail.com
Tue Dec 15 06:46:45 UTC 2020


On Fri, Dec 11, 2020 at 10:16 AM Aditya <yashsri421 at gmail.com> wrote:
>
> On 11/12/20 11:57 am, Lukas Bulwahn wrote:
> > On Fri, Dec 11, 2020 at 7:24 AM Dwaipayan Ray <dwaipayanray1 at gmail.com> wrote:
> >>
> >>>
> >>> Aditya, Dwaipayan, can you set up a git repository that you use
> >>> together to work on this script?
> >>>
> >>> And provide a short description of how to use the script with an
> >>> example in that repository?
> >>>
> >>> Then, I am happy to try it out... and provide you more feedback.
> >>>
> >>> Lukas
> >>
> >> Hi Lukas,
> >> Sure enough, if Aditya doesn't mind, I will put up a repo for the same.
> >>
> >
> > Dwaipayan, just set up a repository with your latest state that you
> > are currently happy with, then Aditya can fork that and put changes on
> > top as he might see fit and open a pull request, so you integrate them
> > back.
> >
>
> Hi
> I have added my changes in the repo and also provided steps to run the
> script in readme.
>
> Repo Link: https://github.com/raydwaipayan/apply-patch
>
> You can use this patch for testing. It applies on next-20201204.
>

Okay, I downloaded and tried it:

perl ./scripts/applypatch.pl --clang-format test.patch
--branch=test-clang-format-bfq-cgroup

but it failed:

git checkout test-clang-format-bfq-cgroup
Already on 'test-clang-format-bfq-cgroup'
git am $patchtest.patch
fatal: could not open '.patch' for reading: No such file or directory
Clang formatted patchfile generated at:
test.patch.EXPERIMENTAL-clang_format-fixes
git checkout test-clang-format-bfq-cgroup
Already on 'test-clang-format-bfq-cgroup'

How about setting up a minimal travis.ci check that runs this command
on a small git repository with one file and one patch on top for
testing purposes?

The script does not have error handling yet, so the next steps are
just executed blindly even if the one before failed and is really
required for the next one to do the right thing.

I generally like the script, let us work a bit on tuning it for proper
error handling, add some basic tests and then discuss it with Miguel.

Lukas

> From c631c1b9c4c7e3cdbf0e41b21b8fa1d34ba20aef Mon Sep 17 00:00:00 2001
> From: Aditya Srivastava <yashsri421 at gmail.com>
> Date: Fri, 11 Dec 2020 14:19:52 +0530
> Subject: [PATCH] patch for testing
>
> This patch has been created for testing clang-format on c-file.
> ---
>  block/bfq-cgroup.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/block/bfq-cgroup.c b/block/bfq-cgroup.c
> index b791e2041e49..8409ee064204 100644
> --- a/block/bfq-cgroup.c
> +++ b/block/bfq-cgroup.c
> @@ -184,7 +184,8 @@ void bfqg_stats_set_start_empty_time(struct
> bfq_group *bfqg)
>                 return;
>
>         stats->start_empty_time = ktime_get_ns();
> -       bfqg_stats_mark_empty(stats);
> +
> +bfqg_stats_mark_empty(stats);
>  }
>
>  void bfqg_stats_update_idle_time(struct bfq_group *bfqg)
> --
> 2.17.1
>
>
> Thanks
> Aditya
>


More information about the Linux-kernel-mentees mailing list