Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test: add some tracing to the svg validity test #658

Merged
merged 1 commit into from
May 8, 2024

Conversation

whot
Copy link
Member

@whot whot commented Apr 19, 2024

It's a bit hard to figure out from the CI logs what failed because they may be truncated. And for users not intimitely familiar with the test suite it's not that simple either so let's put in a bunch of trace stataments that should at least point to where things go wrong.

cc @AesaraB

@AesaraB
Copy link
Contributor

AesaraB commented Apr 19, 2024

Mildly tangential, but I made a fairly rudimentary bash script to debug things when I was testing things out.

#!/usr/bin/env bash

FILENAME=$1

echo "Checking for invalid class/id names"
grep -P "(class|id)=[\"'].*[\"']" $FILENAME | grep -vP '(class="[A-Z] (Button|Leader|Label)|id="(Button|Leader|Label)[A-Z])"'

echo "Checking for duplicate ids"
grep -P "id=[\"'](Button|Leader|Label)[A-Z][\"']" $FILENAME | sort | uniq -cd

echo "Checking for duplicate classes"
grep -P "class=[\"'][A-Z] (Button|Leader|Label)[\"']" $FILENAME | sort | uniq -cd

It's absolute garbage, mind you -- but it would suggest that something like a python script can be used to prevent doomed automated checks from running.

@whot
Copy link
Member Author

whot commented Apr 19, 2024

honestly, I think the whole svg validity test should be rewritten in python + pytest - it'll be simpler and provide better debugging options than the current one (which is now 12y old...)

@AesaraB
Copy link
Contributor

AesaraB commented Apr 19, 2024

honestly, I think the whole svg validity test should be rewritten in python + pytest - it'll be simpler and provide better debugging options than the current one (which is now 12y old...)

I'm unfamiliar with writing code for drivers, but I just heard some terms and ideas that I'm relatively familiar with.

I have some housekeeping to do with other projects and my personal life, so if I get those sorted before someone else commits their time to this, I think I should be able to write that code.

@whot
Copy link
Member Author

whot commented Apr 19, 2024

heh, I don't think in this case it's really low-level programming - you can parse the data files in python (ConfigParser will do it) and then for each svg file check that the expected bits exist.

We already have a python test to check the data files exist (test_svg_exists()), it would be a similar test to also check that for each Button A we have an svg element with id="Button A" that also has class="A Button". Then repeat for rings/strips/etc.

Definitely a good one to get started with, doubly so if you want to learn python :)

It's a bit hard to figure out from the CI logs what failed because they
may be truncated. And for users not intimitely familiar with the test
suite it's not that simple either so let's put in a bunch of trace
stataments that should at least point to where things go wrong.
@whot whot force-pushed the wip/validity-check-tracing branch from a75dcfc to ae01d5f Compare May 8, 2024 04:05
@whot
Copy link
Member Author

whot commented May 8, 2024

Going to merge this since @JoseExposito also ran into the issue of the svg checks not being particularly useful with their error messages. The output is a bit spammy and I've changed to to stderr now so it doesn't conflict with the TAP output on stdout but it's still better than a comment-less abort()

@whot whot merged commit 9cb019e into linuxwacom:master May 8, 2024
14 checks passed
@whot
Copy link
Member Author

whot commented May 8, 2024

honestly, I think the whole svg validity test should be rewritten in python + pytest - it'll be simpler and provide better debugging options than the current one (which is now 12y old...)

This is now part of #677

@AesaraB

This comment was marked as outdated.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants