#!/bin/bash # SPDX-License-Identifier: GPL-2.0-or-later # # Compile test builder. # # Call a meson/ninja build with all combinations of gcc/clang identifyied in # the path using compgen. Builds are left in tree, allowing incremental builds # on each call. source ./common.sh # Simple Cam builds against a libcamera BUILD directory... LIBCAMERA_BUILD=${1:-"$(builddir unit-tests)"} LIBCAMERA=$LIBCAMERA_BUILD/source/ SIMPLECAM=$(srcdir simple-cam) SIMPLECAM_REPO=https://git.libcamera.org/libcamera/simple-cam.git check_version $LIBCAMERA $ID echo "Build latest simple-cam for libcamera at version : " $(libcamera_version "$LIBCAMERA") #### Building and compiling function update_sources() { if [ ! -d $SIMPLECAM ]; then git clone https://git.libcamera.org/libcamera/simple-cam.git $SIMPLECAM fi echo Using: $LIBCAMERA_BUILD git -C $SIMPLECAM pull --ff-only } function build() { LIBCAMERA_UNINSTALLED=$(realpath -L $LIBCAMERA_BUILD/meson-uninstalled/) # Always build apps from clean BUILDDIR="$(builddir $ID)" rm -fr "$BUILDDIR" PKG_CONFIG_PATH=$LIBCAMERA_UNINSTALLED \ meson "$BUILDDIR" "$SIMPLECAM" \ -Db_sanitize=address,undefined ninja -C "$BUILDDIR" ret=$? return $ret } function run() { BUILDDIR="$(builddir $ID)" # libevent has a known memory leak. Its out of our control, Suppress it. echo "leak:event_new" > $BUILDDIR/leak-suppressions.txt LD_LIBRARY_PATH=$LIBCAMERA_BUILD/src/libcamera:$LIBCAMERA_BUILD/src/libcamera/base \ LSAN_OPTIONS=suppressions=$BUILDDIR/leak-suppressions.txt \ $BUILDDIR/simple-cam 2>&1 } logfile=$(log_filename $ID) update_sources > $logfile build >> $logfile pass_fail $? "build simple-cam:" run >> $logfile pass_fail $? "run simple-cam:" completed $ID