Skip to content

Conversation

@jongleur1983
Copy link
Contributor

Prerequisites

  • I have written a descriptive pull-request title
  • I have verified that there are no overlapping pull-requests open
  • I have verified that I am following matches the existing coding patterns and practice as demonstrated in the repository. These follow strict Stylecop rules 👮.
  • I have provided test coverage for my change (where applicable)

Description

I'm contributing to ImageSharp since around a week, and I saw 3 people (myself included) stumbling over failing tests due to the submodule for test data being out of sync.

With this commit the run-tests.ps1 test script is extended by the following behaviour:

If something fails during the script run, the submodule status is checked.
A warning is printed if

  • any submodule is not initialized or
  • any submodule is not synchronized
  • git could not be called to check the submodule status.

These warnings contain hints on how to solve that potential issue.

I'm contributing to ImageSharp since around a week, and I saw 3 people (myself included) stumbling over failing tests due to the submodule for test data being out of sync.

With this commit the run-tests.ps1 test script is extended by the following behaviour:
- if something fails during the script run, the submodule status is checked.
  A warning is printed if
  - any submodule is not initialized or
  - any submodule is not synchronized
  - git could not be called to check the submodule status.
@codecov
Copy link

codecov bot commented May 3, 2018

Codecov Report

Merging #557 into master will increase coverage by <.01%.
The diff coverage is n/a.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #557      +/-   ##
==========================================
+ Coverage   88.69%   88.69%   +<.01%     
==========================================
  Files         840      840              
  Lines       35300    35300              
  Branches     2544     2544              
==========================================
+ Hits        31308    31310       +2     
+ Misses       3245     3243       -2     
  Partials      747      747
Impacted Files Coverage Δ
tests/ImageSharp.Tests/TestFormat.cs 77.38% <0%> (+2.38%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 3cc7caa...d248892. Read the comment docs.

Copy link
Member

@antonfirsov antonfirsov left a comment

Choose a reason for hiding this comment

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

@jongleur1983 tested locally by clearing tests\Images\External\, but it does not print the error message for me.

After a short debugging it seems, that CheckSubmoduleStatus() returns 0 despite of git submodule status resulting in string -5a9a88380166a87521d10048f53cda7f5f761d66 tests/Images/External (which contains a -)

run-tests.ps1 Outdated
$submoduleStatus = CheckSubmoduleStatus
if ([int]$submoduleStatus -eq 1) {
# not synced
Write-Host -ForegroundColor Yellow "Check if submodules are up to date. You can use 'git submodule update' to fix this";
Copy link
Member

Choose a reason for hiding this comment

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

Please use spaces for indentation instead of tabs! (Like the rest of the file.)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

resolved, thanks

1) -contains is for arrays, not for strings, so we use match (and mask the -)
2) if a module is not initialized the status contains the string ((null)) where usually the commit id is placed (the Hash in parantheses)
@jongleur1983
Copy link
Contributor Author

Fixes committed. Sorry for the circumstances - I should have tested it better myself.
Tested is now:

  • submodule points to wrong commit (out of sync)
  • submodule directory is empty (the test @antonfirsov performed)

and tabs are replaced by spaces of course.

There may still be cases missing, but I'm not sure how to test them.

Copy link
Member

@antonfirsov antonfirsov left a comment

Choose a reason for hiding this comment

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

@jongleur1983 I pushed a failing test to validate the effect of your changes on appveyor. Looks like the execution is about to succeed despite the failing test. run-tests.ps1 should not return 0 to it's caller, when test execution fails!

@antonfirsov
Copy link
Member

image

Unexpected behavior confirmed.

@antonfirsov
Copy link
Member

Everything looks good now.

@JimBobSquarePants I hope you don't mind that I'm merging this.

@antonfirsov antonfirsov merged commit a844268 into SixLabors:master May 7, 2018
@JimBobSquarePants
Copy link
Member

@antonfirsov Whenever you think something is good merge away! 😄

antonfirsov pushed a commit to antonfirsov/ImageSharp that referenced this pull request Nov 11, 2019
antonfirsov pushed a commit to antonfirsov/ImageSharp that referenced this pull request Nov 11, 2019
1) -contains is for arrays, not for strings, so we use match (and mask the -)
2) if a module is not initialized the status contains the string ((null)) where usually the commit id is placed (the Hash in parantheses)
antonfirsov added a commit to antonfirsov/ImageSharp that referenced this pull request Nov 11, 2019
…tsScript

Extend run-tests.ps1 by a warning if submodules are not synced
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.

3 participants