From c1629dda8117df9e074e31d1ab9be039ab7ca755 Mon Sep 17 00:00:00 2001 From: Kyle Isom Date: Sat, 21 Oct 2023 20:19:03 -0700 Subject: [PATCH] Update build scripts, add valgrind support. --- build-all-containers.sh | 4 +++- build-container.sh | 9 ++++++--- cmake-build-and-test.sh | 4 +++- cmake-run-valgrind.sh | 22 ++++++++++++++++++++++ install-cmake-debian.sh | 4 ++-- install-development-tools.sh | 8 +++++--- is-current-tag.sh | 0 7 files changed, 41 insertions(+), 10 deletions(-) create mode 100755 cmake-run-valgrind.sh mode change 100644 => 100755 is-current-tag.sh diff --git a/build-all-containers.sh b/build-all-containers.sh index dc8583b..2b1336c 100755 --- a/build-all-containers.sh +++ b/build-all-containers.sh @@ -1,5 +1,7 @@ #!/usr/bin/env bash +set -eu + ###################################################################### # @author : kyle (kyle@imap.cc) # @file : build-all-containers.sh @@ -14,6 +16,6 @@ for container_file in Containerfile.* do flavor="${container_file#Containerfile.}" - ./build-container.sh Container.${flavor} sc/dev:${flavor} + ./build-container.sh Containerfile.${flavor} sc/dev:${flavor} done diff --git a/build-container.sh b/build-container.sh index cd45bdd..86bfc8f 100755 --- a/build-container.sh +++ b/build-container.sh @@ -14,6 +14,9 @@ CONTAINERFILE="${1}" IMAGE_NAME="git.wntrmute.dev/${2}" podman build -t ${IMAGE_NAME} -f ${CONTAINERFILE} -podman push ${IMAGE_NAME} -podman container prune --force -podman image prune --force +if [ "${BUILD_NO_PUSH:-no}" != "yes" ] +then + podman push ${IMAGE_NAME} + #podman container prune --force + #podman image prune --force +fi diff --git a/cmake-build-and-test.sh b/cmake-build-and-test.sh index 1beb8f8..af36fdc 100755 --- a/cmake-build-and-test.sh +++ b/cmake-build-and-test.sh @@ -10,6 +10,8 @@ set -eux +BUILD_TYPE="${BUILD_TYPE:-Debug}" + if [ "${USE_CLANG:-}" == "yes" ] then export CC=$(command -v clang) @@ -17,4 +19,4 @@ then fi mkdir -p build && cd build -cmake -DCMAKE_BUILD_TYPE=RelWithDebInfo .. && make all test && ctest +cmake -DCMAKE_BUILD_TYPE=${BUILD_TYPE} .. && make all test diff --git a/cmake-run-valgrind.sh b/cmake-run-valgrind.sh new file mode 100755 index 0000000..2a8d98e --- /dev/null +++ b/cmake-run-valgrind.sh @@ -0,0 +1,22 @@ +#!/bin/sh + +set -eux + +if [ ! -d build ] +then + echo "[!] build step not completed!" > /dev/stderr + exit 1 +fi + +cd build + +for testbin in test_* +do + if [ ! -x ${testbin} ] + then + echo "[-] skipping ${testbin} because it isn't executable" + continue + fi + + valgrind -q ./${testbin} -n -q +done diff --git a/install-cmake-debian.sh b/install-cmake-debian.sh index 3822e10..a3d45f1 100755 --- a/install-cmake-debian.sh +++ b/install-cmake-debian.sh @@ -3,9 +3,9 @@ set -eu -source /etc/lsb-release SUDO="sudo" USE_CMAKE_RC="${USE_CMAKE_RC:-}" +DISTRIB=${DISTRIB:-jammy} preinstall () { echo "[+] preparing to install" @@ -25,7 +25,7 @@ do_install () { wget -O - https://apt.kitware.com/keys/kitware-archive-latest.asc 2>/dev/null | gpg --dearmor - | $SUDO tee /usr/share/keyrings/kitware-archive-keyring.gpg >/dev/null echo "[+] adding repo to sources.list.d" - echo "deb [signed-by=/usr/share/keyrings/kitware-archive-keyring.gpg] https://apt.kitware.com/ubuntu/ ${DISTRIB_CODENAME} main" | \ + echo "deb [signed-by=/usr/share/keyrings/kitware-archive-keyring.gpg] https://apt.kitware.com/ubuntu/ ${DISTRIB} main" | \ $SUDO tee /etc/apt/sources.list.d/kitware.list >/dev/null $SUDO apt-get -y update diff --git a/install-development-tools.sh b/install-development-tools.sh index 65508ce..e69f28b 100755 --- a/install-development-tools.sh +++ b/install-development-tools.sh @@ -54,7 +54,8 @@ install_debianesque () { fi echo "[+] installing tools" - sudo $SUDO apt-get $APTARGS install git clang scdoc python3-pip doxygen graphviz + sudo $SUDO apt-get $APTARGS install git clang scdoc \ + python3-pip doxygen graphviz valgrind } install_alpine () { @@ -68,7 +69,7 @@ install_alpine () { echo "[+] installing development tooling" $APK_ADD clang clang-extra-tools cmake cppcheck doxygen g++ git \ - graphviz make scdoc + graphviz make scdoc valgrind } install_redhat () { @@ -84,7 +85,8 @@ install_redhat () { # install everything in one shot. $DNF_INSTALL ca-certificates gzip openssh tar \ clang clang-tools-extra cmake cppcheck doxygen \ - gcc-c++ git graphviz libstdc++-devel make scdoc + gcc-c++ git graphviz libstdc++-devel make scdoc \ + valgrind } install_unsupported () { diff --git a/is-current-tag.sh b/is-current-tag.sh old mode 100644 new mode 100755