diff --git a/.jenkins/cross-compilation/Jenkinsfile b/.jenkins/cross-compilation/Jenkinsfile new file mode 100644 index 0000000000..2c70bb16b6 --- /dev/null +++ b/.jenkins/cross-compilation/Jenkinsfile @@ -0,0 +1,161 @@ +// The cross-compilation job tests mlpack on a set of low-resource devices. +// First, the cross-compilation host compiles mlpack tests for each +// architecture, and then copies them to the destination host and runs them. +pipeline +{ + agent + { + // Only use a node that has access to the target hosts. + label 'cross-compile' + } + + options + { + // Only allow one build at a time of this job. + disableConcurrentBuilds(abortPrevious: true) + } + + stages + { + stage('Set build as pending') + { + steps + { + // Set the build status... + script + { + u = load '.jenkins/utils.groovy' + u.startBuild("Cross-compilation Tests"); + } + + // Create a directory for our resulting reports. + sh'mkdir -p reports/' + } + } + + stage('Cross-compile mlpack to different targets') + { + matrix + { + axes + { + axis + { + name 'target' + values 'couscous;rpi5;cortexa76' + } + } + + stages + { + // Extract the hostname, the device, and the architecture. + stage('Extract parameters from build matrix') + { + steps + { + script + { + def components = env.target.split(';') + + env.hostname = components[0] + env.device = components[1] + env.arch = components[2] + env.arch_upper = components[2].toUpperCase() + } + } + } + + // Cross-compile mlpack tests. + stage('Cross-compilation tests') + { + agent + { + docker + { + image 'mlpack/mlpack-cross-compile-' + env.arch + ':latest' + alwaysPull true + reuseNode true + } + } + steps + { + sh ''' + rm -rf build/ + mkdir build/ + cd build/ + cmake \ + -DBUILD_TESTS=ON \ + -DARCH_NAME=${arch_upper} \ + -DCMAKE_CROSSCOMPILING=ON \ + -DCMAKE_TOOLCHAIN_FILE=../CMake/crosscompile-toolchain.cmake \ + -DTOOLCHAIN_PREFIX=$TOOLCHAIN_PREFIX \ + -DCMAKE_SYSROOT=$CMAKE_SYSROOT \ + -DDOWNLOAD_DEPENDENCIES=ON \ + ../ + make mlpack_test; + ''' + + withCredentials([sshUserPrivateKey( + credentialsId: 'mlpack-jenkins-cross-compile-rsa-key', + keyFileVariable: 'KEY_FILE', + passphraseVariable: 'PASSPHRASE')]) + { + sh''' + eval $(ssh-agent -s) + echo ${PASSPHRASE} | SSH_ASKPASS=/bin/cat setsid -w ssh-add ${KEY_FILE} + + # Don't check the host keys, because they won't be saved in + # this container anyway. + mkdir -p ~/.ssh/ + echo 'Host *' >> ~/.ssh/config; + echo ' StrictHostKeyChecking no' >> ~/.ssh/config; + + ssh jenkins@${hostname} -t mkdir -p test_${BRANCH_NAME}_${BUILD_ID}/ + scp build/bin/mlpack_test jenkins@${hostname}:test_${BRANCH_NAME}_${BUILD_ID}/ + scp -r src/mlpack/tests/data/* jenkins@${hostname}:test_${BRANCH_NAME}_${BUILD_ID}/ + # Unpack all compressed test data. + ssh jenkins@${hostname} -t " + cd test_${BRANCH_NAME}_${BUILD_ID}; + find ./ -iname '*.bz2' -exec tar xvf \\{\\} \\;" + + mkdir -p reports; + ssh jenkins@${hostname} -t " + cd test_${BRANCH_NAME}_${BUILD_ID}; + mkdir -p reports; + ./mlpack_test -r junit -o reports/mlpack_test.junit.xml" + + # Clean up afterwards. + scp jenkins@${hostname}:test_${BRANCH_NAME}_${BUILD_ID}/reports/mlpack_test.junit.xml reports/mlpack_test.${hostname}.junit.xml; + ssh jenkins@${hostname} -t rm -rf test_${BRANCH_NAME}_${BUILD_ID}/; + ''' + } + } + } + } + } + } + } + + post + { + always + { + junit '**/reports/mlpack_test.*.junit.xml' + + // Clean the workspace. + cleanWs(cleanWhenNotBuilt: true, + deleteDirs: true, + disableDeferredWipeout: true, + notFailBuild: true) + + script + { + u.setBuildStatus(result: currentBuild.currentResult, + context: "Cross-compilation Tests", + successMessage: "Cross-compilation succeeded with no errors.", + unstableMessage: "Cross-compilation build unstable.", + failureMessage: "Cross-compilation failed."); + } + } + } +} diff --git a/.jenkins/doc-link-check/Jenkinsfile b/.jenkins/doc-link-check/Jenkinsfile new file mode 100644 index 0000000000..d56e8be817 --- /dev/null +++ b/.jenkins/doc-link-check/Jenkinsfile @@ -0,0 +1,107 @@ +// The documentation link checker build will build the Markdown documentation in +// doc/, and ensures that all of the links contained in the documentation are +// valid. +// +// Note that a cache is maintained on Jenkins to avoid checking the same links +// over and over again. +pipeline +{ + // Run inside of the custom Docker image for style checking. + // Every docker agent has a 'link_cache/' directory in its Jenkins workspace + // for this job. + agent + { + docker + { + image 'mlpack/jenkins-mlpack-docbuild:latest' + alwaysPull true + args '-v /home/jenkins/link_cache/:/opt/link_cache/' + } + } + + options + { + // Only allow one build at a time of this job. + disableConcurrentBuilds(abortPrevious: true) + } + + stages + { + // First we have to check out the jenkins-conf repository, which contains + // the scripts that we will use for checking the style. + stage('Build documentation and check links') + { + steps + { + script + { + u = load '.jenkins/utils.groovy' + u.startBuild("Documentation Link Check"); + } + + sh ''' + # Set $HOME because the Docker container may be running with a + # different uid. Note that the container has /workspace/ as the + # working directory; we'll just reuse that as $HOME. + export HOME=/workspace/ + + # Print the size of the link cache. + if [ ! -f /opt/link_cache/link_cache.db ]; + then + echo "Link cache does not exist!"; + else + echo "Link cache current size:"; + ls -lh /opt/link_cache/link_cache.db; + fi + + # Skip the check if the documentation build script doesn't exist. + if [ ! -f scripts/build-docs.sh ]; + then + exit 0; + fi + + # This will fail if there are any issues converting the Markdown to + # kramdown, or if there is a linting or link-checking failure. + LINK_CACHE_FILE=/opt/link_cache/link_cache.db ./scripts/build-docs.sh; + build_doc_out=$?; + if [ $build_doc_out -ne 0 ]; + then + echo "build-docs.sh failed!"; + exit 1; + fi + ''' + } + } + } + + post + { + always + { + // Publish the generated HTML. + publishHTML([ + allowMissing: false, + alwaysLinkToLastBuild: false, + keepAll: true, + reportDir: 'doc/html/', + reportFiles: 'index.html', + reportName: 'Build documentation']); + + // Clean the workspace. + cleanWs(cleanWhenNotBuilt: true, + deleteDirs: true, + disableDeferredWipeout: true, + notFailBuild: true); + + // Set the build status. + script + { + u.setBuildStatus(result: currentBuild.currentResult, + context: "Documentation Link Check", + successMessage: "All HTML links checked.", + unstableMessage: "Problem with HTML links.", + failureMessage: "HTML link check failure or problem."); + } + } + } +} diff --git a/.jenkins/doc-snippet-build/Jenkinsfile b/.jenkins/doc-snippet-build/Jenkinsfile new file mode 100644 index 0000000000..6a27bc66ac --- /dev/null +++ b/.jenkins/doc-snippet-build/Jenkinsfile @@ -0,0 +1,74 @@ +// The documentation snippet build will extract all C++ code snippets from the +// Markdown documentation in doc/ and ensure that it compiles and runs without +// error. +pipeline +{ + // Run inside of the custom Docker image for documentation builds. + agent + { + docker + { + image 'mlpack/jenkins-mlpack-docbuild:latest' + alwaysPull true + args '-v /home/jenkins/ccache:/opt/ccache' + } + } + + options + { + // Only allow one build at a time of this job. + disableConcurrentBuilds(abortPrevious: true) + } + + stages + { + stage('Extract and build documentation snippets') + { + steps + { + script + { + u = load '.jenkins/utils.groovy' + u.startBuild("Documentation Snippet Build"); + } + + sh''' + export CCACHE_DIR=/opt/ccache/; + export CXX="ccache g++"; + export CXXFLAGS="-O3 -DNDEBUG -fopenmp -I./src/ -I/usr/include/eigen3/"; + export LDFLAGS="-fopenmp"; + export OMP_NUM_THREADS=1; + + ccache -p; + ls -l /opt/ccache/ + ccache --zero-stats; + ./scripts/test-docs.sh doc/; + # Print ccache statistics. + ccache -s + ''' + } + } + } + + post + { + always + { + // Clean the workspace. + cleanWs(cleanWhenNotBuilt: true, + deleteDirs: true, + disableDeferredWipeout: true, + notFailBuild: true); + + // Set the build status. + script + { + u.setBuildStatus(result: currentBuild.currentResult, + context: "Documentation Snippet Build", + successMessage: "All snippets built and run successfully.", + unstableMessage: "Snippets build unstable..", + failureMessage: "Snippet build or runtime failure."); + } + } + } +} diff --git a/.jenkins/memory-checks/Jenkinsfile b/.jenkins/memory-checks/Jenkinsfile new file mode 100644 index 0000000000..e24467d5e4 --- /dev/null +++ b/.jenkins/memory-checks/Jenkinsfile @@ -0,0 +1,137 @@ +// The static code analysis build will analyze the mlpack codebase for any known +// C++ issues. +pipeline +{ + // Run inside of the custom Docker image for style checking. + agent + { + docker + { + image 'mlpack/jenkins-amd64-debian:latest' + alwaysPull true + args '-v /home/jenkins/ccache:/opt/ccache' + } + } + + options + { + // Only allow one build at a time of this job. + disableConcurrentBuilds(abortPrevious: true) + } + + stages + { + // First we have to check out the jenkins-conf repository, which contains + // the scripts that we will use for checking the style. + stage('Check out jenkins-conf repository') + { + steps + { + script + { + u = load '.jenkins/utils.groovy' + u.startBuild("Memory Checks"); + } + + sh ''' + git clone https://github.com/mlpack/jenkins-conf + ''' + } + } + + // First build mlpack_test. + stage('Build mlpack') + { + steps + { + sh ''' + export CCACHE_DIR=/opt/ccache/; + ccache --zero-stats + + mkdir build + cd build + cmake -DDEBUG=ON -DBUILD_TESTS=ON -DDOWNLOAD_DEPENDENCIES=ON .. + make mlpack_test + cd .. + + # Print ccache statistics. + ccache -s + ''' + } + } + + // Now run the memory checks. + stage('Run memory checks') + { + steps + { + // First get the number of the PR, as we will need to do that to see + // what files have changed. + script + { + if (env.BRANCH_NAME.startsWith('PR-')) + { + // Strip 'PR-' from the front. + env.PR_NUM = env.BRANCH_NAME.substring(3) + } + } + + sh''' + # Move memory tests to the current directory. + cp jenkins-conf/memory/* . + + # Get information about the current PR. + echo "PR number: ${PR_NUM}"; + curl -o files.txt https://api.github.com/repos/mlpack/mlpack/pulls/${PR_NUM}/files + grep -o '^[ ]*"filename":.*' files.txt |\ + sed -e 's/^[ ]*"filename": "//' -e 's/",//' |\ + uniq |\ + awk '/.cpp/ || /.hpp/' > filenames.txt; + + # Debug print modified files, we try to run the memory check for those + # files only. + cat filenames.txt; + + # Workaround for docker container where the ulimit is set to a + # strangely large number... + ulimit -n 1024; + + # Run memory checks. + OMP_NUM_THREADS=1 ./run-mlpack-valgrind-tests.sh ||\ + mkdir -p temp/test; + + # Debug print tests to run. + cat testbins.txt; + + # Cat the output... + ls -lh reports/tests/ + ''' + } + } + } + + post + { + always + { + junit(allowEmptyResults: true, + testResults: '**/reports/tests/*.xml') + + // Clean the workspace. + cleanWs(cleanWhenNotBuilt: true, + deleteDirs: true, + disableDeferredWipeout: true, + notFailBuild: true) + + // Set the build status. + script + { + u.setBuildStatus(result: currentBuild.currentResult, + context: "Memory Checks", + successMessage: "No memory errors.", + unstableMessage: "Build unstable.", + failureMessage: "Memory check failure with valgrind."); + } + } + } +} diff --git a/.jenkins/style-checks/Jenkinsfile b/.jenkins/style-checks/Jenkinsfile new file mode 100644 index 0000000000..53e2ffc784 --- /dev/null +++ b/.jenkins/style-checks/Jenkinsfile @@ -0,0 +1,93 @@ +// The style checker build will check the style of all the code in the +// repository. +pipeline +{ + // Run inside of the custom Docker image for style checking. + agent + { + docker + { + image 'mlpack/jenkins-mlpack-style-checks:latest' + alwaysPull true + } + } + + options + { + // Only allow one build at a time of this job. + disableConcurrentBuilds(abortPrevious: true) + } + + stages + { + // First we have to check out the jenkins-conf repository, which contains + // the scripts that we will use for checking the style. + stage('Check out jenkins-conf repository') + { + steps + { + script + { + u = load '.jenkins/utils.groovy' + u.startBuild('Style Checks') + } + + sh ''' + git clone https://github.com/mlpack/jenkins-conf + ''' + } + } + + // Now we can run those scripts. + stage('Check code style') + { + steps + { + sh ''' + mkdir -p reports + ./jenkins-conf/linter/lint.sh \ + --root . \ + --reports reports/cpplint.junit.xml \ + --dir ./src/mlpack + + # Print the results. + cat reports/cpplint.junit.xml + ''' + } + } + } + + post + { + // Mark unstable builds as failed. + unstable + { + script + { + error "Style check failure." + } + } + + always + { + // Process the test results. + junit(allowEmptyResults: true, + testResults: '**/reports/cpplint.junit.xml') + + // Clean the workspace. + cleanWs(cleanWhenNotBuilt: false, + deleteDirs: true, + disableDeferredWipeout: true, + notFailBuild: true) + + script + { + u.setBuildStatus(result: currentBuild.currentResult, + context: "Style Checks", + successMessage: "No style issues.", + unstableMessage: "Style issues found.", + failureMessage: "Style issues found."); + } + } + } +} diff --git a/.jenkins/utils.groovy b/.jenkins/utils.groovy new file mode 100644 index 0000000000..50c6d19d5a --- /dev/null +++ b/.jenkins/utils.groovy @@ -0,0 +1,66 @@ +// A simple utility to mark the build as pending on Github. +def startBuild(String context) +{ + step([ + $class: "GitHubCommitStatusSetter", + reposSource: [$class: "ManuallyEnteredRepositorySource", + url: "https://github.com/mlpack/mlpack"], + contextSource: [$class: "ManuallyEnteredCommitContextSource", + context: context ], + errorHandlers: [[$class: "ChangingBuildStatusErrorHandler", + result: "UNSTABLE"]], + statusResultSource: [$class: "ConditionalStatusResultSource", + results: [[$class: "AnyBuildResult", + message: "Building...", + state: "PENDING"]]] + ]); +} + +// A simple utility to set the build status on Github for a commit. +def setBuildStatus(Map paramsMap) +{ + // Extract arguments from the map. + def result = paramsMap.result; + def context = paramsMap.context; + def successMessage = paramsMap.successMessage; + def unstableMessage = paramsMap.unstableMessage; + def failureMessage = paramsMap.failureMessage; + + def message = "(unknown Jenkins build result)"; + def state = "FAILURE"; + if (result == "FAILURE") + { + message = failureMessage; + } + else if (result == "UNSTABLE") + { + message = unstableMessage; + state = "UNSTABLE"; + } + else if (result == "SUCCESS") + { + message = successMessage; + state = "SUCCESS"; + } + else if (result == "ABORTED") + { + message = "Job aborted."; + state = "ERROR"; + } + + step([ + $class: "GitHubCommitStatusSetter", + reposSource: [$class: "ManuallyEnteredRepositorySource", + url: "https://github.com/mlpack/mlpack"], + contextSource: [$class: "ManuallyEnteredCommitContextSource", + context: context ], + errorHandlers: [[$class: "ChangingBuildStatusErrorHandler", + result: "UNSTABLE"]], + statusResultSource: [$class: "ConditionalStatusResultSource", + results: [[$class: "AnyBuildResult", + message: message, + state: state]]] + ]); +} + +return this diff --git a/CMakeLists.txt b/CMakeLists.txt index 6fd58ea197..a12fed469d 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -208,8 +208,10 @@ if (CMAKE_BUILD_TYPE STREQUAL "Debug" OR DEBUG) endif() # mlpack uses it's own mlpack::backtrace class based on Binary File Descriptor - # and linux Dynamic Loader and more portable version in future - if (CMAKE_SYSTEM_NAME STREQUAL "Linux") + # and linux Dynamic Loader and more portable version in + # future. However, if we are cross-compiling, we cannot run the CMake tests + # for LibDL and BFD. + if (CMAKE_SYSTEM_NAME STREQUAL "Linux" AND NOT CMAKE_CROSSCOMPILING) find_package(Bfd) find_package(LibDL) if (LIBBFD_FOUND AND LIBDL_FOUND) diff --git a/doc/developer/ci.md b/doc/developer/ci.md index b516442e93..4f8531b024 100644 --- a/doc/developer/ci.md +++ b/doc/developer/ci.md @@ -9,10 +9,10 @@ complex project, there are occasionally spurious failures or other unrelated problems. * [Basic compilation and test jobs](#basic-compilation-and-test-jobs) - * [Documentation build and test](#documentation-build-and-test) + * [Documentation builds](#documentation-builds) * [Style checks](#style-checks) * [Cross-compilation checks](#cross-compilation-checks) - * [Static code analysis checks](#static-code-analysis-checks) + * [Memory checks](#memory-checks) Also you can see the [list of CI infrastructure](#list-of-ci-infrastructure). @@ -67,10 +67,10 @@ Similarly, the binding tests are also run using a local Github action. can parse it, sometimes we have to do strange things for some languages, and we can't use CTest directly. -## Documentation build and test +## Documentation builds -The 'documentation build and test' job builds and tests *all* documentation, -checking: +The 'documentation link check' job and 'documentation snippet build' jobs build +and tests *all* documentation, checking: * that all Markdown pages build and render properly; * that all HTML is valid; @@ -78,7 +78,9 @@ checking: * that all code examples compile and run. All of the scripts to perform these builds are located in the `scripts/` -directory, so that they can be run locally. +directory, so that they can be run locally. On CI, these are defined as two +Jenkins jobs in `.jenkins/doc-link-check/Jenkinsfile` and +`.jenkins/doc-snippet-build/Jenkinsfile`. * `./scripts/build-docs.sh` - Builds all documentation in `doc/` with the output directory `doc/html/`. @@ -98,12 +100,14 @@ directory, so that they can be run locally. When writing new documentation, be sure to test it locally---going back and forth with the -[job on Jenkins](http://ci.mlpack.org/job/pull-request%20documentation%20build%20and%20test/) +[link checker job on Jenkins](http://ci.mlpack.org/job/mlpack%20documentation%20link%20check/) +and [snippet build job on Jenkins](http://ci.mlpack.org/job/mlpack%20documentation%20snippet%20build/) can be very tedious. ## Style checks -The [style checker job](http://ci.mlpack.org/job/pull-requests%20mlpack%20style%20checks/) runs on Jenkins. +The [style checker job](http://ci.mlpack.org/job/mlpack%20style%20checks/) runs +on Jenkins and is defined in `.jenkins/style-checks/Jenkinsfile`. * The [`lint.sh` script](https://github.com/mlpack/jenkins-conf/blob/master/linter/lint.sh) to check for C++ style issues. @@ -115,26 +119,41 @@ The [style checker job](http://ci.mlpack.org/job/pull-requests%20mlpack%20style% ## Cross-compilation checks -The [cross-compilation checks](http://ci.mlpack.org/job/CrossCompile-mlpack-for-embedded-aarch64/) -run on Jenkins. +The [cross-compilation checks](http://ci.mlpack.org/job/mlpack%20cross-compile%20tests/) +run on Jenkins and test cross-compilation of mlpack to a number of low-resource +and embedded devices. The job is defined in +`.jenkins/cross-compilation/Jenkinsfile`. * The job builds mlpack in a - [cross-compilation environment](../embedded/supported_boards.md). + [cross-compilation environment](../embedded/supported_boards.md), targeting a + number of architectures, and then running tests on actual embedded hardware. * Any failures seen here *that are not seen in other jobs* will probably be failures specific to the cross-compilation environment. -## Static code analysis checks + * For the list of targeted devices, see the + [list of CI infrastructure](#list-of-ci-infrastructure). -The [static code analysis checks](http://ci.mlpack.org/job/pull-requests-mlpack-static-code-analysis/) -use a few C++ code analysis tools to try and report issues with the codebase. +## Memory checks -Currently, most of the output by this job is not actionable---there are too many -false positives or spurious issues---and therefore should be used only as -informational output. +The [memory checks](http://ci.mlpack.org/job/mlpack%20memory%20checks/) run +valgrind on any tests that were detected to be changed. This detection is +performed via a heuristic and may not always be correct. The job is defined in +`.jenkins/memory-checks/Jenkinsfile`. -Configuration can be found in the -[`jenkins-conf` repository](https://github.com/mlpack/jenkins-conf). + * The [`parse-test.py` script](https://github.com/mlpack/jenkins-conf/blob/master/memory/parse-tests.py) + is used to find tests that are affected by the changes. + + * The [`memory-check.sh` script](https://github.com/mlpack/jenkins-conf/blob/master/memory/memory-check.sh) + is used to actually run the tests. + +If there are any memory issues with the code, this should be reported by a +failed memory check job. If you encounter one of these, try compiling with +debugging symbols and running valgrind on the affected test, like this: + +``` +valgrind --leak-check=full --track-origins=yes bin/mlpack_test "TestName" +``` ## List of CI infrastructure @@ -155,3 +174,9 @@ Link: [***Jenkins (`ci.mlpack.org`)***](http://ci.mlpack.org) maintainer to make changes, or if you are on the Contributors team but still don't have access, ask somewhere and someone will give you access. (Probably `#mlpack:matrix.org` is the best bet!) + + * A number of embedded devices are available to Jenkins and are used in the + cross-compilation job. Each system is named after a main ingredient in a + good meal eaten just before receiving the embedded device. + - `couscous.ratml.org`: [Raspberry Pi 5](https://datasheets.raspberrypi.com/rpi5/raspberry-pi-5-product-brief.pdf), + 4GB RAM, 4-core ARM Cortex-A76 diff --git a/doc/embedded/supported_boards.md b/doc/embedded/supported_boards.md index a59f2fe5f0..03ceb325b1 100644 --- a/doc/embedded/supported_boards.md +++ b/doc/embedded/supported_boards.md @@ -132,8 +132,8 @@ the new architecture added to this table. ### CORTEXA76 ``` --DTOOLCHAIN_PREFIX=/path/to/bootlin/toolchain/aarch64--glibc--stable-2024.02-1/bin/aarch64-buildroot-linux-gnueabihf- --DCMAKE_SYSROOT=/path/to/bootlin/toolchain/aarch64--glibc--stable-2024.02-1/aarch64-buildroot-linux-gnueabihf/sysroot +-DTOOLCHAIN_PREFIX=/path/to/bootlin/toolchain/aarch64--glibc--stable-2024.02-1/bin/aarch64-buildroot-linux-gnu- +-DCMAKE_SYSROOT=/path/to/bootlin/toolchain/aarch64--glibc--stable-2024.02-1/aarch64-buildroot-linux-gnu/sysroot ``` ### C906 diff --git a/doc/user/core/trees/rectangle_tree.md b/doc/user/core/trees/rectangle_tree.md index ba8d5a446a..882290dda3 100644 --- a/doc/user/core/trees/rectangle_tree.md +++ b/doc/user/core/trees/rectangle_tree.md @@ -560,7 +560,7 @@ For implementation details, see The `XTreeSplit` class implements the improved splitting strategy for the [`XTree`](x_tree.md) as described in the -[X-tree paper (pdf)](http://www.vldb.org/conf/1996/P028.PDF). This strategy is +[X-tree paper (pdf)](https://www.vldb.org/conf/1996/P028.PDF). This strategy is an improved version of the standard [`RTreeSplit`](#rtreesplit), where the overlap of sibling nodes is minimized. diff --git a/src/mlpack/tests/ann/convolutional_network_test.cpp b/src/mlpack/tests/ann/convolutional_network_test.cpp index 06ee7cdc1e..189fd597fd 100644 --- a/src/mlpack/tests/ann/convolutional_network_test.cpp +++ b/src/mlpack/tests/ann/convolutional_network_test.cpp @@ -72,6 +72,8 @@ TEST_CASE("PaddingTest", "[ConvolutionalNetworktest]") { arma::mat X; X.load("mnist_first250_training_4s_and_9s.csv"); + // Make sure the data loaded okay. + REQUIRE(!X.is_empty()); // Create the network. FFN model; @@ -149,6 +151,8 @@ TEST_CASE("VanillaNetworkTest", "[ConvolutionalNetworkTest]") { arma::mat X; X.load("mnist_first250_training_4s_and_9s.csv"); + // Make sure the data loaded okay. + REQUIRE(!X.is_empty()); // Normalize each point since these are images. arma::uword nPoints = X.n_cols; @@ -265,6 +269,8 @@ TEST_CASE("VanillaNetworkBatchSizeTest", "[ConvolutionalNetworkTest]") arma::mat X; X.load("mnist_first250_training_4s_and_9s.csv"); + // Make sure the data loaded okay. + REQUIRE(!X.is_empty()); // Normalize each point since these are images. arma::uword nPoints = X.n_cols; @@ -348,6 +354,8 @@ TEST_CASE("CheckCopyVanillaNetworkTest", "[ConvolutionalNetworkTest]") { arma::mat X; X.load("mnist_first250_training_4s_and_9s.csv"); + // Make sure the data loaded okay. + REQUIRE(!X.is_empty()); // Normalize each point since these are images. arma::uword nPoints = X.n_cols; diff --git a/src/mlpack/tests/ann/feedforward_network_test.cpp b/src/mlpack/tests/ann/feedforward_network_test.cpp index 4f349b2bfa..0a21376cfc 100644 --- a/src/mlpack/tests/ann/feedforward_network_test.cpp +++ b/src/mlpack/tests/ann/feedforward_network_test.cpp @@ -401,6 +401,8 @@ TEST_CASE("FFVanillaNetworkTest", "[FeedForwardNetworkTest]") arma::mat dataset; dataset.load("mnist_first250_training_4s_and_9s.csv"); + // Make sure the data loaded okay. + REQUIRE(!dataset.is_empty()); // Normalize each point since these are images. for (size_t i = 0; i < dataset.n_cols; ++i) @@ -422,6 +424,8 @@ TEST_CASE("ForwardBackwardTest", "[FeedForwardNetworkTest]") { arma::mat dataset; dataset.load("mnist_first250_training_4s_and_9s.csv"); + // Make sure the data loaded okay. + REQUIRE(!dataset.is_empty()); // Normalize each point since these are images. for (size_t i = 0; i < dataset.n_cols; ++i) @@ -549,6 +553,8 @@ TEST_CASE("DropoutNetworkTest", "[FeedForwardNetworkTest]") TestNetwork<>(model, trainData, trainLabels, testData, testLabels, 10, 0.1); arma::mat dataset; dataset.load("mnist_first250_training_4s_and_9s.csv"); + // Make sure the data loaded okay. + REQUIRE(!dataset.is_empty()); // Normalize each point since these are images. for (size_t i = 0; i < dataset.n_cols; ++i) @@ -628,6 +634,8 @@ TEST_CASE("DropConnectNetworkTest", "[FeedForwardNetworkTest]") arma::mat dataset; dataset.load("mnist_first250_training_4s_and_9s.csv"); + // Make sure the data loaded okay. + REQUIRE(!dataset.is_empty()); // Normalize each point since these are images. for (size_t i = 0; i < dataset.n_cols; ++i) @@ -953,6 +961,8 @@ TEST_CASE("RBFNetworkTest", "[FeedForwardNetworkTest]") arma::mat dataset; dataset.load("mnist_first250_training_4s_and_9s.csv"); + // Make sure the data loaded okay. + REQUIRE(!dataset.is_empty()); // Normalize each point since these are images. for (size_t i = 0; i < dataset.n_cols; ++i) diff --git a/src/mlpack/tests/catch.hpp b/src/mlpack/tests/catch.hpp index 7c48e8e39f..d8a7532854 100644 --- a/src/mlpack/tests/catch.hpp +++ b/src/mlpack/tests/catch.hpp @@ -16862,7 +16862,7 @@ namespace Catch { xml( _config.stream() ) { m_reporterPrefs.shouldRedirectStdOut = true; - m_reporterPrefs.shouldReportAllAssertions = true; + m_reporterPrefs.shouldReportAllAssertions = false; } JunitReporter::~JunitReporter() {}