diff --git a/bin/build_fixups.sh b/bin/build_fixups.sh index 41dfc0b04..dd48c5b79 100755 --- a/bin/build_fixups.sh +++ b/bin/build_fixups.sh @@ -41,6 +41,10 @@ $SUDO rm -f $AOMP/examples/hip/*.txt $SUDO rm -f $AOMP/examples/hip/*.sh $SUDO rm -f $AOMP/examples/openmp/*.txt $SUDO rm -f $AOMP/examples/openmp/*.sh +$SUDO rm -f $AOMP/examples/cloc/*.txt +$SUDO rm -f $AOMP/examples/cloc/*.sh +$SUDO rm -f $AOMP/examples/fortran/*.txt +$SUDO rm -f $AOMP/examples/fortran/*.sh #Clean libexec, share $SUDO rm -rf $AOMP/libexec diff --git a/examples/cloc/check_cloc.sh b/examples/cloc/check_cloc.sh new file mode 100755 index 000000000..a56241da3 --- /dev/null +++ b/examples/cloc/check_cloc.sh @@ -0,0 +1,37 @@ +#/bin/bash +# +# Checks all tests in examples/cloc directory using make check. Programs return 0 for success or a number > 0 for failure. +# +echo "" +echo "" +path=$(pwd) +base=$(basename $path) +echo "" +echo "RUNNING ALL TESTS IN: $path " +echo "" + +echo "" > check-cloc.txt +echo "" >> check-cloc.txt +echo "*******A non-zero exit code means a failure occured.*******" >> check-cloc.txt +echo "***********************************************************" >> check-cloc.txt + +#Loop over all directories and make run / make check depending on directory name +for directory in ./*/; do + (cd "$directory" && path=$(pwd) && base=$(basename $path) + make clean + make + make run + echo " Return Code for $base: $?" >> ../check-cloc.txt + make clean + + ) + +done + +#Print run.log for all tests that need visual inspection +for directory in ./*/; do + (cd "$directory" && path=$(pwd) && base=$(basename $path) + ) +done +cat check-cloc.txt +rm check-cloc.txt diff --git a/examples/cloc/vector_copy/vector_copy.cpp b/examples/cloc/vector_copy/vector_copy.cpp index 1751a0ec2..b63f5785a 100644 --- a/examples/cloc/vector_copy/vector_copy.cpp +++ b/examples/cloc/vector_copy/vector_copy.cpp @@ -120,6 +120,7 @@ static hsa_status_t get_device_memory_region(hsa_region_t region, void* data) { } int main() { + int errors = 0; // Initialize hsa runtime. hsa_status_t hsa_status = hsa_init(); assert(HSA_STATUS_SUCCESS == hsa_status); @@ -326,6 +327,7 @@ int main() { if (valid) { printf("passed validation\n"); } else { + errors = 1; printf("VALIDATION FAILED!\nBad index: %d, ref(in):%d, computed(out):%d\n", failIndex, in[failIndex], out[failIndex]); } @@ -348,5 +350,8 @@ int main() { free(in); free(out); + if(errors) + return EXIT_FAILURE; + return EXIT_SUCCESS; } diff --git a/examples/cloc/vector_copy_cuda/vector_copy.cpp b/examples/cloc/vector_copy_cuda/vector_copy.cpp index 1751a0ec2..b63f5785a 100644 --- a/examples/cloc/vector_copy_cuda/vector_copy.cpp +++ b/examples/cloc/vector_copy_cuda/vector_copy.cpp @@ -120,6 +120,7 @@ static hsa_status_t get_device_memory_region(hsa_region_t region, void* data) { } int main() { + int errors = 0; // Initialize hsa runtime. hsa_status_t hsa_status = hsa_init(); assert(HSA_STATUS_SUCCESS == hsa_status); @@ -326,6 +327,7 @@ int main() { if (valid) { printf("passed validation\n"); } else { + errors = 1; printf("VALIDATION FAILED!\nBad index: %d, ref(in):%d, computed(out):%d\n", failIndex, in[failIndex], out[failIndex]); } @@ -348,5 +350,8 @@ int main() { free(in); free(out); + if(errors) + return EXIT_FAILURE; + return EXIT_SUCCESS; } diff --git a/examples/cloc/vector_copy_hip/vector_copy.cpp b/examples/cloc/vector_copy_hip/vector_copy.cpp index db0fd4dfc..585d9721a 100644 --- a/examples/cloc/vector_copy_hip/vector_copy.cpp +++ b/examples/cloc/vector_copy_hip/vector_copy.cpp @@ -118,7 +118,8 @@ int main() { std::cout << "PASSED!\n"; } else { std::cout << "FAILED!\n"; + return EXIT_FAILURE; }; - return 0; + return EXIT_SUCCESS; } diff --git a/examples/cloc/vector_copy_hip_omp/vector_copy.cpp b/examples/cloc/vector_copy_hip_omp/vector_copy.cpp index 0eb8dcdd5..9660e6679 100644 --- a/examples/cloc/vector_copy_hip_omp/vector_copy.cpp +++ b/examples/cloc/vector_copy_hip_omp/vector_copy.cpp @@ -128,7 +128,8 @@ int main() { std::cout << "PASSED!\n"; } else { std::cout << "FAILED!\n"; + return EXIT_FAILURE; }; - return 0; + return EXIT_SUCCESS; } diff --git a/examples/fortran/check_fortran.sh b/examples/fortran/check_fortran.sh new file mode 100755 index 000000000..923c225f2 --- /dev/null +++ b/examples/fortran/check_fortran.sh @@ -0,0 +1,39 @@ +#/bin/bash +# +# Checks all tests in examples/fortran directory using make check. Programs return 0 for success or a number > 0 for failure. +# Tests that need to be visually inspected: helloworld +# +echo "" +echo "" +path=$(pwd) +base=$(basename $path) +echo "" +echo "RUNNING ALL TESTS IN: $path " +echo "" + +echo "" > check-fortran.txt +echo "" >> check-fortran.txt +echo "*******A non-zero exit code means a failure occured.*******" >> check-fortran.txt +echo "*******Tests that need visual inspection: helloworld********" >> check-fortran.txt +echo "***********************************************************" >> check-fortran.txt + +#Loop over all directories and make run / make check depending on directory name +for directory in ./*/; do + (cd "$directory" && path=$(pwd) && base=$(basename $path) + make clean + make + make run + echo " Return Code for $base: $?" >> ../check-fortran.txt + make clean + + ) + +done + +#Print run.log for all tests that need visual inspection +for directory in ./*/; do + (cd "$directory" && path=$(pwd) && base=$(basename $path) + ) +done +cat check-fortran.txt +rm check-fortran.txt diff --git a/examples/fortran/simple_offload/simple_offload.f95 b/examples/fortran/simple_offload/simple_offload.f95 index 834d3e351..254524312 100644 --- a/examples/fortran/simple_offload/simple_offload.f95 +++ b/examples/fortran/simple_offload/simple_offload.f95 @@ -14,7 +14,8 @@ program main write(6,*)"a(1)=", a(1), " a(2)=", a(2) if (a(1).ne.11 .or. a(2).ne.22) then - stop "ERROR: wrong answers" + write(6,*)"ERROR: wrong answers" + stop 2 endif write(6,*)"Success: if a diagnostic line starting with DEVID was output" return