Skip to content

Commit

Permalink
Merge tag 'linux_kselftest-fixes-6.9-rc5' of git:https://git.kernel.org/pub…
Browse files Browse the repository at this point in the history
…/scm/linux/kernel/git/shuah/linux-kselftest

Pull kselftest fixes from Shuah Khan:
 "A fix to kselftest harness to prevent infinite loop triggered in an
  assert in FIXTURE_TEARDOWN and a fix to a problem seen in being able
  to stop subsystem-enable tests when sched events are being traced"

* tag 'linux_kselftest-fixes-6.9-rc5' of git:https://git.kernel.org/pub/scm/linux/kernel/git/shuah/linux-kselftest:
  selftests/harness: Prevent infinite loop due to Assert in FIXTURE_TEARDOWN
  selftests/ftrace: Limit length in subsystem-enable tests
  • Loading branch information
torvalds committed Apr 15, 2024
2 parents 0bbac3f + 72d7cb5 commit 3fdfcd9
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ echo 'sched:*' > set_event

yield

count=`cat trace | grep -v ^# | awk '{ print $5 }' | sort -u | wc -l`
count=`head -n 100 trace | grep -v ^# | awk '{ print $5 }' | sort -u | wc -l`
if [ $count -lt 3 ]; then
fail "at least fork, exec and exit events should be recorded"
fi
Expand All @@ -29,7 +29,7 @@ echo 1 > events/sched/enable

yield

count=`cat trace | grep -v ^# | awk '{ print $5 }' | sort -u | wc -l`
count=`head -n 100 trace | grep -v ^# | awk '{ print $5 }' | sort -u | wc -l`
if [ $count -lt 3 ]; then
fail "at least fork, exec and exit events should be recorded"
fi
Expand All @@ -40,7 +40,7 @@ echo 0 > events/sched/enable

yield

count=`cat trace | grep -v ^# | awk '{ print $5 }' | sort -u | wc -l`
count=`head -n 100 trace | grep -v ^# | awk '{ print $5 }' | sort -u | wc -l`
if [ $count -ne 0 ]; then
fail "any of scheduler events should not be recorded"
fi
Expand Down
5 changes: 4 additions & 1 deletion tools/testing/selftests/kselftest_harness.h
Original file line number Diff line number Diff line change
Expand Up @@ -383,6 +383,7 @@
FIXTURE_DATA(fixture_name) self; \
pid_t child = 1; \
int status = 0; \
bool jmp = false; \
memset(&self, 0, sizeof(FIXTURE_DATA(fixture_name))); \
if (setjmp(_metadata->env) == 0) { \
/* Use the same _metadata. */ \
Expand All @@ -399,8 +400,10 @@
_metadata->exit_code = KSFT_FAIL; \
} \
} \
else \
jmp = true; \
if (child == 0) { \
if (_metadata->setup_completed && !_metadata->teardown_parent) \
if (_metadata->setup_completed && !_metadata->teardown_parent && !jmp) \
fixture_name##_teardown(_metadata, &self, variant->data); \
_exit(0); \
} \
Expand Down

0 comments on commit 3fdfcd9

Please sign in to comment.