#!/bin/sh # Smoke test the installed debugcc binaries. # # Measuring clocks needs access to the clock controller hardware via /dev/mem, # which is not available on a general purpose test machine, so only exercise # the code paths which run before /dev/mem is opened. set -e # Without a platform (neither -p nor a -debugcc argv[0]) the usage, # including the list of supported platforms, is printed on stderr. usage="$(debugcc 2>&1 >/dev/null)" echo "$usage" | grep -q '^available platforms:' platforms="$(echo "$usage" | sed -n 's/^available platforms: *//p')" test -n "$platforms" for platform in $platforms; do echo "I: testing platform $platform" # Upstream installs a -debugcc symlink for each platform and # d/rules links a manpage to each of them. test -x "/usr/bin/$platform-debugcc" test -e "/usr/share/man/man1/$platform-debugcc.1.gz" # Listing the clocks of a platform touches no hardware, and must give # the same result whichever way the platform is selected. "$platform-debugcc" -l > "$AUTOPKGTEST_TMP/argv0.list" debugcc -p "$platform" -l > "$AUTOPKGTEST_TMP/opt.list" test -s "$AUTOPKGTEST_TMP/argv0.list" diff -u "$AUTOPKGTEST_TMP/argv0.list" "$AUTOPKGTEST_TMP/opt.list" done # An unknown clock name is rejected before the hardware is opened. set -- $platforms ret=0 debugcc -p "$1" no-such-clock >/dev/null 2>&1 || ret=$? test "$ret" = 1 echo "I: smoke test passed"