TriBITSPub / TriBITS

TriBITS: Tribal Build, Integrate, and Test System,
http://tribits.org
Other
36 stars 47 forks source link

Implement URL normalization in cdash_analyze_and_report.py (#577) #579

Closed skyreflectedinmirrors closed 1 year ago

skyreflectedinmirrors commented 1 year ago

This commit:

  1. Moves all URL normalization to use urllib.parse.quote from the standard library. Note: I did add a python2 fallback, which I believe should work, but I have not tested, nor do I know if that's a target at this time.
  2. Adds project name URL normalization to all URL Query creator methods (and adds appropriate tests, see: *_project_name_ampersand). Previously this was only applied in getCDashQueryTestsQueryUrl, but I felt it was best to be consistent.
  3. Selectively applies URL normalization to the project, site, build and test ids (not 100% sure the last is necessary, but doesn't hurt) to the values used in getCDashQueryTestsBrowserUrl to construct the query URLs. The quote function cannot be applied to the entire URL (which would be vastly more convenient) because, from the docs:

By default, this function is intended for quoting the path section of a URL. The optional safe parameter specifies additional ASCII characters that should not be quoted — its default value is '/'.

That is, if you apply it to the full URL it will escape things you don't want it to (e.g., the '&' in the php queries). Since we are manually constructing these, it is simple enough to apply.

  1. Adds a note about why we don't have to escape the queries coming from the input options (they are assumed to be normalized, as they're generated by CDash), and
  2. Adds a corresponding test (e.g., build name 'build++', site name with a space)