Skip to content

Commit

Permalink
Merge pull request #49 from cpp-lln-lab/infra-randomize_tests
Browse files Browse the repository at this point in the history
[INFRA] randomize tests
  • Loading branch information
Remi-Gau committed May 11, 2023
2 parents dd9764c + 6b28758 commit b6855a0
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 21 deletions.
14 changes: 2 additions & 12 deletions .github/workflows/run_tests_matlab.yml
Original file line number Diff line number Diff line change
Expand Up @@ -53,21 +53,11 @@ jobs:
with:
command: cd(fullfile(getenv('GITHUB_WORKSPACE'), '.github', 'workflows')); run tests_matlab;

- name: Check logs unix
if: matrix.os == 'ubuntu-latest' || matrix.os == 'macos-latest'
run: grep -q 0 test_report.log || { echo "Some tests failed. Check the 'Run tests' step to know which ones." >&2; exit 1; }
- name: Check logs windows
if: matrix.os == 'windows-latest'
run: |
if (-not (Get-Content test_report.log | Select-String -Pattern "0")) {
throw "Some tests failed. Check the 'Run tests' step to know which ones."
}
- name: Code coverage
if: matrix.os == 'ubuntu-latest' || matrix.os == 'macos-latest'
uses: codecov/codecov-action@v3
with:
file: coverage.xml
flags: ${{ matrix.os }}_matlab-${{ matrix.version }}
with_coverage: true
cover_xml_file: coverage.xml
name: codecov-umbrella
fail_ci_if_error: true
12 changes: 3 additions & 9 deletions run_tests.m
Original file line number Diff line number Diff line change
Expand Up @@ -17,20 +17,14 @@
addpath(fullfile(testFolder, 'utils'));

if ispc
success = moxunit_runtests(testFolder, '-verbose', '-recursive');
success = moxunit_runtests(testFolder, '-verbose', '-recursive', '-randomize_order');

else
success = moxunit_runtests(testFolder, ...
'-verbose', '-recursive', '-with_coverage', ...
'-verbose', '-recursive', '-with_coverage', '-randomize_order', ...
'-cover', folderToCover, ...
'-cover_xml_file', 'coverage.xml', ...
'-cover_html_dir', fullfile(pwd, 'coverage_html'));
end

fileID = fopen('test_report.log', 'w');
if success
fprintf(fileID, '0');
else
fprintf(fileID, '1');
end
fclose(fileID);
exit(double(~success));

0 comments on commit b6855a0

Please sign in to comment.