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

testsuite: Testing ./Setup interface for failure mode #9410

Closed
mpickering opened this issue Nov 6, 2023 · 1 comment
Closed

testsuite: Testing ./Setup interface for failure mode #9410

mpickering opened this issue Nov 6, 2023 · 1 comment

Comments

@mpickering
Copy link
Collaborator

Currently we have code in the setup'' helper which says:

 189             else do                                                             
 190               r <- liftIO $ runghc (testScriptEnv env)                          
 191                                    (Just (testCurrentDir env))                  
 192                                    (testEnvironment env)                        
 193                                    (testCurrentDir env </> prefix </> "Setup.hs")
 194                                    (NE.toList full_args)                        
 195               recordLog r  
 196               requireSuccess r

The result of calling requireSuccess means that the call to the Setup script above has to succeed, but what about if we want to check the failure modes of ./Setup? In particular I want to check that it doesn't accept external commands (see #9403)

Am I missing way to test the interface of custom ./Setup scripts?

Proposal: Don't call requireSuccess r here, and require users of setup'' and setup' to check the exit code themselves.

This essentially reverts the commit 326da71, because it isn't what I wanted and not necessarily what you want if you want to test that ./Setup fails in a certain way.

@mpickering
Copy link
Collaborator Author

I now read the source of requireSuccess and infact it seems that I need to use the fails modifier to indicate that the call will fail, then we check the exit code is not ExitSuccess.

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

No branches or pull requests

1 participant