#!/usr/bin/env -S bats --report-formatter junit --formatter tap -j 3
# -*-sh-*-

load ./common/test_helper_functions || exit 1
source ./common/functions || exit 1

if [ -s ./common/TEST_ENV ]; then
	source ./common/TEST_ENV
fi

setup() {
	check_rms
}

teardown() {
	rm -f add_cuda
}

@test "[dev-tools/cuda] run nvidia-smi" {
	run_serial_binary nvidia-smi
}

@test "[dev-tools/cuda] check for nvcc" {
	module load cuda nvhpc
	run_serial_binary nvcc --version
	module unload cuda nvhpc
}

@test "[dev-tools/cuda] build cuda example and run it" {
	module load cuda nvhpc
	nvcc add.cu -o add_cuda
	run_serial_binary ./add_cuda
	module unload cuda nvhpc
}
