mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Helen Koike <helen.koike@collabora.com>
To: Sergi Blanch Torne <sergi.blanch.torne@collabora.com>,
	dri-devel@lists.freedesktop.org
Cc: airlied@gmail.com, daniel@ffwll.ch, linux-kernel@vger.kernel.org,
	robdclark@gmail.com, daniel@fooishbar.org,
	vignesh.raman@collabora.com, jani.nikula@linux.intel.com,
	mripard@kernel.org, michel.daenzer@mailbox.org,
	quic_abhinavk@quicinc.com, quic_jesszhan@quicinc.com,
	david.heidelberg@collabora.com, guilherme.gallo@collabora.com
Subject: Re: [RFC PATCH] drm/ci: add helper script update-xfails.py
Date: Wed, 27 Sep 2023 19:28:39 -0300	[thread overview]
Message-ID: <785cbfee-f4d3-3d53-a3e6-2f9af8fa05fb@collabora.com> (raw)
In-Reply-To: <8f946d0a5632d580b593cf731091126d59feb77f.camel@collabora.com>

Hi Sergi,

Thanks for your comments.

On 27/09/2023 05:58, Sergi Blanch Torne wrote:
> Hi Helen,
> 
> On Mon, 2023-09-25 at 16:55 -0300, Helen Koike wrote:
>> Hello,
> 
>> This script is being very handy for me, so I suppose it could be
>> handy
>> to others, since I'm publishing it in the xfails folder.
> 
>> Let me know your thoughts.
> 
> I have two suggestions and one comment. Before that, I would like to
> highlight the importance of tools like that to help with repetitive
> tedious work, it is great to have this script.
> 
>> +def get_xfails_file_path(canonical_name, suffix):
>> +    name = canonical_name.replace(":", "-")
>> +    script_dir = os.path.dirname(os.path.abspath(__file__))
>> +    return os.path.join(script_dir, f"{name}-{suffix}.txt")
> 
> I appreciate the correspondence between job name and expectation file
> names.
> 
>> +def get_unit_test_name_and_results(unit_test):
>> +    if "Artifact results/failures.csv not found" in unit_test:
>> +        return None, None
>> +    unit_test_name, unit_test_result = unit_test.strip().split(",")
>> +    return unit_test_name, unit_test_result
> 
> Suggestion: it is not managing empty lines or comments. By now, there
> aren't, but they could be found.

Indeed.

> 
>> +def main(namespace, project, pipeline_id):
>> +    xfails = (
>> +        Collate(namespace=namespace, project=project)
>> +        .from_pipeline(pipeline_id)
>> +        .get_artifact("results/failures.csv")
>> +    )
>> +
>> +    split_unit_test_from_collate(xfails)
>> +
>> +    for job_name in xfails.keys():
>> +        canonical_name = get_canonical_name(job_name)
>> +        fails_txt_path = get_xfails_file_path(canonical_name,
>> "fails")
>> +        flakes_txt_path = get_xfails_file_path(canonical_name,
>> "flakes")
>> +
>> +        fails_txt = read_file(fails_txt_path)
>> +        flakes_txt = read_file(flakes_txt_path)
>> +
>> +        for job_id in xfails[job_name].keys():
>> +            for unit_test in xfails[job_name][job_id]:
>> +                unit_test_name, unit_test_result =
>> get_unit_test_name_and_results(unit_test)
>> +
>> +                if not unit_test_name:
>> +                    continue
>> +
>> +                if is_test_present_on_file(flakes_txt,
>> unit_test_name):
>> +                    remove_unit_test_if_present(flakes_txt,
>> unit_test_name, flakes_txt_path)
>> +                    print("WARNING: unit test is on flakes list but
>> a job failed due to it, "
>> +                          "is your tree up to date?",
>> +                          unit_test_name, "DROPPED FROM",
>> os.path.basename(flakes_txt_path))
>> +
>> +                if unit_test_result == "UnexpectedPass":
>> +                    remove_unit_test_if_present(fails_txt,
>> unit_test_name, fails_txt_path)
>> +                    # flake result
>> +                    if not
>> is_unit_test_present_in_other_jobs(unit_test, xfails[job_name]):
>> +                        add_unit_test_if_not_present(flakes_txt,
>> unit_test_name, flakes_txt_path)
>> +                    continue
> 
> Suggestion: Sometimes tests fails with different status ("Fail" to
> "Crash" for example) and the expectations should be updated with the
> newer status.

The status is only present in the fails and not in the flakes list, so I 
update it with add_unit_test_or_update_result_to_fails_if_present() 
function below, make sense?

Regards,
Helen

> 
>> +
>> +                # flake result
>> +                if not is_unit_test_present_in_other_jobs(unit_test,
>> xfails[job_name]):
>> +                    add_unit_test_if_not_present(flakes_txt,
>> unit_test_name, flakes_txt_path)
>> +                    continue
>> +
>> +                # consistent result
>> +
>> add_unit_test_or_update_result_to_fails_if_present(fails_txt,
>> unit_test,
>> +
>> fails_txt_path)
>> +
>> +        save_file(fails_txt, fails_txt_path)
>> +        save_file(flakes_txt, flakes_txt_path)
> 
> Regards,
> 

  reply	other threads:[~2023-09-27 22:28 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-09-25 19:55 Helen Koike
2023-09-27  8:58 ` Sergi Blanch Torne
2023-09-27 22:28   ` Helen Koike [this message]
2023-09-28  7:10     ` Sergi Blanch Torne

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=785cbfee-f4d3-3d53-a3e6-2f9af8fa05fb@collabora.com \
    --to=helen.koike@collabora.com \
    --cc=airlied@gmail.com \
    --cc=daniel@ffwll.ch \
    --cc=daniel@fooishbar.org \
    --cc=david.heidelberg@collabora.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=guilherme.gallo@collabora.com \
    --cc=jani.nikula@linux.intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=michel.daenzer@mailbox.org \
    --cc=mripard@kernel.org \
    --cc=quic_abhinavk@quicinc.com \
    --cc=quic_jesszhan@quicinc.com \
    --cc=robdclark@gmail.com \
    --cc=sergi.blanch.torne@collabora.com \
    --cc=vignesh.raman@collabora.com \
    /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

all inboxes | Powered by JetHome®