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

Add test to check if the "build.properties" file is missing in jpf.jar #75

Closed
jeandersonbc opened this issue May 31, 2018 · 4 comments
Closed

Comments

@jeandersonbc
Copy link
Collaborator

jeandersonbc commented May 31, 2018

As discussed with @cyrille-artho, we should add a test to verify if an expected build.properties file is missing in jpf.jar file.

@jeandersonbc
Copy link
Collaborator Author

jeandersonbc commented May 31, 2018

Reminder: there is a getRepositoryInfo() in gov/nasa/jpf/report/Reporter.java, which returns null if build.properties cannot be found.

@jeandersonbc jeandersonbc changed the title Add test to check if the "build.properties" file is missing on jar file. Add test to check if the "build.properties" file is missing in jpf.jar May 31, 2018
@jeandersonbc
Copy link
Collaborator Author

After adding a minimal main to debug gov.nasa.jpf.report.Reporter (check here), I noticed that getRepositoryInfo() is called only in getJPFBanner():

  public String getJPFBanner () {
    // ...
    String rev = getRevision();
    if (rev != null){
      sb.append(" (rev ");
      sb.append(rev);
      sb.append(')');
    }
    // ...
    if (conf.getBoolean("report.show_repository", false)) {
      String repInfo =  getRepositoryInfo();
      if (repInfo != null) {
        sb.append( repInfo);
      }
    }
    return sb.toString();
  }

getRevision() reads a hash from .version (currently missing) and a similar thing goes with getRepositoryInfo() with build.properties (reads outdated info from an old .version file in the repository).

I guess the way to work on this issue is to create a ReportTest test and maybe add a mocked .version and build.properties file to test wheater getRespositoryInfo and getRevision output what is expected to output.

Note that without these mocked .version and build.properties file, we will have a test that won't be able to do much except check if the path .../.../.version and .../.../.../build.properties exists: both files are "revision-dependent".

@cyrille-artho and @wvisser - I guess just checking if both paths exist doesn't justify a new test in the test suite. I will work on my suggestion (ReportTest + mocked files) and submit a pull request for review, ok?

@cyrille-artho
Copy link
Member

cyrille-artho commented Jun 4, 2018 via email

cyrille-artho pushed a commit that referenced this issue Jun 5, 2018
Build tasks and tests to verify if resources exist in classpath

* Added minimal Java main to debug Reporter (#75)

* Added failing test due to missing .version file (#75)

* Added generateVersion task on Gradle Build (#75)

* Added test to check if hashes match with git output (#75)
@cyrille-artho
Copy link
Member

Great job, thanks!

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

No branches or pull requests

2 participants