summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorJames Mills <prologic@shortcircuit.net.au>2020-03-14 16:22:52 +1000
committerGitHub <noreply@github.com>2020-03-14 16:22:52 +1000
commitc999f89754072128d7efcf5581ad145ad8af5026 (patch)
tree804607e8819869d18960d44632934efc64038269 /tests
parente39469af22553ad4841d53c6d76570ce640ad7e1 (diff)
Migrate Tests from Travis CI to Github Workflows (#8331)
* Migrate Tests from Travis CI to Github Workflows * Use GHA path filters * Make a unit test fail * Run new cmocka based unit tests * Revert "Make a unit test fail" This reverts commit 15500c59e4d49cb478ef27289de0366a543815c5. * Make a cmocka unit test fail * Work around a bug in libbson-1.0 on Ubuntu 18.04 * Add DCMAKE_BUILD_TYPE=Debug to make dbengine tests pass * Upload LastTest.log to GHA Artifact storage * Revert "Make a cmocka unit test fail" This reverts commit 920f56a03d0479bec1a67dc8c242df189f702177. * Remove Artifacts Validation stage
Diffstat (limited to 'tests')
-rwxr-xr-xtests/run-unit-tests.sh39
1 files changed, 39 insertions, 0 deletions
diff --git a/tests/run-unit-tests.sh b/tests/run-unit-tests.sh
new file mode 100755
index 0000000000..70d618ad7e
--- /dev/null
+++ b/tests/run-unit-tests.sh
@@ -0,0 +1,39 @@
+#!/usr/bin/env bash
+#
+# Unit-testing script
+#
+# This script does the following:
+# 1. Check whether any files were modified that would necessitate unit testing (using the `TRAVIS_COMMIT_RANGE` environment variable).
+# 2. If there are no changed files that require unit testing, exit successfully.
+# 3. Otherwise, run all the unit tests.
+#
+# We do things this way because our unit testing takes a rather long
+# time (average 18-19 minutes as of the original creation of this script),
+# so skipping it when we don't actually need it can significantly speed
+# up the CI process.
+#
+# Copyright: SPDX-License-Identifier: GPL-3.0-or-later
+#
+# Author: Austin S. Hemmelgarn <austin@netdata.cloud>
+#
+# shellcheck disable=SC2230
+
+install_netdata() {
+ echo "Installing Netdata"
+ fakeroot ./netdata-installer.sh \
+ --install "$HOME" \
+ --dont-wait \
+ --dont-start-it \
+ --enable-plugin-nfacct \
+ --enable-plugin-freeipmi \
+ --disable-lto
+}
+
+c_unit_tests() {
+ echo "Running C code unit tests"
+ "$HOME"/netdata/usr/sbin/netdata -W unittest
+}
+
+install_netdata || exit 1
+
+c_unit_tests || exit 1