summaryrefslogtreecommitdiffstats
path: root/tests/run-unit-tests.sh
blob: 2527264df00dfe8f6d24504ae8c21d94eee35228 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
#!/usr/bin/env bash
#
# Copyright: 2020-2024 (c) Netdata Inc.
# SPDX-License-Identifier: GPL-3.0-or-later
#
# Author: Austin S. Hemmelgarn <austin@netdata.cloud>
#
# shellcheck disable=SC2230

install_netdata() {
  echo "Installing Netdata"

  NETDATA_CMAKE_OPTIONS="-DCMAKE_BUILD_TYPE=Debug -DENABLE_ADDRESS_SANITIZER=On" \
  fakeroot ./netdata-installer.sh \
    --install-prefix "$HOME" \
    --dont-wait \
    --dont-start-it \
    --disable-lto
}

c_unit_tests() {
  echo "Running C code unit tests"

  ASAN_OPTIONS=detect_leaks=0 \
  "$HOME"/netdata/usr/sbin/netdata -W unittest
}

install_netdata || exit 1

c_unit_tests || exit 1