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

Testing new way to specify azure tests #20060

Closed
wants to merge 15 commits into from
Closed
31 changes: 31 additions & 0 deletions .github/workflows/update_prci_cksum.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
name: Update PRCI checksum

on:
pull_request:

jobs:
compute-prci-checksum:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
ref: ${{ github.head_ref }}

- name: Compute checksum
run: |
cd src/test

# Compute the checksum of all prci .py source code
cksum=$(find tests -name '*.py' -exec grep -H -m 1 CLASSES {} \; | grep prci | cut -d':' -f1 | sort | xargs -n 1 cat | shasum -a 256 | cut -d' ' -f1)

# Update checksum in prci_checksum.txt
sed -i -e '/^# Checksum:/{' -e 'n' -e "s/.*/$cksum/" -e '}' prci_checksum.txt

- name: Commit and push changes
run: |
git config --global user.email "[email protected]"
git config --global user.name "GitHub Action"
git add -A
git commit -m "Update prci checksum" || echo "No changes to commit"
git push
38 changes: 3 additions & 35 deletions azure-pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,27 +10,9 @@

#####
# TO USE A NEW CONTAINER, UPDATE TAG NAME HERE AS PART OF YOUR PR!
# Be sure to keep the list of files in python_test_files variable
# consistent with those same files listed in the paths trigger
#####
variables:
container_tag: visitdav/visit-ci-develop:2024-10-15-shac4fd59
python_test_files: >
../../src/test/tests/databases/silo.py
../../src/test/tests/databases/blueprint.py
../../src/test/tests/databases/blueprint_export.py
../../src/test/tests/hybrid/ddf.py
../../src/test/tests/unit/default_methods.py
../../src/test/tests/unit/convert2to3.py
../../src/test/tests/unit/atts_assign.py
../../src/test/tests/unit/test_value_simple.py
../../src/test/tests/unit/annotation_objects.py
../../src/test/tests/unit/protocol.py
../../src/test/tests/unit/utility.py
../../src/test/tests/expressions/ghost_zoneid_expr.py
../../src/test/tests/expressions/global_stats.py
../../src/test/tests/expressions/math_expr.py
../../src/test/tests/expressions/tensor_expr.py

# only build merge target pr to develop
trigger: none
Expand All @@ -51,21 +33,7 @@ pr:
- 'data/silo*'
- 'data/blueprint*'
- 'src/test/py_src/*.py'
- 'src/test/tests/databases/silo.py'
- 'src/test/tests/databases/blueprint.py'
- 'src/test/tests/databases/blueprint_export.py'
- 'src/test/tests/hybrid/ddf.py'
- 'src/test/tests/unit/default_methods.py'
- 'src/test/tests/unit/convert2to3.py'
- 'src/test/tests/unit/atts_assign.py'
- 'src/test/tests/unit/test_value_simple.py'
- 'src/test/tests/unit/annotation_objects.py'
- 'src/test/tests/unit/protocol.py'
- 'src/test/tests/unit/utility.py'
- 'src/test/tests/expressions/ghost_zoneid_expr.py'
- 'src/test/tests/expressions/global_stats.py'
- 'src/test/tests/expressions/math_expr.py'
- 'src/test/tests/expressions/tensor_expr.py'
- 'src/test/prci_checksum.txt'

# fast fail consistency checks
stages:
Expand Down Expand Up @@ -158,8 +126,8 @@ stages:
# add to ld_lib path (rpaths are missing?)
export LD_LIBRARY_PATH=${VTK_LIB_DIR}:${OSPRAY_LIB_DIR}:${QT_LIB_DIR}
# run test suite on silo + blueprint tests
export TESTS="$(python_test_files)"
./run_visit_test_suite.sh --fuzzy --pixdiff 10 --avgdiff 10 --numdiff 0.1 -v ${TESTS}
export TESTS="$(find ../../src/test/tests -name '*.py' -exec grep -H -m 1 CLASSES {} \; | grep prci | cut -d':' -f1)"
Copy link
Member

Choose a reason for hiding this comment

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

I am not familiar enough with all of these commands to know exactly what is happening... if someone names a variable in a python test prci will the test get unwittingly triggered in CI?

./run_visit_test_suite.sh --pixdiff 10 --avgdiff 10 --numdiff 0.1 -v ${TESTS}
hasFailed="$(grep Failed\\\|Unacceptable\\\|OS-Killed output/html/index.html)"
if [[ -n "$hasFailed" ]]; then
exit 1 # tests failed
Expand Down
33 changes: 33 additions & 0 deletions src/test/prci_checksum.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
# This file holds a checksum of all the .py source code that is run
# during pull request CI. That is, any .py source file which includes
# the 'prci' string in the 'CLASSES' entry in the header of the file.
#
# This file is then used by Azure CI as one of the paths it checks to
# decide if it needs to trigger a new main build and run of tests.
#
# The string 'prci' stands for Pull Request Continuous Integration.
#
# To include any .py test script in pull request CI, just add the
# 'prci' string to the 'CLASSES' entry in the header of the file.
#
# New tests should be added only if they meet the following conditions...
#
# 1) The test typically takes less than 20 seconds to run "normally".
# 2) The test uses only Silo or Blueprint data or no data at all.
# 3) The test tests something significantly different from all the
# other .py files already included in prci.
#
# The command to produce the checksum is...
#
# find . -name '*.py' -exec grep -H -m 1 CLASSES {} \; | grep prci | \
# cut -d':' -f1 | sort | xargs -n 1 cat | shasum -a 256
#
# A GitHub Action maintains this checksum automatically.
#
# Because GitHub Actions and Azure CI are completely asyncronous to
# each other, its possible an Azure CI run can begin before the action
# that updates this checksum has completed. But, because any commit/push
# to a PR will cancel existing Azure runs and start new ones, this is ok.
#
# Checksum:
c5d80acd8b84f8924d62b6c84084c632bcc82e31796bc25c238e63bc8e89556b
4 changes: 4 additions & 0 deletions src/test/py_src/visit_test_suite.py
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,8 @@ def launch_visit_test(args):
opts = args[2]
top_dir = visit_root()
test_script = abs_path(test_path(),"visit_test_main.py")
if test.split('/')[-2] == 'azure':
test = abs_path('/'.join(test.split('/')[:-1]),os.readlink(test))
test_dir, test_file = os.path.split(test)
test_cat = os.path.split(test_dir)[1]
test_base = os.path.splitext(test_file)[0]
Expand Down Expand Up @@ -974,6 +976,8 @@ def launch_tests(opts,tests):
if len(results) != len(test_list):
for t in test_args:
if not t[0] in [ r.index for r in results]:
if t[1].split('/')[-2] == 'azure':
t[1] = abs_path('/'.join(t[1].split('/')[:-1]),os.readlink(t[1]))
test_dir, test_file = os.path.split(t[1])
test_cat = os.path.split(test_dir)[1]
test_base = os.path.splitext(test_file)[0]
Expand Down
21 changes: 21 additions & 0 deletions src/test/tests/azure/README.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
This directory maintains a "list" of those .py files we run
Pull Request CI on (via Azure). That "list" is implemented
as a bunch of symlinks from this dir to various .py files
we want to be executed during Pull Request CI.

DO NOT ADD .py FILES HERE.

Add only links to existing .py files in other parts of
src/test/tests dir tree here and so so only under the
following conditions...

1) The test typically takes less than 20 seconds to run
"normally" (e.g. on nightly testing).
2) The test uses only Silo or Blueprint data or no data
at all.
3) The test tests something significantly different from
all the other .py files already linked here.

If all of the above conditions are met, the adding a symlink
here to the associated .py file will have the effect of adding
it to the collection of tests performed during Pull Request CI.
1 change: 1 addition & 0 deletions src/test/tests/azure/annotation_objects.py
1 change: 1 addition & 0 deletions src/test/tests/azure/atts_assign.py
1 change: 1 addition & 0 deletions src/test/tests/azure/blueprint.py
1 change: 1 addition & 0 deletions src/test/tests/azure/blueprint_export.py
1 change: 1 addition & 0 deletions src/test/tests/azure/convert2to3.py
1 change: 1 addition & 0 deletions src/test/tests/azure/ddf.py
1 change: 1 addition & 0 deletions src/test/tests/azure/default_methods.py
1 change: 1 addition & 0 deletions src/test/tests/azure/ghost_zoneid_expr.py
1 change: 1 addition & 0 deletions src/test/tests/azure/global_stats.py
1 change: 1 addition & 0 deletions src/test/tests/azure/math_expr.py
1 change: 1 addition & 0 deletions src/test/tests/azure/protocol.py
1 change: 1 addition & 0 deletions src/test/tests/azure/silo.py
1 change: 1 addition & 0 deletions src/test/tests/azure/tensor_expr.py
1 change: 1 addition & 0 deletions src/test/tests/azure/test_value_simple.py
1 change: 1 addition & 0 deletions src/test/tests/azure/utility.py
2 changes: 1 addition & 1 deletion src/test/tests/databases/blueprint.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# ----------------------------------------------------------------------------
# CLASSES: nightly
# CLASSES: nightly, prci
Copy link
Member

Choose a reason for hiding this comment

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

Your first condition for PRCI tests isn't true for blueprint: The test typically takes less than 20 seconds to run "normally".

Copy link
Member Author

Choose a reason for hiding this comment

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

The condition is about adding new tests...not about anything preexisting this work.

Copy link
Member

Choose a reason for hiding this comment

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

I see

#
# Test Case: blueprint.py
#
Expand Down
2 changes: 1 addition & 1 deletion src/test/tests/databases/blueprint_export.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# ----------------------------------------------------------------------------
# MODES: serial parallel
# CLASSES: nightly
# CLASSES: nightly, prci
#
# Test Case: blueprint_export.py
#
Expand Down
2 changes: 1 addition & 1 deletion src/test/tests/databases/silo.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# ----------------------------------------------------------------------------
# CLASSES: nightly
# CLASSES: nightly, prci
#
# Test Case: silo.py
#
Expand Down
2 changes: 1 addition & 1 deletion src/test/tests/expressions/ghost_zoneid_expr.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# ----------------------------------------------------------------------------
# CLASSES: nightly
# CLASSES: nightly, prci
#
# Test Case: ghost_zoneid_expr.py
#
Expand Down
2 changes: 1 addition & 1 deletion src/test/tests/expressions/global_stats.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# ----------------------------------------------------------------------------
# CLASSES: nightly
# CLASSES: nightly, prci
#
# Test Case: global_stats.py
#
Expand Down
2 changes: 1 addition & 1 deletion src/test/tests/expressions/math_expr.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# ----------------------------------------------------------------------------
# CLASSES: nightly
# CLASSES: nightly, prci
#
# Test Case: math_expr.py
#
Expand Down
2 changes: 1 addition & 1 deletion src/test/tests/expressions/tensor_expr.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# ----------------------------------------------------------------------------
# CLASSES: nightly
# CLASSES: nightly, prci
#
# Test Case: tensor_expr.py
#
Expand Down
2 changes: 1 addition & 1 deletion src/test/tests/hybrid/ddf.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# ----------------------------------------------------------------------------
# CLASSES: nightly
# CLASSES: nightly, prci
#
# Test Case: ddf.py
#
Expand Down
2 changes: 1 addition & 1 deletion src/test/tests/unit/annotation_objects.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# ----------------------------------------------------------------------------
# CLASSES: nightly
# CLASSES: nightly, prci
#
# Test Case: annotation_objects.py
#
Expand Down
2 changes: 1 addition & 1 deletion src/test/tests/unit/convert2to3.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# ----------------------------------------------------------------------------
# CLASSES: nightly
# CLASSES: nightly, prci
#
# Test Case: convert2to3.py
#
Expand Down
2 changes: 1 addition & 1 deletion src/test/tests/unit/default_methods.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# ----------------------------------------------------------------------------
# CLASSES: nightly
# CLASSES: nightly, prci
#
# Test Case: default_methods.py
#
Expand Down
2 changes: 1 addition & 1 deletion src/test/tests/unit/protocol.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# ----------------------------------------------------------------------------
# CLASSES: nightly
# CLASSES: nightly, prci
#
# Test Case: protocolo.py
#
Expand Down
2 changes: 1 addition & 1 deletion src/test/tests/unit/test_value_simple.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# ----------------------------------------------------------------------------
# CLASSES: nightly
# CLASSES: nightly, prci
#
# Test Case: test_value_simple.py
#
Expand Down
2 changes: 1 addition & 1 deletion src/test/tests/unit/utility.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# ----------------------------------------------------------------------------
# CLASSES: nightly
# CLASSES: nightly, prci
#
# Test Case: utility.py
#
Expand Down