summaryrefslogtreecommitdiffstats
path: root/tests/run-unit-tests.sh
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2021-02-07 11:45:55 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2021-02-07 11:45:55 +0000
commita8220ab2d293bb7f4b014b79d16b2fb05090fa93 (patch)
tree77f0a30f016c0925cf7ee9292e644bba183c2774 /tests/run-unit-tests.sh
parentAdding upstream version 1.19.0. (diff)
downloadnetdata-a8220ab2d293bb7f4b014b79d16b2fb05090fa93.tar.xz
netdata-a8220ab2d293bb7f4b014b79d16b2fb05090fa93.zip
Adding upstream version 1.29.0.upstream/1.29.0
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'tests/run-unit-tests.sh')
-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 000000000..70d618ad7
--- /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