Skip to content

Commit

Permalink
Cherry pick LearningTestTool and test hierarchy from dev
Browse files Browse the repository at this point in the history
  • Loading branch information
bruno-at-orange committed Apr 9, 2024
1 parent d9120cd commit 141ecec
Show file tree
Hide file tree
Showing 117 changed files with 5,799 additions and 3,940 deletions.
1 change: 1 addition & 0 deletions .clang-format
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
BasedOnStyle: LLVM
Language: Cpp
ColumnLimit: 120
ReflowComments: false
IndentWidth: 8
AccessModifierOffset: -8
BreakBeforeBraces: Allman
Expand Down
10 changes: 5 additions & 5 deletions .github/actions/test-khiops-install/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -61,11 +61,11 @@ runs:
touch test/LearningTest/TestCoclustering/Standard/Iris/results/time.log
touch test/LearningTest/TestKhiops/Standard/Iris/results/time.log
echo "Check test results"
cd test/LearningTest/cmd/python/
$PYTHON test_khiops.py Khiops nul Standard
$PYTHON test_khiops.py Coclustering nul Standard
$PYTHON apply_command.py errors ../../TestKhiops/Standard/ Iris | tee /tmp/khiops-log.txt
$PYTHON apply_command.py errors ../../TestCoclustering/Standard/ Iris | tee /tmp/coclustering-log.txt
cd test/LearningTestTool/py/
$PYTHON kht_test.py ../../LearningTest/TestKhiops/Standard/Iris check
$PYTHON kht_test.py ../../LearningTest/TestCoclustering/Standard/Iris check
$PYTHON kht_apply.py ../../LearningTest/TestKhiops/Standard/Iris errors | tee /tmp/khiops-log.txt
$PYTHON kht_apply.py ../../LearningTest/TestCoclustering/Standard/Iris errors | tee /tmp/khiops-log.txt
if (grep -q error /tmp/khiops-log.txt || grep -q error /tmp/coclustering-log.txt); then
echo "::error::Errors in Khiops run"
false
Expand Down
52 changes: 27 additions & 25 deletions .github/workflows/run-standard-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -107,8 +107,9 @@ jobs:
- name: Set environment variables
shell: bash
run: |
echo "TEST_PY=test/LearningTest/cmd/python/test_khiops.py" >> "$GITHUB_ENV"
echo "APPLY_PY=test/LearningTest/cmd/python/apply_command.py" >> "$GITHUB_ENV"
echo "TEST_PY=test/LearningTestTool/py/kht_test.py" >> "$GITHUB_ENV"
echo "APPLY_PY=test/LearningTestTool/py/kht_apply.py" >> "$GITHUB_ENV"
echo "COLLECT_PY=test/LearningTestTool/py/kht_collect_results.py" >> "$GITHUB_ENV"
echo "BIN_PATH=${{ github.workspace }}/build/${{ env.PRESET_NAME }}/bin" >> "$GITHUB_ENV"
- name: Setup MPI (windows)
if: ${{ runner.os == 'Windows' }}
Expand Down Expand Up @@ -142,59 +143,60 @@ jobs:
export KhiopsMPIProcessNumber=4
fi
if [[ "${{ matrix.config }}" == "release" ]] ; then
python3 $TEST_PY Khiops ${BIN_PATH}/MODL${EXT} Standard
python $TEST_PY test/LearningTest/TestKhiops/Standard ${BIN_PATH}
if [[ "${{ matrix.running-mode }}" != "parallel" ]] ; then
python $TEST_PY Coclustering ${BIN_PATH}/MODL_Coclustering${EXT} Standard
python $TEST_PY KNI ${BIN_PATH}/KNITransfer${EXT} Standard
python $TEST_PY KNI ${BIN_PATH}/KNITransfer${EXT} MultiTables SpliceJunction
python $TEST_PY test/LearningTest/TestCoclustering/Standard ${BIN_PATH}
python $TEST_PY test/LearningTest/TestKNI/Standard ${BIN_PATH}
fi
else
python $TEST_PY Khiops ${BIN_PATH}/MODL${EXT} Standard IrisLight
python $TEST_PY test/LearningTest/TestKhiops/Standard/IrisLight ${BIN_PATH}
if [[ "${{ matrix.running-mode }}" != "parallel" ]] ; then
python $TEST_PY Coclustering ${BIN_PATH}/MODL_Coclustering${EXT} Standard Iris
python $TEST_PY KNI ${BIN_PATH}/KNITransfer${EXT} Standard Iris
python $TEST_PY test/LearningTest/TestCoclustering/Standard/Iris ${BIN_PATH}
python $TEST_PY test/LearningTest/TestKNI/Standard/Iris ${BIN_PATH}
fi
fi
- name: Collect results
shell: bash
if: success() || failure()
run: |
if [[ "${{ matrix.config }}" == "release" ]] ; then
python $APPLY_PY errors test/LearningTest/TestKhiops/Standard | tee test/LearningTest/TestKhiops/Standard/errors.txt
python $APPLY_PY test/LearningTest/TestKhiops/Standard errors | tee -a results/errors.txt
if [[ "${{ matrix.running-mode }}" != "parallel" ]] ; then
python $APPLY_PY errors test/LearningTest/TestCoclustering/Standard | tee test/LearningTest/TestCoclustering/Standard/errors.txt
python $APPLY_PY errors test/LearningTest/TestKNITransfer/Standard | tee test/LearningTest/TestKNITransfer/Standard/errors.txt
python $APPLY_PY errors test/LearningTest/TestKNITransfer/MultiTables SpliceJunction | tee test/LearningTest/TestKNITransfer/MultiTables/errors.txt
python $APPLY_PY test/LearningTest/TestCoclustering/Standard errors | tee -a results/errors.txt
python $APPLY_PY test/LearningTest/TestKNI/Standard errors | tee -a results/errors.txt
fi
else
python $APPLY_PY errors test/LearningTest/TestKhiops/Standard IrisLight | tee test/LearningTest/TestKhiops/Standard/errors.txt
python $APPLY_PY test/LearningTest/TestKhiops/Standard/IrisLight errors | tee -a results/errors.txt
if [[ "${{ matrix.running-mode }}" != "parallel" ]] ; then
python $APPLY_PY errors test/LearningTest/TestCoclustering/Standard Iris | tee test/LearningTest/TestCoclustering/Standard/errors.txt
python $APPLY_PY errors test/LearningTest/TestKNITransfer/Standard Iris | tee test/LearningTest/TestKNITransfer/Standard/errors.txt
python $APPLY_PY test/LearningTest/TestCoclustering/Standard/Iris errors | tee -a results/errors.txt
python $APPLY_PY test/LearningTest/TestKNI/Standard/Iris errors | tee -a results/errors.txt
fi
fi
python $COLLECT_PY test/LearningTest/ results --collect-type warnings -f basic
- name: Check results
# We escape eol in the results file to print multilines in the github UI https://github.com/orgs/community/discussions/26288
shell: bash
run: |
if grep -qr "error" --include="errors.txt" test/LearningTest/ ; then
echo "::error::Errors in test"
MSG=$(<results/errors.txt)
MSG="${MSG//'%'/'%25'}"
MSG="${MSG//$'\n'/'%0A'}"
MSG="${MSG//$'\r'/'%0D'}"
if grep -q -e "error" -e "The test has not been launched" results/errors.txt ; then
echo "::error::$MSG"
false
fi
if grep -qr "The test has not been launched" --include="errors.txt" test/LearningTest/ ; then
echo "::error::Test not launched"
if [ "${{ github.event.inputs.warning_as_error }}" == "true" ] && grep -q "warning" results/errors.txt ; then
echo "::error::$MSG"
false
fi
- name: Upload test results
if: failure()
uses: actions/upload-artifact@v3
with:
name: test-results-${{ env.PRESET_NAME }}-${{ matrix.running-mode}}
name: test-results-${{ env.PRESET_NAME }}-${{ matrix.running-mode }}
retention-days: 7
path: |-
test/LearningTest/**/results
test/LearningTest/**/results.ref
test/LearningTest/**/errors.txt
test/LearningTest/**/comparisonResults.log
results/
cleanup-cache:
# Clean up all caches belonging to the current run
if: ${{ always() }}
Expand Down
11 changes: 4 additions & 7 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,9 @@ khiops-conda/
CMakeFiles/

# Test exceptions
test/*/results/
LearningTest/*/*/*/results/
LearningTest/*/*/*/results.ref/time.log

# LearningTest
results/
__pycache__/
test/UnitTests/*/results/
test/LearningTest/*/*/*/results/
comparisonResults.log

# Python
*.pyc
1 change: 1 addition & 0 deletions scripts/update-copyright.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Updates the copyright notice of the input files"""

import argparse
import os
from datetime import datetime
Expand Down
216 changes: 0 additions & 216 deletions test/LearningTest/cmd/python/README.md

This file was deleted.

Loading

0 comments on commit 141ecec

Please sign in to comment.