#!/bin/bash

set -euo pipefail

echo Testing with --free_memory
if ! ./ci/runners/cuda_memcheck.sh ./ci/runners/cuda_memory_leak --free_memory; then
  >&2 echo "Cuda memcheck exited unsuccessfully on binary that freed allocated memory!"
  exit 1
fi

echo Testing with --nofree_memory
if ./ci/runners/cuda_memcheck.sh ./ci/runners/cuda_memory_leak --nofree_memory; then
  >&2 echo "Cuda memcheck exited successfully on binary that did not free allocated memory!"
  exit 1
fi
