#!/bin/sh
# Smoke test: run the installed canopenterm binary in plain (non-graphical)
# mode against a trivial script and check it produces the expected output.
# This exercises startup, argument parsing and the embedded interpreters
# without requiring a real CAN interface.
set -e

WORKDIR="${AUTOPKGTEST_TMP:-$(mktemp -d)}"
cd "$WORKDIR"

echo 'print("canopenterm-lua-ok")' > smoke.lua
echo 'print("canopenterm-py-ok")'  > smoke.py

echo "I: running Lua script"
canopenterm smoke.lua | grep -q "canopenterm-lua-ok"

echo "I: running Python script"
canopenterm smoke.py | grep -q "canopenterm-py-ok"

echo "I: running codb2json usage"
codb2json 2>&1 | grep -q "Usage: codb2json"

echo "PASS: canopenterm smoke test"
