#!/bin/sh
# Copyright (C) 2026 David Nichols
# SPDX-License-Identifier: MIT
set -eu
unset QORE_MODULE_DIR QORE_MODULE_DIR_ONLY QORE_INCLUDE_DIR LD_LIBRARY_PATH LD_PRELOAD
# The copy has no ../qlib tree; all three modules must load from packages.
cp test/*.qtest "$AUTOPKGTEST_TMP/"
cd "$AUTOPKGTEST_TMP"
module_dir=$(/usr/bin/qore --module-path | tr : '\n' | while IFS= read -r path; do
    if [ -f "$path/FsEventPoller.qmod" ]; then printf '%s\n' "$path"; break; fi
done)
test -n "$module_dir"
for test in ./*.qtest; do
    timeout 180 /usr/bin/qore -l "$module_dir/FsEventPollerUtil.qmod" \
        -l "$module_dir/FsEventPoller.qmod" "$test" -v
done
