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

DecisionProcedureTest fails due to hard-coded z3 path #10

Open
andreamattavelli opened this issue Sep 20, 2017 · 2 comments
Open

DecisionProcedureTest fails due to hard-coded z3 path #10

andreamattavelli opened this issue Sep 20, 2017 · 2 comments
Assignees

Comments

@andreamattavelli
Copy link
Contributor

Hard-coding paths is a bad solution, since the build will likely fail on different environments.
A possible solution would be to rely on an environment variable, and then assumeTrue that the path exists. This has the effect that: if the environment variable is not set, the path will be null and the test skipped since the assumption does not hold.

A possible sketch of the solution:

@Before
public void setUp() throws DecisionException {
  String z3Path = System.getenv("z3_path");
  Assume.assumeTrue(z3Path!=null);
  this.dec =
     new DecisionProcedureAlgorithms(
        new DecisionProcedureSMTLIB2_AUFNIRA(new DecisionProcedureAlwSat(), this.calc, z3Path + " -smt2 -in -t:10"),
        this.calc);
}

Any better idea?

@pietrobraione
Copy link
Owner

I don't like very much the idea of making tests dependent on environment variables, especially if we want to keep everything IDE-friendly. Note that it's not really the build to fail, it's just that some tests do not pass (which, it's true, may stop the build at some point). I think that a way to improve the things could be let the test fail and report the issue by an error message pointing to the location in the test code where the developer can find the variable that should be changed.

@andreamattavelli
Copy link
Contributor Author

@pietrobraione I actually don't understand your comment. Environment variables are IDE- and OS-independent, so why shouldn't they be IDE-friendly? Moreover, hard-coded paths are everything-unfriendly. A typical user wants to download a tool, compile it, check that is works (in her environment), and package it. Currently, this is not possible: mvn package fails due to the hard-coded path. So one needs to download, and modify unfamiliar code to make everything work. This is not a great solution.
My proposal is more oriented on the Assume rather than the environment variable. Whatever solution you want to apply, on should not be forced to fix the path in the tests.

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

2 participants