Skip to content

Commit d6f6ac1

Browse files
committed
tests: verify that halcompile installs files with correct permissions
JT reports on IRC that `halcompile --install` installs uspace realtime comps (which are .so files) with execute permissions enabled, which is wrong. This commit modifies some existing halcompile tests to verify that `halcompile --install` makes userspace (non-rt) comps executable, and rt comps (at least in uspace) non-executable. The second part of that currently fails, fixed in the following commit. (Note that our debs correctly have no execute bits set for the .so realtime comps.)
1 parent 44c1277 commit d6f6ac1

2 files changed

Lines changed: 35 additions & 0 deletions

File tree

tests/halcompile/personalities_mod/test.sh

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,29 @@
11
#!/bin/sh
2+
set -e
3+
24
DIR=../../../src/hal/components ;# use in-tree components
35
halcompile --personalities=2 --install $DIR/lincurve.comp
46
halcompile --personalities=2 --install $DIR/logic.comp
57
halcompile --personalities=2 --install $DIR/bitslice.comp
68

9+
# This tells us the expected filename extension ${MODULE_EXT} of realtime
10+
# modules.
11+
source "${EMC2_HOME}/scripts/rtapi.conf"
12+
13+
for INSTALLED_FILE in "${EMC2_HOME}"/rtlib/{lincurve,logic,bitslice}"${MODULE_EXT}"; do
14+
if [[ ! -f "${INSTALLED_FILE}" ]]; then
15+
echo "'halcompile --install' did not install '${INSTALLED_FILE}'"
16+
exit 1
17+
fi
18+
19+
MODE=$(stat --printf '%#03a\n' "${INSTALLED_FILE}")
20+
if [[ $((MODE & 0111)) != '0' ]]; then
21+
echo "installed file '${INSTALLED_FILE}' has incorrect permissions"
22+
echo "expected no execute bits, got ${MODE}"
23+
exit 1
24+
fi
25+
done
26+
727
for HAL in *.hal; do
828
echo "testing $HAL"
929
BASE=$(basename $HAL .hal)

tests/halcompile/userspace-count-names/test.sh

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,21 @@
11
#!/bin/sh
2+
set -e
3+
24
halcompile --install userspace_count_names.comp
35

6+
INSTALLED_FILE="${EMC2_HOME}/bin/userspace_count_names"
7+
if [[ ! -f "${INSTALLED_FILE}" ]]; then
8+
echo "'halcompile --install' did not install '${INSTALLED_FILE}'"
9+
exit 1
10+
fi
11+
12+
MODE=$(stat --printf '%#03a\n' "${INSTALLED_FILE}")
13+
if [[ $((MODE & 0111)) == '0' ]]; then
14+
echo "installed file '${INSTALLED_FILE}' has incorrect permissions"
15+
echo "expected *some* execute bit, got ${MODE}"
16+
exit 1
17+
fi
18+
419
for HAL in *.hal; do
520
echo "testing $HAL"
621
BASE=$(basename $HAL .hal)

0 commit comments

Comments
 (0)