Function report

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

Source Code:lib\kunit\try-catch.c Create Date:2022-07-28 06:39:05
Last Modify:2020-03-12 14:18:49 Copyright©Brick
home page Tree
Annotation kernel can get tool activityDownload SCCTChinese

Name:kunit_try_catch_run

Proto:void kunit_try_catch_run(struct kunit_try_catch *try_catch, void *context)

Type:void

Parameter:

TypeParameterName
struct kunit_try_catch *try_catch
void *context
58  Lockdep needs to run a non-constant initializer for on-stack* completions - so we use the _ONSTACK() variant for those that* are on the kernel stack:(try_completion)
59  test = private: internal use only.
63  context = context
64  try_completion = try_completion
65  try_result = 0
66  task_struct = kthread_run - create and wake a thread.*@threadfn: the function to run until signal_pending(current).*@data: data ptr for @threadfn.*@namefmt: printf-style name for the thread.* Description: Convenient wrapper for kthread_create() followed by(kunit_generic_run_threadfn_adapter, try_catch, "kunit_try_catch_thread")
69  If IS_ERR(task_struct) Then
70  catch(context)
71  Return
74  time_remaining = wait_for_completion_timeout( & try_completion, kunit_test_timeout())
76  If time_remaining == 0 Then
77  kunit_err() - Prints an ERROR level message associated with @test.*@test: The test context object.*@fmt: A printk() style format string.* Prints an error level message.(test, "try timed out\n")
78  try_result = -ETIMEDOUT
81  exit_code = try_result
83  If Not exit_code Then Return
86  If exit_code == -EFAULT Then try_result = 0
88  Else if exit_code == -EINTR Then kunit_err() - Prints an ERROR level message associated with @test.*@test: The test context object.*@fmt: A printk() style format string.* Prints an error level message.(test, "wake_up_process() was never called\n")
90  Else if exit_code Then kunit_err() - Prints an ERROR level message associated with @test.*@test: The test context object.*@fmt: A printk() style format string.* Prints an error level message.(test, "Unknown error: %d\n", exit_code)
93  catch(context)
Caller
NameDescribe
kunit_test_try_catch_successful_try_no_catch
kunit_test_try_catch_unsuccessful_try_does_catch
kunit_run_case_catch_errorsPerforms all logic to run a test case. It also catches most errors that* occur in a test case and reports them as failures.