forked from woqidaideshi/openruyi-autotest
Compare commits
1 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| bb8b024d56 |
+1
@@ -1,5 +1,6 @@
|
||||
summary: Compatibility test - LTP POSIX - pthread/pthread_mutex_trylock
|
||||
test: ./test.sh
|
||||
framework: beakerlib
|
||||
tag:
|
||||
- compatibility
|
||||
- posix
|
||||
|
||||
+70
@@ -7,6 +7,69 @@
|
||||
|
||||
IFACE_DIR="$LTP_BUILD_DIR/conformance/interfaces"
|
||||
|
||||
# BEGIN OPENRUYI FIX: local beakerlib cleanup
|
||||
#
|
||||
# Beakerlib rlCleanupAppend generates a separate cleanup script.
|
||||
# On this platform the generated environment attempts to restore
|
||||
# Bash's readonly BASH_VERSINFO variable, causing cleanup failure
|
||||
# and a subsequent segmentation fault.
|
||||
#
|
||||
# Keep cleanup commands in this process and execute them before
|
||||
# rlJournalEnd instead.
|
||||
declare -a __oru_cleanup_commands=()
|
||||
|
||||
rlCleanupAppend() {
|
||||
if (( $# != 1 )); then
|
||||
printf '%s\n' \
|
||||
"rlCleanupAppend compatibility wrapper expects one argument" \
|
||||
>&2
|
||||
return 1
|
||||
fi
|
||||
|
||||
__oru_cleanup_commands+=("$1")
|
||||
}
|
||||
|
||||
rlCleanupPrepend() {
|
||||
if (( $# != 1 )); then
|
||||
printf '%s\n' \
|
||||
"rlCleanupPrepend compatibility wrapper expects one argument" \
|
||||
>&2
|
||||
return 1
|
||||
fi
|
||||
|
||||
__oru_cleanup_commands=(
|
||||
"$1"
|
||||
"${__oru_cleanup_commands[@]}"
|
||||
)
|
||||
}
|
||||
|
||||
__oru_cleanup_run() {
|
||||
local cleanup_command
|
||||
local cleanup_status=0
|
||||
|
||||
for cleanup_command in \
|
||||
"${__oru_cleanup_commands[@]}"
|
||||
do
|
||||
eval "$cleanup_command" || cleanup_status=$?
|
||||
done
|
||||
|
||||
__oru_cleanup_commands=()
|
||||
|
||||
return "$cleanup_status"
|
||||
}
|
||||
|
||||
__oru_cleanup_on_exit() {
|
||||
local saved_status=$?
|
||||
|
||||
trap - EXIT
|
||||
__oru_cleanup_run || true
|
||||
|
||||
exit "$saved_status"
|
||||
}
|
||||
|
||||
trap __oru_cleanup_on_exit EXIT
|
||||
# END OPENRUYI FIX: local beakerlib cleanup
|
||||
|
||||
rlJournalStart
|
||||
rlPhaseStartSetup "Environment setup"
|
||||
ltpPosixSetup
|
||||
@@ -21,4 +84,11 @@ rlJournalStart
|
||||
rlPhaseEnd
|
||||
|
||||
rlJournalPrintText
|
||||
# Run registered cleanup commands in the current shell.
|
||||
# Clear the EXIT trap before Beakerlib closes the journal.
|
||||
if ! __oru_cleanup_run; then
|
||||
rlLogWarning \
|
||||
"One or more local cleanup commands failed"
|
||||
fi
|
||||
trap - EXIT
|
||||
rlJournalEnd
|
||||
Reference in New Issue
Block a user