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

ogma-cli: Add all auxiliary test files to distributable Cabal package. Refs #216. #217

Merged
merged 4 commits into from
Jan 26, 2025

Conversation

ivanperez-keera
Copy link
Member

This commit adds any examples needed by the tests to the tests/ directory, adjust both the tests so that they can be located, and modifies the Cabal package to include all auxiliary test files in the Cabal source package, as prescribed in the solution proposed for #216.

The Cabal file for ogma-cli is not including all files needed for the
tests, or declaring them in the Cabal package, causing the tests to fail
when the packages are unpacked from the distributable source packages
created with Cabal.

This commit adds a missing file to the tests/ directory, which is its
natural location, and makes it possible for the tests access the file
without having to use getDataDir. The file is added under a new name for
consistency with other files used by the tests.
The Cabal file for ogma-cli is not including all files needed for the
tests, or declaring them in the Cabal package, causing the tests to fail
when the packages are unpacked from the distributable source packages
created with Cabal.

A prior commit has added a missing example to the tests/ directory.

This commit changes the tests to obtain that auxiliary test file from
said directory. It also adjusts the file name to its new name under the
tests/ directory.
The Cabal file for ogma-cli is not including all files needed for the
tests, or declaring them in the Cabal package, causing the tests to fail
when the packages are unpacked from the distributable source packages
created with Cabal.

Prior commits have added any missing auxiliary files to the tests/
directory, and adjusted the tests accordingly to find them.

This commit changes the Cabal package to include all auxiliary test
files to the extra-source-files field, making sure that the files are
included in the distributable source package but not installed with the
binary distribution.
@ivanperez-keera
Copy link
Member Author

Change Manager: Verified that:

  • Solution is implemented:
    • The code proposed compiles and passes all tests. Details:
    • The solution proposed produces the expected result. Details:
      The following Dockerfile installs ogma-cli, creates a distributable source package, unpacks it in a separate location, and runs the test from that unpacked archive, after which it prints the message "Success":
      FROM ubuntu:trusty
      
      ENV DEBIAN_FRONTEND=noninteractive
      
      RUN apt-get update
      
      RUN apt-get install --yes software-properties-common
      RUN add-apt-repository ppa:hvr/ghc
      RUN apt-get update
      
      RUN apt-get install --yes ghc-8.6.5 cabal-install-2.4
      RUN apt-get install --yes libz-dev alex happy
      RUN apt-get install --yes git
      
      ENV PATH=/opt/ghc/8.6.5/bin:/opt/cabal/2.4/bin:$PWD/.cabal-sandbox/bin:$PATH
      
      RUN cabal update
      RUN mkdir -p /root/test
      WORKDIR /root/test/
      
      SHELL ["/bin/bash", "-c"]
      CMD git clone $REPO \
          && cd $NAME \
          && cabal v1-sandbox init --sandbox=$PWD/../.cabal-sandbox \
          && git checkout $COMMIT \
          && cabal v1-install BNFC --constraint='happy<2.0' \
          && cabal v1-install ogma**/ --constraint='aeson>=2.0.3.0' --enable-tests \
          && cd ogma-cli \
          && cabal sdist \
          && cp dist/ogma-cli*.tar.gz .. \
          && cd .. \
          && tar -zxvpf ogma-cli*.tar.gz \
          && cd ogma-cli-1.6.0 \
          && find \
          && cabal v1-sandbox --sandbox=$PWD/../../.cabal-sandbox/ init \
          && cabal v1-install --constraint='aeson>=2.0.3.0' --enable-tests \
          && cabal v1-test \
          && echo Success
      Command (substitute variables based on new path after merge):
      $ docker run -e "REPO=https://github.com/ivanperez-keera/ogma" -e "NAME=ogma" -e "PAT=ogma" -e "COMMIT=ab3928364b7d41f73694e9ee8e061476e4a5551f" -it ogma-verify-216
      
  • Implementation is documented. Details:
    No updates needed; no new top-level definitions or introduction of new code.
  • Change history is clear.
  • Commit messages are clear.
  • Changelogs are updated.
  • Examples are updated. Details:
    No updates needed; changes are to the tests.
  • Required version bumps are evaluated. Details:
    Bump not needed; change does not affect API or user interface.

@ivanperez-keera ivanperez-keera merged commit f9f0a94 into nasa:develop Jan 26, 2025
2 checks passed
@ivanperez-keera ivanperez-keera deleted the develop-test-files branch January 26, 2025 18:31
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.

1 participant