#!/usr/bin/bash

################################################################################
# Copyright (C) 2015-2025 NICE s.r.l.
# All Rights Reserved
#
# This software is the confidential and proprietary information
# of NICE s.r.l. ("Confidential Information").
# You shall not disclose such Confidential Information
# and shall use it only in accordance with the terms of
# the license agreement you entered into with NICE.
################################################################################

prefix=/usr
exec_prefix=/usr
libdir=/usr/lib64
libexecdir=/usr/libexec
dcvgltest_bin="${libexecdir}/dcv-gl/dcvgltest"

# Makes DCV GL print the version number on the console at program startup
export DCV_GL_PRINT_VERSION=1

# Makes DCV GL print NvIFR errors
export DCV_GL_PRINT_NVIFR_FAILURE=1

case "$1" in
    --gdb)
        shift
        export G_DEBUG=fatal-criticals
        gdb -ex run --args "${dcvgltest_bin}" "$@"
        _exit=$?
        ;;
    --valgrind)
        shift
        export G_DEBUG=resident-modules
        valgrind --tool=memcheck --leak-check=full --leak-resolution=high --num-callers=20 --log-file=vgdump "${dcvgltest_bin}" "$@"
        _exit=$?
        ;;
    *)
        "${dcvgltest_bin}" "$@"
        _exit=$?
        ;;
esac

exit ${_exit}

# --------------------------------------------------------------------------- #
# ex: set ts=4 sw=4 et syntax=sh :
# --------------------------------------------------------------------------- #
