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

Freeze callstack in integration and integrationRetryWorkspace functions #5165

Merged
merged 1 commit into from
May 6, 2023

Conversation

newhoggy
Copy link
Contributor

@newhoggy newhoggy commented Apr 27, 2023

Description

This is needed so that the generated module file contains the correct module name.

Before:

$ cabal test cardano-testnet --enable-tests --test-options '-p query-slot-number'
$ cat /private/tmp/nix-shell.wBf3gI/query-slot-number-0-test-744fa3ec7ae64cea/module
Testnet.Util.Base

After:

$ cabal test cardano-testnet --enable-tests --test-options '-p query-slot-number'
$ cat /private/tmp/nix-shell.wBf3gI/query-slot-number-0-test-744fa3ec7ae64cea/module
Test.Cli.QuerySlotNumber

Checklist

  • Commit sequence broadly makes sense and commits have useful messages
  • New tests are added if needed and existing tests are updated. These may include:
    • golden tests
    • property tests
    • roundtrip tests
    • integration tests
      See Runnings tests for more details
  • Any changes are noted in the CHANGELOG.md for affected package
  • The version bounds in .cabal files are updated
  • CI passes. See note on CI. The following CI checks are required:
    • Code is linted with hlint. See .github/workflows/check-hlint.yml to get the hlint version
    • Code is formatted with stylish-haskell. See .github/workflows/stylish-haskell.yml to get the stylish-haskell version
    • Code builds on Linux, MacOS and Windows for ghc-8.10.7 and ghc-9.2.7
  • Self-reviewed the diff

Note on CI

If your PR is from a fork, the necessary CI jobs won't trigger automatically for security reasons.
You will need to get someone with write privileges. Please contact IOG node developers to do this
for you.

@newhoggy newhoggy marked this pull request as ready for review April 27, 2023 15:18
integrationRetryWorkspace :: HasCallStack => Int -> FilePath -> (FilePath -> H.Integration ()) -> H.Property
integrationRetryWorkspace n workspaceName f = GHC.withFrozenCallStack $
integration $ H.retry n $ \i ->
H.runFinallies $ H.workspace (workspaceName <> "-" <> show i) f
Copy link
Contributor Author

Choose a reason for hiding this comment

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

The workspace function reports the caller's module in the workspaces module file so that it is easy to find the failing test that created the workspace.

However, these functions are utility functions and we don't want to report Testnet.Util.Base. We instead want to report the module of the functions that call these functions. Hence we freeze the call stack.

@newhoggy newhoggy enabled auto-merge April 28, 2023 02:24
@newhoggy newhoggy force-pushed the newhoggy/freeze-callstack-in-test-functions branch from 3eb91da to cdcfe3d Compare May 6, 2023 06:33
@newhoggy newhoggy added this pull request to the merge queue May 6, 2023
Merged via the queue into master with commit b097791 May 6, 2023
@iohk-bors iohk-bors bot deleted the newhoggy/freeze-callstack-in-test-functions branch May 6, 2023 09:26
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.

4 participants