<feed xmlns='http://www.w3.org/2005/Atom'>
<title>linux/tools/testing/selftests/rtc, branch for-next</title>
<subtitle>Mirror of https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/
</subtitle>
<id>https://git.shady.money/linux/atom?h=for-next</id>
<link rel='self' href='https://git.shady.money/linux/atom?h=for-next'/>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/'/>
<updated>2024-10-23T20:13:00Z</updated>
<entry>
<title>selftest: rtc: Add to check rtc alarm status for alarm related test</title>
<updated>2024-10-23T20:13:00Z</updated>
<author>
<name>Joseph Jang</name>
<email>jjang@nvidia.com</email>
</author>
<published>2024-10-21T03:22:13Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=2a027d6bb66002c8e50e974676f932b33c5fce10'/>
<id>urn:sha1:2a027d6bb66002c8e50e974676f932b33c5fce10</id>
<content type='text'>
In alarm_wkalm_set and alarm_wkalm_set_minute test, they use different
ioctl (RTC_ALM_SET/RTC_WKALM_SET) for alarm feature detection. They will
skip testing if RTC_ALM_SET/RTC_WKALM_SET ioctl returns an EINVAL error
code. This design may miss detecting real problems when the
efi.set_wakeup_time() return errors and then RTC_ALM_SET/RTC_WKALM_SET
ioctl returns an EINVAL error code with RTC_FEATURE_ALARM enabled.

In order to make rtctest more explicit and robust, we propose to use
RTC_PARAM_GET ioctl interface to check rtc alarm feature state before
running alarm related tests. If the kernel does not support RTC_PARAM_GET
ioctl interface, we will fallback to check the error number of
(RTC_ALM_SET/RTC_WKALM_SET) ioctl call for alarm feature detection.

Requires commit 101ca8d05913b ("rtc: efi: Enable SET/GET WAKEUP services
as optional")

Reviewed-by: Koba Ko &lt;kobak@nvidia.com&gt;
Reviewed-by: Matthew R. Ochs &lt;mochs@nvidia.com&gt;
Signed-off-by: Joseph Jang &lt;jjang@nvidia.com&gt;
Acked-by: Alexandre Belloni &lt;alexandre.belloni@bootlin.com&gt;
Signed-off-by: Shuah Khan &lt;skhan@linuxfoundation.org&gt;
</content>
</entry>
<entry>
<title>selftest: rtc: Check if could access /dev/rtc0 before testing</title>
<updated>2024-09-30T17:32:07Z</updated>
<author>
<name>Joseph Jang</name>
<email>jjang@nvidia.com</email>
</author>
<published>2024-05-24T01:38:07Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=1ad999870a86d58246b6a614a435d055a9edf269'/>
<id>urn:sha1:1ad999870a86d58246b6a614a435d055a9edf269</id>
<content type='text'>
The rtctest requires the read permission on /dev/rtc0. The rtctest will
be skipped if the /dev/rtc0 is not readable.

Reviewed-by: Koba Ko &lt;kobak@nvidia.com&gt;
Reviewed-by: Matthew R. Ochs &lt;mochs@nvidia.com&gt;
Signed-off-by: Joseph Jang &lt;jjang@nvidia.com&gt;
Acked-by: Alexandre Belloni &lt;alexandre.belloni@bootlin.com&gt;
Signed-off-by: Shuah Khan &lt;skhan@linuxfoundation.org&gt;
</content>
</entry>
<entry>
<title>selftests: harness: remove unneeded __constructor_order_last()</title>
<updated>2024-08-06T19:40:20Z</updated>
<author>
<name>Masahiro Yamada</name>
<email>masahiroy@kernel.org</email>
</author>
<published>2024-07-27T14:37:36Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=2a6b6c9a226279b4f6668450ddb21ae655558087'/>
<id>urn:sha1:2a6b6c9a226279b4f6668450ddb21ae655558087</id>
<content type='text'>
__constructor_order_last() is unneeded.

If __constructor_order_last() is not called on backward-order systems,
__constructor_order will remain 0 instead of being set to
_CONSTRUCTOR_ORDER_BACKWARD (= -1).

__LIST_APPEND() will still take the 'else' branch, so there is no
difference in the behavior.

Signed-off-by: Masahiro Yamada &lt;masahiroy@kernel.org&gt;
Signed-off-by: Shuah Khan &lt;skhan@linuxfoundation.org&gt;
</content>
</entry>
<entry>
<title>selftests: rtc: skip when RTC is not present</title>
<updated>2022-11-15T20:30:51Z</updated>
<author>
<name>Alexandre Belloni</name>
<email>alexandre.belloni@bootlin.com</email>
</author>
<published>2022-11-15T20:21:05Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=35eee9a363becb854109e35d568299bafc97c9d1'/>
<id>urn:sha1:35eee9a363becb854109e35d568299bafc97c9d1</id>
<content type='text'>
There is no point in failing the tests when RTC is not present.

Reported-by: Linux Kernel Functional Testing &lt;lkft@linaro.org&gt;
Signed-off-by: Alexandre Belloni &lt;alexandre.belloni@bootlin.com&gt;
Tested-by: Daniel Diaz &lt;daniel.diaz@linaro.org&gt;
Signed-off-by: Shuah Khan &lt;skhan@linuxfoundation.org&gt;
</content>
</entry>
<entry>
<title>selftests/rtc: continuously read RTC in a loop for 30s</title>
<updated>2022-02-26T00:00:51Z</updated>
<author>
<name>Mateusz Jończyk</name>
<email>mat.jonczyk@o2.pl</email>
</author>
<published>2022-02-19T07:27:13Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=2aaa36e95ea586ad23edfcc1d474e8b735a4d1c3'/>
<id>urn:sha1:2aaa36e95ea586ad23edfcc1d474e8b735a4d1c3</id>
<content type='text'>
Some problems with reading the RTC time may happen rarely, for example
while the RTC is updating. So read the RTC many times to catch these
problems. For example, a previous attempt for my
commit ea6fa4961aab ("rtc: mc146818-lib: fix RTC presence check")
was incorrect and would have triggered this selftest.

To avoid the risk of damaging the hardware, wait 11ms before consecutive
reads.

In rtc_time_to_timestamp I copied values manually instead of casting -
just to be on the safe side. The 11ms wait period was chosen so that it is
not a divisor of 1000ms.

Signed-off-by: Mateusz Jończyk &lt;mat.jonczyk@o2.pl&gt;
Cc: Alessandro Zummo &lt;a.zummo@towertech.it&gt;
Cc: Alexandre Belloni &lt;alexandre.belloni@bootlin.com&gt;
Cc: Shuah Khan &lt;shuah@kernel.org&gt;
Signed-off-by: Shuah Khan &lt;skhan@linuxfoundation.org&gt;
</content>
</entry>
<entry>
<title>selftests: rtc: Increase test timeout so that all tests run</title>
<updated>2022-01-25T20:16:01Z</updated>
<author>
<name>Nícolas F. R. A. Prado</name>
<email>nfraprado@collabora.com</email>
</author>
<published>2022-01-12T19:41:42Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=f034cc1301e7d83d4ec428dd6b8ffb57ca446efb'/>
<id>urn:sha1:f034cc1301e7d83d4ec428dd6b8ffb57ca446efb</id>
<content type='text'>
The timeout setting for the rtc kselftest is currently 90 seconds. This
setting is used by the kselftest runner to stop running a test if it
takes longer than the assigned value.

However, two of the test cases inside rtc set alarms. These alarms are
set to the next beginning of the minute, so each of these test cases may
take up to, in the worst case, 60 seconds.

In order to allow for all test cases in rtc to run, even in the worst
case, when using the kselftest runner, the timeout value should be
increased to at least 120. Set it to 180, so there's some additional
slack.

Correct operation can be tested by running the following command right
after the start of a minute (low second count), and checking that all
test cases run:

	./run_kselftest.sh -c rtc

Signed-off-by: Nícolas F. R. A. Prado &lt;nfraprado@collabora.com&gt;
Acked-by: Alexandre Belloni &lt;alexandre.belloni@bootlin.com&gt;
Signed-off-by: Shuah Khan &lt;skhan@linuxfoundation.org&gt;
</content>
</entry>
<entry>
<title>.gitignore: add SPDX License Identifier</title>
<updated>2020-03-25T10:50:48Z</updated>
<author>
<name>Masahiro Yamada</name>
<email>masahiroy@kernel.org</email>
</author>
<published>2020-03-03T13:35:59Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=d198b34f3855eee2571dda03eea75a09c7c31480'/>
<id>urn:sha1:d198b34f3855eee2571dda03eea75a09c7c31480</id>
<content type='text'>
Add SPDX License Identifier to all .gitignore files.

Signed-off-by: Masahiro Yamada &lt;masahiroy@kernel.org&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
</content>
</entry>
<entry>
<title>selftests: Install settings files to fix TIMEOUT failures</title>
<updated>2020-02-20T15:56:42Z</updated>
<author>
<name>Michael Ellerman</name>
<email>mpe@ellerman.id.au</email>
</author>
<published>2020-02-20T04:42:41Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=b9167c8078c3527de6da241c8a1a75a9224ed90a'/>
<id>urn:sha1:b9167c8078c3527de6da241c8a1a75a9224ed90a</id>
<content type='text'>
Commit 852c8cbf34d3 ("selftests/kselftest/runner.sh: Add 45 second
timeout per test") added a 45 second timeout for tests, and also added
a way for tests to customise the timeout via a settings file.

For example the ftrace tests take multiple minutes to run, so they
were given longer in commit b43e78f65b1d ("tracing/selftests: Turn off
timeout setting").

This works when the tests are run from the source tree. However if the
tests are installed with "make -C tools/testing/selftests install",
the settings files are not copied into the install directory. When the
tests are then run from the install directory the longer timeouts are
not applied and the tests timeout incorrectly.

So add the settings files to TEST_FILES of the appropriate Makefiles
to cause the settings files to be installed using the existing install
logic.

Fixes: 852c8cbf34d3 ("selftests/kselftest/runner.sh: Add 45 second timeout per test")
Signed-off-by: Michael Ellerman &lt;mpe@ellerman.id.au&gt;
Signed-off-by: Shuah Khan &lt;skhan@linuxfoundation.org&gt;
</content>
</entry>
<entry>
<title>selftests: use LDLIBS for libraries instead of LDFLAGS</title>
<updated>2020-02-13T20:14:34Z</updated>
<author>
<name>Dmitry Safonov</name>
<email>dima@arista.com</email>
</author>
<published>2020-02-12T14:00:40Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=3e8393630e928767aeb23f4744518de4ea5cc35a'/>
<id>urn:sha1:3e8393630e928767aeb23f4744518de4ea5cc35a</id>
<content type='text'>
While building selftests, the following errors were observed:
&gt; tools/testing/selftests/timens'
&gt; gcc -Wall -Werror -pthread  -lrt -ldl  timens.c  -o tools/testing/selftests/timens/timens
&gt; /usr/bin/ld: /tmp/ccGy5CST.o: in function `check_config_posix_timers':
&gt; timens.c:(.text+0x65a): undefined reference to `timer_create'
&gt; collect2: error: ld returned 1 exit status

Quoting commit 870f193d48c2 ("selftests: net: use LDLIBS instead of
LDFLAGS"):

The default Makefile rule looks like:

$(CC) $(CFLAGS) $(LDFLAGS) $@ $^ $(LDLIBS)

When linking is done by gcc itself, no issue, but when it needs to be passed
to proper ld, only LDLIBS follows and then ld cannot know what libs to link
with.

More detail:
https://www.gnu.org/software/make/manual/html_node/Implicit-Variables.html

LDFLAGS
Extra flags to give to compilers when they are supposed to invoke the linker,
‘ld’, such as -L. Libraries (-lfoo) should be added to the LDLIBS variable
instead.

LDLIBS
Library flags or names given to compilers when they are supposed to invoke the
linker, ‘ld’. LOADLIBES is a deprecated (but still supported) alternative to
LDLIBS. Non-library linker flags, such as -L, should go in the LDFLAGS
variable.

While at here, correct other selftests, not only timens ones.

Reported-by: Shuah Khan &lt;skhan@linuxfoundation.org&gt;
Signed-off-by: Dmitry Safonov &lt;dima@arista.com&gt;
Tested-by: Shuah Khan &lt;skhan@linuxfoundation.org&gt;
Signed-off-by: Shuah Khan &lt;skhan@linuxfoundation.org&gt;
</content>
</entry>
<entry>
<title>selftests/kselftest/runner.sh: Add 45 second timeout per test</title>
<updated>2019-10-01T19:33:28Z</updated>
<author>
<name>Kees Cook</name>
<email>keescook@chromium.org</email>
</author>
<published>2019-09-19T18:06:44Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=852c8cbf34d3b3130a05c38064dd98614f97d3a8'/>
<id>urn:sha1:852c8cbf34d3b3130a05c38064dd98614f97d3a8</id>
<content type='text'>
Commit a745f7af3cbd ("selftests/harness: Add 30 second timeout per
test") solves the problem of kselftest_harness.h-using binary tests
possibly hanging forever. However, scripts and other binaries can still
hang forever. This adds a global timeout to each test script run.

To make this configurable (e.g. as needed in the "rtc" test case),
include a new per-test-directory "settings" file (similar to "config")
that can contain kselftest-specific settings. The first recognized field
is "timeout".

Additionally, this splits the reporting for timeouts into a specific
"TIMEOUT" not-ok (and adds exit code reporting in the remaining case).

Signed-off-by: Kees Cook &lt;keescook@chromium.org&gt;
Signed-off-by: Shuah Khan &lt;skhan@linuxfoundation.org&gt;
</content>
</entry>
</feed>
