Bug 239762 - test-webkitperl outputs errors about uninitialized $platform variable
Summary: test-webkitperl outputs errors about uninitialized $platform variable
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: Tools / Tests (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Kimmo Kinnunen
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2022-04-26 01:28 PDT by Kimmo Kinnunen
Modified: 2022-04-28 00:41 PDT (History)
4 users (show)

See Also:


Attachments
Patch (17.86 KB, patch)
2022-04-26 01:34 PDT, Kimmo Kinnunen
no flags Details | Formatted Diff | Diff
Patch (17.41 KB, patch)
2022-04-27 00:47 PDT, Kimmo Kinnunen
no flags Details | Formatted Diff | Diff
Patch (17.46 KB, patch)
2022-04-27 01:11 PDT, Kimmo Kinnunen
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Kimmo Kinnunen 2022-04-26 01:28:52 PDT
test-webkitperl outputs errors about unused $platform variable
Comment 1 Kimmo Kinnunen 2022-04-26 01:34:14 PDT
Created attachment 458340 [details]
Patch
Comment 2 Alexey Proskuryakov 2022-04-26 09:23:27 PDT
Comment on attachment 458340 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=458340&action=review

> Tools/ChangeLog:9
> +        Extract the tested code to a module to be able to imported in well-defined
> +        manner.

Do we have to do all of this to silence one warning?

Splitting simple Perl scripts into multiple files creates significant barriers to development. Folks have had a lot of trouble refactoring Perl code because of webkitdirs.pm already. Factoring out well isolated and abstracted pieces of functionality is one thing, but pulling a function that's intrinsically inseparable from the main script seems wrong to me.
Comment 3 Kimmo Kinnunen 2022-04-26 10:48:46 PDT
This already got r+ from the bug linked to in see also.

The other option is to make the perl script a module too, but I don't know perl enough to understand how to import such a module.
eg. how to do the logical equivalent of pseudo-code:

   use filter-build-webkit qw(shouldIgnoreLine $platform);

It's not so much a warning as quite bogus way of running the script via eval and not having half the variables defined.
Comment 4 Kimmo Kinnunen 2022-04-26 10:49:38 PDT
https://www.perlmonks.org/?node_id=621378 addreresses some part of "executable as a module"
Comment 5 Kimmo Kinnunen 2022-04-26 11:44:18 PDT
In essence I agree, but also running code in a bogus way is not very good too.

Investigate how to export stuff from perl script as a module?
Move all code to the module?
Write all code in python and be done with it?
Comment 7 Kimmo Kinnunen 2022-04-27 00:47:58 PDT
Created attachment 458428 [details]
Patch
Comment 8 Kimmo Kinnunen 2022-04-27 01:11:14 PDT
Created attachment 458432 [details]
Patch
Comment 9 Alexey Proskuryakov 2022-04-27 08:39:45 PDT
Comment on attachment 458432 [details]
Patch

I'm not enough of a Perl expert to understand every technical detail here. But this is structured elegantly, and clearly is a good improvement.
Comment 10 EWS 2022-04-28 00:40:12 PDT
Committed r293568 (250082@main): <https://commits.webkit.org/250082@main>

All reviewed patches have been landed. Closing bug and clearing flags on attachment 458432 [details].
Comment 11 Radar WebKit Bug Importer 2022-04-28 00:41:13 PDT
<rdar://problem/92445079>