Add a needle check script, remove some unused needles
I call this...The @lruzicka Catcher!
It's a script that checks for needles that aren't actually used
anywhere. It also checks for cases where we have a needle JSON
file but no image, or an image file but no JSON file (and wipes
one case of the latter). It also adds a run of the script to tox
so we get it in CI.
You could make this script a lot more elaborate if you like, by
being fancier about parsing the test code and templates, but I
don't think it's really warranted, I think it just needs to be
'good enough'. It's not the end of the world if it misses the
odd thing or the whitelisting goes stale.
Quite a lot of the removed needles are remnants of different
approaches to app start/stop testing which weren't caught in the
initial PR review. The short-name partitioning ones are odd; they
were introduced in the commit that moved needles into subdirs,
but at least some of them don't actually appear to be moves. They
may have been non-tracked files Josef had lying around that got
into the commit by mistake, or they may just be old needles we
really used at some point but aren't using any more.
reclaim_space_second_partition was introduced as part of the
shrink test (along with reclaim_space_first_partition) but was
never actually used by that test - I guess, again, the test got
re-written during review but we forgot to remove the needle. We
rejigged user creation to use tab presses not a needle match a
while back, which made user_creation_password_input unnecessary.
The various cockpit_updates_* needles are I think remnants of
rewrites of the cockpit update tests that again were missed in
PR review, the tests as merged never used them.
Signed-off-by: Adam Williamson <awilliam@redhat.com>
2020-04-08 23:55:46 +00:00
|
|
|
#!/usr/bin/python3
|
|
|
|
|
2021-06-01 20:31:56 +00:00
|
|
|
# Copyright Red Hat
|
Add a needle check script, remove some unused needles
I call this...The @lruzicka Catcher!
It's a script that checks for needles that aren't actually used
anywhere. It also checks for cases where we have a needle JSON
file but no image, or an image file but no JSON file (and wipes
one case of the latter). It also adds a run of the script to tox
so we get it in CI.
You could make this script a lot more elaborate if you like, by
being fancier about parsing the test code and templates, but I
don't think it's really warranted, I think it just needs to be
'good enough'. It's not the end of the world if it misses the
odd thing or the whitelisting goes stale.
Quite a lot of the removed needles are remnants of different
approaches to app start/stop testing which weren't caught in the
initial PR review. The short-name partitioning ones are odd; they
were introduced in the commit that moved needles into subdirs,
but at least some of them don't actually appear to be moves. They
may have been non-tracked files Josef had lying around that got
into the commit by mistake, or they may just be old needles we
really used at some point but aren't using any more.
reclaim_space_second_partition was introduced as part of the
shrink test (along with reclaim_space_first_partition) but was
never actually used by that test - I guess, again, the test got
re-written during review but we forgot to remove the needle. We
rejigged user creation to use tab presses not a needle match a
while back, which made user_creation_password_input unnecessary.
The various cockpit_updates_* needles are I think remnants of
rewrites of the cockpit update tests that again were missed in
PR review, the tests as merged never used them.
Signed-off-by: Adam Williamson <awilliam@redhat.com>
2020-04-08 23:55:46 +00:00
|
|
|
#
|
|
|
|
# This file is part of os-autoinst-distri-fedora.
|
|
|
|
#
|
|
|
|
# os-autoinst-distri-fedora is free software; you can redistribute it
|
|
|
|
# and/or modify it under the terms of the GNU General Public License
|
|
|
|
# as published by the Free Software Foundation, either version 2 of
|
|
|
|
# the License, or (at your option) any later version.
|
|
|
|
#
|
|
|
|
# This program is distributed in the hope that it will be useful,
|
|
|
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
# GNU General Public License for more details.
|
|
|
|
#
|
|
|
|
# You should have received a copy of the GNU General Public License
|
|
|
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
#
|
|
|
|
# Author: Adam Williamson <awilliam@redhat.com>
|
|
|
|
|
|
|
|
"""This is a check script which checks for unused needles. If none of
|
|
|
|
the tags a needle declares is referenced in the tests, it is
|
|
|
|
considered unused.
|
|
|
|
"""
|
|
|
|
|
|
|
|
import glob
|
|
|
|
import json
|
|
|
|
import os
|
|
|
|
import re
|
|
|
|
import sys
|
|
|
|
|
|
|
|
NEEDLEPATH = os.path.join(os.path.dirname(os.path.realpath(__file__)), "needles")
|
|
|
|
TESTSPATH = os.path.join(os.path.dirname(os.path.realpath(__file__)), "tests")
|
|
|
|
LIBPATH = os.path.join(os.path.dirname(os.path.realpath(__file__)), "lib")
|
|
|
|
# these don't account for escaping, but I don't think we're ever going
|
|
|
|
# to have an escaped quotation mark in a needle tag
|
|
|
|
DOUBLEQUOTERE = re.compile('"(.*?)"')
|
|
|
|
SINGLEQUOTERE = re.compile("'(.*?)'")
|
|
|
|
|
|
|
|
# first we're gonna build a big list of all string literals
|
|
|
|
testpaths = glob.glob(f"{TESTSPATH}/**/*.pm", recursive=True)
|
|
|
|
testpaths.extend(glob.glob(f"{LIBPATH}/**/*.pm", recursive=True))
|
|
|
|
testliterals = []
|
|
|
|
for testpath in testpaths:
|
|
|
|
# skip if it's a symlink
|
|
|
|
if os.path.islink(testpath):
|
|
|
|
continue
|
|
|
|
# otherwise, scan it for string literals
|
|
|
|
with open(testpath, "r") as testfh:
|
|
|
|
testtext = testfh.read()
|
|
|
|
for match in DOUBLEQUOTERE.finditer(testtext):
|
|
|
|
testliterals.append(match[1])
|
|
|
|
for match in SINGLEQUOTERE.finditer(testtext):
|
|
|
|
testliterals.append(match[1])
|
|
|
|
|
|
|
|
# now let's do some whitelisting, for awkward cases where we know that
|
|
|
|
# we concatenate string literals and stuff
|
|
|
|
# versioned backgrounds and release IDs
|
|
|
|
for rel in range(30, 100):
|
|
|
|
testliterals.append(f"{rel}_background")
|
|
|
|
testliterals.append(f"version_{rel}_ident")
|
|
|
|
# anaconda id needles, using tell_source
|
|
|
|
for source in ("workstation", "generic", "server"):
|
|
|
|
testliterals.append(f"leftbar_{source}")
|
|
|
|
testliterals.append(f"topbar_{source}")
|
|
|
|
# keyboard layout switching, using desktop_switch_layout
|
|
|
|
for environment in ("anaconda", "gnome"):
|
|
|
|
for layout in ("native", "ascii"):
|
|
|
|
testliterals.append(f"{environment}_layout_{layout}")
|
|
|
|
# package set selection, using get_var('PACKAGE_SET')
|
|
|
|
for pkgset in ("kde", "workstation", "minimal"):
|
|
|
|
testliterals.append(f"anaconda_{pkgset}_highlighted")
|
|
|
|
testliterals.append(f"anaconda_{pkgset}_selected")
|
Add desktop login test, revise and rename check_desktop
This adds a new test that implementsQA:Testcase_desktop_login
on both GNOME and KDE.
While working on this, we realized that the "desktop_clean"
needles were really "app menu" needles, and for KDE, this was
a duplication with the new "system menu" needles, because on KDE
the app menu and the system menu are the same. So I (Adam)
started to de-duplicate that, but also realized that "app menu
button" is a much more accurate name for these needles, so I was
renaming the old desktop_clean needles to app_menu_button. That
led me to the realization that "check_desktop_clean" is itself a
dumb name, because we don't (at least, any more, way back in the
mists of time we may have done) do anything to check that the
desktop is "clean" - we're really just asserting that we're at a
desktop *at all*. While thinking *that* through, I *also* realized
that the whole "open the overview and look for the app grid icon"
workaround it did is no longer necessary, because GNOME doesn't
use a translucent top bar any more. That went away in GNOME 3.32,
which is in Fedora 30, our oldest supported release.
So I threw that away, renamed the function "check_desktop",
cleaned up all the needle naming and tagging, and also added an
app menu needle for GNOME in Japanese because we were missing
one (the Japanese tests have been using the "app grid icon"
workaround the whole time).
2020-03-20 09:04:43 +00:00
|
|
|
# desktop_login stuff
|
|
|
|
for user in ("jack", "jim"):
|
|
|
|
testliterals.append(f"login_{user}")
|
|
|
|
testliterals.append(f"user_confirm_{user}")
|
Add a needle check script, remove some unused needles
I call this...The @lruzicka Catcher!
It's a script that checks for needles that aren't actually used
anywhere. It also checks for cases where we have a needle JSON
file but no image, or an image file but no JSON file (and wipes
one case of the latter). It also adds a run of the script to tox
so we get it in CI.
You could make this script a lot more elaborate if you like, by
being fancier about parsing the test code and templates, but I
don't think it's really warranted, I think it just needs to be
'good enough'. It's not the end of the world if it misses the
odd thing or the whitelisting goes stale.
Quite a lot of the removed needles are remnants of different
approaches to app start/stop testing which weren't caught in the
initial PR review. The short-name partitioning ones are odd; they
were introduced in the commit that moved needles into subdirs,
but at least some of them don't actually appear to be moves. They
may have been non-tracked files Josef had lying around that got
into the commit by mistake, or they may just be old needles we
really used at some point but aren't using any more.
reclaim_space_second_partition was introduced as part of the
shrink test (along with reclaim_space_first_partition) but was
never actually used by that test - I guess, again, the test got
re-written during review but we forgot to remove the needle. We
rejigged user creation to use tab presses not a needle match a
while back, which made user_creation_password_input unnecessary.
The various cockpit_updates_* needles are I think remnants of
rewrites of the cockpit update tests that again were missed in
PR review, the tests as merged never used them.
Signed-off-by: Adam Williamson <awilliam@redhat.com>
2020-04-08 23:55:46 +00:00
|
|
|
# partitioning stuff, there's a bunch of this, all in anaconda.pm
|
|
|
|
# multiple things use this
|
2021-03-24 01:25:07 +00:00
|
|
|
for part in ("swap", "root", "efi", "boot", "bootefi", "home", "vda2"):
|
Add a needle check script, remove some unused needles
I call this...The @lruzicka Catcher!
It's a script that checks for needles that aren't actually used
anywhere. It also checks for cases where we have a needle JSON
file but no image, or an image file but no JSON file (and wipes
one case of the latter). It also adds a run of the script to tox
so we get it in CI.
You could make this script a lot more elaborate if you like, by
being fancier about parsing the test code and templates, but I
don't think it's really warranted, I think it just needs to be
'good enough'. It's not the end of the world if it misses the
odd thing or the whitelisting goes stale.
Quite a lot of the removed needles are remnants of different
approaches to app start/stop testing which weren't caught in the
initial PR review. The short-name partitioning ones are odd; they
were introduced in the commit that moved needles into subdirs,
but at least some of them don't actually appear to be moves. They
may have been non-tracked files Josef had lying around that got
into the commit by mistake, or they may just be old needles we
really used at some point but aren't using any more.
reclaim_space_second_partition was introduced as part of the
shrink test (along with reclaim_space_first_partition) but was
never actually used by that test - I guess, again, the test got
re-written during review but we forgot to remove the needle. We
rejigged user creation to use tab presses not a needle match a
while back, which made user_creation_password_input unnecessary.
The various cockpit_updates_* needles are I think remnants of
rewrites of the cockpit update tests that again were missed in
PR review, the tests as merged never used them.
Signed-off-by: Adam Williamson <awilliam@redhat.com>
2020-04-08 23:55:46 +00:00
|
|
|
testliterals.append(f"anaconda_part_select_{part}")
|
2020-05-26 16:05:38 +00:00
|
|
|
testliterals.append(f"anaconda_blivet_part_inactive_{part}")
|
Add a needle check script, remove some unused needles
I call this...The @lruzicka Catcher!
It's a script that checks for needles that aren't actually used
anywhere. It also checks for cases where we have a needle JSON
file but no image, or an image file but no JSON file (and wipes
one case of the latter). It also adds a run of the script to tox
so we get it in CI.
You could make this script a lot more elaborate if you like, by
being fancier about parsing the test code and templates, but I
don't think it's really warranted, I think it just needs to be
'good enough'. It's not the end of the world if it misses the
odd thing or the whitelisting goes stale.
Quite a lot of the removed needles are remnants of different
approaches to app start/stop testing which weren't caught in the
initial PR review. The short-name partitioning ones are odd; they
were introduced in the commit that moved needles into subdirs,
but at least some of them don't actually appear to be moves. They
may have been non-tracked files Josef had lying around that got
into the commit by mistake, or they may just be old needles we
really used at some point but aren't using any more.
reclaim_space_second_partition was introduced as part of the
shrink test (along with reclaim_space_first_partition) but was
never actually used by that test - I guess, again, the test got
re-written during review but we forgot to remove the needle. We
rejigged user creation to use tab presses not a needle match a
while back, which made user_creation_password_input unnecessary.
The various cockpit_updates_* needles are I think remnants of
rewrites of the cockpit update tests that again were missed in
PR review, the tests as merged never used them.
Signed-off-by: Adam Williamson <awilliam@redhat.com>
2020-04-08 23:55:46 +00:00
|
|
|
# select_disks
|
|
|
|
for num in range(1, 10):
|
|
|
|
testliterals.append(f"anaconda_install_destination_select_disk_{num}")
|
|
|
|
# custom_scheme_select
|
2020-11-18 12:44:05 +00:00
|
|
|
for scheme in ("standard", "lvmthin", "btrfs", "lvm"):
|
Add a needle check script, remove some unused needles
I call this...The @lruzicka Catcher!
It's a script that checks for needles that aren't actually used
anywhere. It also checks for cases where we have a needle JSON
file but no image, or an image file but no JSON file (and wipes
one case of the latter). It also adds a run of the script to tox
so we get it in CI.
You could make this script a lot more elaborate if you like, by
being fancier about parsing the test code and templates, but I
don't think it's really warranted, I think it just needs to be
'good enough'. It's not the end of the world if it misses the
odd thing or the whitelisting goes stale.
Quite a lot of the removed needles are remnants of different
approaches to app start/stop testing which weren't caught in the
initial PR review. The short-name partitioning ones are odd; they
were introduced in the commit that moved needles into subdirs,
but at least some of them don't actually appear to be moves. They
may have been non-tracked files Josef had lying around that got
into the commit by mistake, or they may just be old needles we
really used at some point but aren't using any more.
reclaim_space_second_partition was introduced as part of the
shrink test (along with reclaim_space_first_partition) but was
never actually used by that test - I guess, again, the test got
re-written during review but we forgot to remove the needle. We
rejigged user creation to use tab presses not a needle match a
while back, which made user_creation_password_input unnecessary.
The various cockpit_updates_* needles are I think remnants of
rewrites of the cockpit update tests that again were missed in
PR review, the tests as merged never used them.
Signed-off-by: Adam Williamson <awilliam@redhat.com>
2020-04-08 23:55:46 +00:00
|
|
|
testliterals.append(f"anaconda_part_scheme_{scheme}")
|
|
|
|
# custom_blivet_add_partition
|
2021-06-08 01:01:52 +00:00
|
|
|
for dtype in ("lvmvg", "lvmlv", "lvmthin", "raid"):
|
Add a needle check script, remove some unused needles
I call this...The @lruzicka Catcher!
It's a script that checks for needles that aren't actually used
anywhere. It also checks for cases where we have a needle JSON
file but no image, or an image file but no JSON file (and wipes
one case of the latter). It also adds a run of the script to tox
so we get it in CI.
You could make this script a lot more elaborate if you like, by
being fancier about parsing the test code and templates, but I
don't think it's really warranted, I think it just needs to be
'good enough'. It's not the end of the world if it misses the
odd thing or the whitelisting goes stale.
Quite a lot of the removed needles are remnants of different
approaches to app start/stop testing which weren't caught in the
initial PR review. The short-name partitioning ones are odd; they
were introduced in the commit that moved needles into subdirs,
but at least some of them don't actually appear to be moves. They
may have been non-tracked files Josef had lying around that got
into the commit by mistake, or they may just be old needles we
really used at some point but aren't using any more.
reclaim_space_second_partition was introduced as part of the
shrink test (along with reclaim_space_first_partition) but was
never actually used by that test - I guess, again, the test got
re-written during review but we forgot to remove the needle. We
rejigged user creation to use tab presses not a needle match a
while back, which made user_creation_password_input unnecessary.
The various cockpit_updates_* needles are I think remnants of
rewrites of the cockpit update tests that again were missed in
PR review, the tests as merged never used them.
Signed-off-by: Adam Williamson <awilliam@redhat.com>
2020-04-08 23:55:46 +00:00
|
|
|
testliterals.append(f"anaconda_blivet_part_devicetype_{dtype}")
|
2022-09-04 15:54:02 +00:00
|
|
|
for fsys in ("ext4", "xfs", "btrfs", "ppc_prep_boot", "swap", "efi_filesystem", "biosboot"):
|
Add a needle check script, remove some unused needles
I call this...The @lruzicka Catcher!
It's a script that checks for needles that aren't actually used
anywhere. It also checks for cases where we have a needle JSON
file but no image, or an image file but no JSON file (and wipes
one case of the latter). It also adds a run of the script to tox
so we get it in CI.
You could make this script a lot more elaborate if you like, by
being fancier about parsing the test code and templates, but I
don't think it's really warranted, I think it just needs to be
'good enough'. It's not the end of the world if it misses the
odd thing or the whitelisting goes stale.
Quite a lot of the removed needles are remnants of different
approaches to app start/stop testing which weren't caught in the
initial PR review. The short-name partitioning ones are odd; they
were introduced in the commit that moved needles into subdirs,
but at least some of them don't actually appear to be moves. They
may have been non-tracked files Josef had lying around that got
into the commit by mistake, or they may just be old needles we
really used at some point but aren't using any more.
reclaim_space_second_partition was introduced as part of the
shrink test (along with reclaim_space_first_partition) but was
never actually used by that test - I guess, again, the test got
re-written during review but we forgot to remove the needle. We
rejigged user creation to use tab presses not a needle match a
while back, which made user_creation_password_input unnecessary.
The various cockpit_updates_* needles are I think remnants of
rewrites of the cockpit update tests that again were missed in
PR review, the tests as merged never used them.
Signed-off-by: Adam Williamson <awilliam@redhat.com>
2020-04-08 23:55:46 +00:00
|
|
|
testliterals.append(f"anaconda_blivet_part_fs_{fsys}")
|
|
|
|
testliterals.append(f"anaconda_blivet_part_fs_{fsys}_selected")
|
|
|
|
# this is variable-y in custom_change_type but we only actually have
|
|
|
|
# one value
|
|
|
|
testliterals.append("anaconda_part_device_type_raid")
|
|
|
|
# custom_change_fs
|
2021-08-09 22:09:15 +00:00
|
|
|
for fsys in ("xfs", "ext4"):
|
Add a needle check script, remove some unused needles
I call this...The @lruzicka Catcher!
It's a script that checks for needles that aren't actually used
anywhere. It also checks for cases where we have a needle JSON
file but no image, or an image file but no JSON file (and wipes
one case of the latter). It also adds a run of the script to tox
so we get it in CI.
You could make this script a lot more elaborate if you like, by
being fancier about parsing the test code and templates, but I
don't think it's really warranted, I think it just needs to be
'good enough'. It's not the end of the world if it misses the
odd thing or the whitelisting goes stale.
Quite a lot of the removed needles are remnants of different
approaches to app start/stop testing which weren't caught in the
initial PR review. The short-name partitioning ones are odd; they
were introduced in the commit that moved needles into subdirs,
but at least some of them don't actually appear to be moves. They
may have been non-tracked files Josef had lying around that got
into the commit by mistake, or they may just be old needles we
really used at some point but aren't using any more.
reclaim_space_second_partition was introduced as part of the
shrink test (along with reclaim_space_first_partition) but was
never actually used by that test - I guess, again, the test got
re-written during review but we forgot to remove the needle. We
rejigged user creation to use tab presses not a needle match a
while back, which made user_creation_password_input unnecessary.
The various cockpit_updates_* needles are I think remnants of
rewrites of the cockpit update tests that again were missed in
PR review, the tests as merged never used them.
Signed-off-by: Adam Williamson <awilliam@redhat.com>
2020-04-08 23:55:46 +00:00
|
|
|
testliterals.append(f"anaconda_part_fs_{fsys}")
|
|
|
|
testliterals.append(f"anaconda_part_fs_{fsys}_selected")
|
2022-06-20 12:44:56 +00:00
|
|
|
# Needles for Help viewer
|
|
|
|
for section in ("desktop", "networking", "sound", "files", "user", "hardware",
|
|
|
|
"accessibility", "tipstricks", "morehelp"):
|
|
|
|
testliterals.append(f"help_section_{section}")
|
|
|
|
testliterals.append(f"help_section_content_{section}")
|
2022-07-13 11:11:18 +00:00
|
|
|
# Needles for Calculator
|
|
|
|
for button in ("div", "divider", "zero", "one", "two", "three", "four", "five",
|
|
|
|
"six","seven", "eight", "nine", "mod", "percent", "pi", "root",
|
|
|
|
"square", "sub"):
|
|
|
|
testliterals.append(f"calc_button_{button}")
|
|
|
|
for result in ("BokZw", "Czo4s", "O9qsL", "WIxiR", "b5y2B", "h7MfO", "qxuBK",
|
|
|
|
"tWshx", "uC8Ul", "3LAG3"):
|
|
|
|
testliterals.append(f"calc_result_{result}")
|
2022-07-25 09:34:20 +00:00
|
|
|
# Needles for Contacts
|
|
|
|
for hashname in ("jlJmL", "7XGzO", "ps61y", "OvXj~", "GqYOp", "VEFrP"):
|
|
|
|
testliterals.append(f"contacts_name_{hashname}")
|
|
|
|
testliterals.append(f"contacts_contact_listed_{hashname}")
|
|
|
|
testliterals.append(f"contacts_contact_existing_{hashname}")
|
|
|
|
testliterals.append(f"contacts_contact_doubled_{hashname}")
|
|
|
|
testliterals.append(f"contacts_contact_altered_{hashname}")
|
|
|
|
testliterals.append(f"contacts_contact_added_{hashname}")
|
|
|
|
for info in ("home", "personal", "work"):
|
|
|
|
testliterals.append(f"contacts_label_{info}")
|
2022-09-27 17:54:40 +00:00
|
|
|
# Needles for Maps
|
|
|
|
for location in ("vilnius", "denali", "wellington", "scarborough", "pune"):
|
|
|
|
testliterals.append(f"maps_select_{location}")
|
|
|
|
testliterals.append(f"maps_found_{location}")
|
|
|
|
testliterals.append(f"maps_info_{location}")
|
Add a needle check script, remove some unused needles
I call this...The @lruzicka Catcher!
It's a script that checks for needles that aren't actually used
anywhere. It also checks for cases where we have a needle JSON
file but no image, or an image file but no JSON file (and wipes
one case of the latter). It also adds a run of the script to tox
so we get it in CI.
You could make this script a lot more elaborate if you like, by
being fancier about parsing the test code and templates, but I
don't think it's really warranted, I think it just needs to be
'good enough'. It's not the end of the world if it misses the
odd thing or the whitelisting goes stale.
Quite a lot of the removed needles are remnants of different
approaches to app start/stop testing which weren't caught in the
initial PR review. The short-name partitioning ones are odd; they
were introduced in the commit that moved needles into subdirs,
but at least some of them don't actually appear to be moves. They
may have been non-tracked files Josef had lying around that got
into the commit by mistake, or they may just be old needles we
really used at some point but aren't using any more.
reclaim_space_second_partition was introduced as part of the
shrink test (along with reclaim_space_first_partition) but was
never actually used by that test - I guess, again, the test got
re-written during review but we forgot to remove the needle. We
rejigged user creation to use tab presses not a needle match a
while back, which made user_creation_password_input unnecessary.
The various cockpit_updates_* needles are I think remnants of
rewrites of the cockpit update tests that again were missed in
PR review, the tests as merged never used them.
Signed-off-by: Adam Williamson <awilliam@redhat.com>
2020-04-08 23:55:46 +00:00
|
|
|
# variable-y in custom_change_device but we only have one value
|
|
|
|
testliterals.append("anaconda_part_device_sda")
|
2021-05-03 15:37:46 +00:00
|
|
|
# for Anaconda help related needles.
|
|
|
|
testliterals.extend(f"anaconda_help_{fsys}" for fsys in ('install_destination',
|
|
|
|
'installation_progress', 'keyboard_layout', 'language_support', 'network_host_name',
|
2022-02-25 20:41:26 +00:00
|
|
|
'root_password', 'select_packages', 'installation_source', 'time_date', 'user_creation',
|
2021-05-03 15:37:46 +00:00
|
|
|
'language_selection', 'language', 'summary_link'))
|
|
|
|
|
|
|
|
testliterals.extend(f"anaconda_main_hub_{fsys}" for fsys in ('language_support', 'selec_packages',
|
|
|
|
'time_date', 'create_user','keyboard_layout'))
|
Add a needle check script, remove some unused needles
I call this...The @lruzicka Catcher!
It's a script that checks for needles that aren't actually used
anywhere. It also checks for cases where we have a needle JSON
file but no image, or an image file but no JSON file (and wipes
one case of the latter). It also adds a run of the script to tox
so we get it in CI.
You could make this script a lot more elaborate if you like, by
being fancier about parsing the test code and templates, but I
don't think it's really warranted, I think it just needs to be
'good enough'. It's not the end of the world if it misses the
odd thing or the whitelisting goes stale.
Quite a lot of the removed needles are remnants of different
approaches to app start/stop testing which weren't caught in the
initial PR review. The short-name partitioning ones are odd; they
were introduced in the commit that moved needles into subdirs,
but at least some of them don't actually appear to be moves. They
may have been non-tracked files Josef had lying around that got
into the commit by mistake, or they may just be old needles we
really used at some point but aren't using any more.
reclaim_space_second_partition was introduced as part of the
shrink test (along with reclaim_space_first_partition) but was
never actually used by that test - I guess, again, the test got
re-written during review but we forgot to remove the needle. We
rejigged user creation to use tab presses not a needle match a
while back, which made user_creation_password_input unnecessary.
The various cockpit_updates_* needles are I think remnants of
rewrites of the cockpit update tests that again were missed in
PR review, the tests as merged never used them.
Signed-off-by: Adam Williamson <awilliam@redhat.com>
2020-04-08 23:55:46 +00:00
|
|
|
|
|
|
|
# retcode tracker
|
|
|
|
ret = 0
|
|
|
|
|
|
|
|
# now let's scan our needles
|
|
|
|
unused = []
|
|
|
|
noimg = []
|
|
|
|
noneedle = []
|
|
|
|
|
|
|
|
needlepaths = glob.glob(f"{NEEDLEPATH}/**/*.json", recursive=True)
|
|
|
|
for needlepath in needlepaths:
|
|
|
|
# check we have a matching image file
|
|
|
|
imgpath = needlepath.replace(".json", ".png")
|
|
|
|
if not os.path.exists(imgpath):
|
|
|
|
noimg.append(needlepath)
|
|
|
|
with open(needlepath, "r") as needlefh:
|
|
|
|
needlejson = json.load(needlefh)
|
|
|
|
if any(tag in testliterals for tag in needlejson["tags"]):
|
|
|
|
continue
|
|
|
|
unused.append(needlepath)
|
|
|
|
|
|
|
|
# reverse check, for images without a needle file
|
|
|
|
imgpaths = glob.glob(f"{NEEDLEPATH}/**/*.png", recursive=True)
|
|
|
|
for imgpath in imgpaths:
|
|
|
|
needlepath = imgpath.replace(".png", ".json")
|
|
|
|
if not os.path.exists(needlepath):
|
|
|
|
noneedle.append(imgpath)
|
|
|
|
|
|
|
|
if unused:
|
|
|
|
ret += 1
|
|
|
|
print("Unused needle(s) found!")
|
|
|
|
for needle in unused:
|
|
|
|
print(needle)
|
|
|
|
|
|
|
|
if noimg:
|
|
|
|
ret += 2
|
|
|
|
print("Needle(s) without image(s) found!")
|
|
|
|
for needle in noimg:
|
|
|
|
print(needle)
|
|
|
|
|
|
|
|
if noneedle:
|
|
|
|
ret += 4
|
|
|
|
print("Image(s) without needle(s) found!")
|
|
|
|
for img in noneedle:
|
|
|
|
print(img)
|
|
|
|
|
|
|
|
sys.exit(ret)
|