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

Updates to accommodate CI/CD #1985

Merged
merged 4 commits into from
Feb 26, 2024

Conversation

galtm
Copy link
Contributor

@galtm galtm commented Feb 22, 2024

Committer Notes

{Please provide a brief description of what this PR accomplishes. Be sure to reference any issues addressed. If the PR is a work-in-progress submitted for early review, please include [WIP] at the beginning of the title or mark the PR as DRAFT.}

This PR imitates changes in xslt3-functions PR#7 to make XSpec tests compatible with CI/CD.

  • CI/CD puts compiled XSpec file somewhere else, so define ov:service variable more robustly so that uuid-value.txt will be found regardless of where compiled XSpec file is.

  • Java UUID class is not found in CI/CD, so conditionalize tests that use it. Running XSpec in Oxygen finds the class and verifies its results (same as before this change).

All Submissions:

By submitting a pull request, you are agreeing to provide this contribution under the CC0 1.0 Universal public domain dedication.

(For reviewers: The wiki has guidance on code review and overall issue review for completeness.)

Changes to Core Features:

N/A because this is not a feature change.

  • Have you added an explanation of what your changes do and why you'd like us to include them?
  • Have you written new tests for your core changes, as applicable?
  • Have you included examples of how to use your new feature(s)?
  • Have you updated all OSCAL website and readme documentation affected by the changes you made? Changes to the OSCAL website can be made in the docs/content directory of your branch.

Imitate changes in xslt3-functions PR#7.

- CI/CD puts compiled XSpec file somewhere else, so define
  ov:service variable more robustly so that uuid-value.txt
  will be found regardless of where compiled XSpec file is.

- Java UUID class is not found in CI/CD, so conditionalize
  tests that use it. Running XSpec in Oxygen finds the class
  and verifies its results (same as before this change).
@galtm galtm requested a review from a team as a code owner February 22, 2024 14:29
@iMichaela
Copy link
Contributor

@galtm - The path to the "missing file" was addressed by your change. There are other tests failing. Majority, due to another relative path not well defined (details below, based on local execution):

/Library/Developer/CommandLineTools/usr/bin/make -C ../src/utils/resolver-pipeline test
TEST_DIR=./testing/xspec \
                XSPEC_COMMAND=../../../build/metaschema-xslt/support/xspec/bin/xspec.sh \
                SAXON_CP="/Users/miorga/Desktop/ALL_PROJECTS/GH/OSCAL/src/utils/resolver-pipeline/java_modules/*" \
                ./testing/test.sh
xspec_suite_path,status
/Users/miorga/Desktop/ALL_PROJECTS/GH/OSCAL/src/utils/resolver-pipeline/testing/4_modified/modify.xspec,failed
/Users/miorga/Desktop/ALL_PROJECTS/GH/OSCAL/src/utils/resolver-pipeline/testing/2_metadata/random-util.xspec,passed
/Users/miorga/Desktop/ALL_PROJECTS/GH/OSCAL/src/utils/resolver-pipeline/testing/2_metadata/uuid-method-choice.xspec,passed
/Users/miorga/Desktop/ALL_PROJECTS/GH/OSCAL/src/utils/resolver-pipeline/testing/2_metadata/metadata.xspec,passed
/Users/miorga/Desktop/ALL_PROJECTS/GH/OSCAL/src/utils/resolver-pipeline/testing/2_metadata/version-util.xspec,passed
/Users/miorga/Desktop/ALL_PROJECTS/GH/OSCAL/src/utils/resolver-pipeline/testing/5_finished/finish.xspec,passed
/Users/miorga/Desktop/ALL_PROJECTS/GH/OSCAL/src/utils/resolver-pipeline/testing/1_selected/glob-rewrite.xspec,passed
/Users/miorga/Desktop/ALL_PROJECTS/GH/OSCAL/src/utils/resolver-pipeline/testing/1_selected/select-rlink.xspec,failed
/Users/miorga/Desktop/ALL_PROJECTS/GH/OSCAL/src/utils/resolver-pipeline/testing/1_selected/select.xspec,failed
/Users/miorga/Desktop/ALL_PROJECTS/GH/OSCAL/src/utils/resolver-pipeline/testing/1_selected/select-mapping-controls.xspec,failed
/Users/miorga/Desktop/ALL_PROJECTS/GH/OSCAL/src/utils/resolver-pipeline/testing/3_merged/merge.xspec,passed
/Users/miorga/Desktop/ALL_PROJECTS/GH/OSCAL/src/utils/resolver-pipeline/testing/3_merged/merge-as-is.xspec,passed
/Users/miorga/Desktop/ALL_PROJECTS/GH/OSCAL/src/utils/resolver-pipeline/testing/3_merged/merge-custom.xspec,failed
/Users/miorga/Desktop/ALL_PROJECTS/GH/OSCAL/src/utils/resolver-pipeline/testing/3_merged/merge-combine.xspec,passed

Here is first error:

Type error at char 69 in expression in xsl:sequence/@select on line 18885 column 191 of modify-compiled.xsl:
  XPTY0004  An empty sequence is not allowed as the first argument of
  patches-to-id-targeting-ancestor()
at template scenario7-scenario7 on line 18705 column 83 of modify-compiled.xsl:
     invoked by xsl:call-template at file:/Users/miorga//OSCAL/src/utils/resolver-pipeline/./testing/xspec/modify-compiled.xsl#15819
at template scenario7 on line 15789 column 83 of modify-compiled.xsl:
     invoked by xsl:for-each at file:/Users/miorga//OSCAL/src/utils/resolver-pipeline/./testing/xspec/modify-compiled.xsl#15798
at template scenario7 on line 15789 column 83 of modify-compiled.xsl:
     invoked by xsl:call-template at file:/Users/miorga//OSCAL/src/utils/resolver-pipeline/./testing/xspec/modify-compiled.xsl#238
at template main on line 201 column 41 of modify-compiled.xsl:
     invoked by xsl:for-each at file:/Users/miorga//OSCAL/src/utils/resolver-pipeline/./testing/xspec/modify-compiled.xsl#217
at template main on line 201 column 41 of modify-compiled.xsl:
An empty sequence is not allowed as the first argument of patches-to-id-targeting-ancestor()

The other tests appear to fail due to the relative path I mentioned:

Error at char 9 in expression in xsl:sequence/@select on line 155 column 58 of oscal-profile-resolve-select.xsl:
  FODC0002  I/O error reported by XML parser processing
  file:/Users/miorga//specifications/profile-resolution/profile-resolution-examples/catalogs/xyz-tiny_catalog.xml. Caused by java.io.FileNotFoundException: /Users/miorga//specifications/profile-resolution/profile-resolution-examples/catalogs/xyz-tiny_catalog.xml (No such file or directory) 

Everywhere where the path is define as:

select="resolve-uri('../../../../../../specifications/profile-resolution/profile-resolution-examples')"

It should be:

select="resolve-uri(‘../../../../specifications/profile-resolution/profile-resolution-examples')"

since the project tree is:

OSCAL/src/specifications/profile-resolution/proile-resolution-examples/catalogs/xyz-tiny_catalog.xml
OSCAL/src/utils/resolver-pipeline/testing/1_selected/*.xspec

- 2nd argument of resolve-uri makes the path relative to the original XSpec file instead of the compiled one, whose location can vary depending on how the test is run

- Remove one ../ from URI to resolve (similar to usnistgov#1945) because of directory reorg
Temporary change until it's clear whether this feature
is supported and what its expected result should be.
`select="id('a1-stmt')"` works in Oxygen but not xspec.bat or CI/CD. Expressing that select attribute a different way.

Also, I fixed a select attribute where the namespace prefix
was missing. The omission caused the test to pass for the wrong
reason (empty context).
@galtm
Copy link
Contributor Author

galtm commented Feb 23, 2024

@iMichaela , thanks for running the makefile on Linux and sharing the results. I pushed a few new commits:

  • a1fd469 makes the resolve-uri path relative to the original XSpec file, which works for Oxygen and the official xspec.bat script, and should work in the CI/CD makefile process as well. I also removed an additional ../ piece from the path (similar to Fix Schematron paths in profile resolver XML files #1945) because the profile resolver had a hierarchy change at some point after the original test was written.
  • 7e7f140 fixes the first error message you cited.
  • 77eae4d makes one of the test scenarios in src/utils/resolver-pipeline/testing/3_merged/merge-custom.xspec non-operational until we get confirmation about the feature status.

For all the tests that showed failures in the output you cited earlier, I ran the modified tests in Oxygen and in a Windows shell using xspec.bat. No failures.

Cc: @wendellpiez

@iMichaela
Copy link
Contributor

Indeed. All tests passed. I will review one more time today and approve it.

Copy link
Contributor

@wendellpiez wendellpiez left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Beautiful work thanks @galtm

@iMichaela iMichaela merged commit c8b7b54 into usnistgov:develop Feb 26, 2024
1 check passed
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.

3 participants