linux-rtc.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/2] selftests: harness: refactor __constructor_order
@ 2024-05-17 11:45 Masahiro Yamada
  2024-05-17 11:45 ` [PATCH 1/2] selftests: harness: remove unneeded __constructor_order_last() Masahiro Yamada
  2024-05-17 21:27 ` [PATCH 0/2] selftests: harness: refactor __constructor_order Kees Cook
  0 siblings, 2 replies; 6+ messages in thread
From: Masahiro Yamada @ 2024-05-17 11:45 UTC (permalink / raw)
  To: Kees Cook, Andy Lutomirski, Will Drewry, linux-kselftest
  Cc: linux-kernel, Masahiro Yamada, Alexandre Belloni,
	Benjamin Tissoires, Christian Borntraeger, Claudio Imbrenda,
	David Hildenbrand, Janosch Frank, Jiri Kosina, Shuah Khan, bpf,
	kvm, linux-input, linux-rtc


This series refactors __constructor_order because
__constructor_order_last() is unneeded.

BTW, the comments in kselftest_harness.h was confusing to me.

As far as I tested, all arches executed constructors in the forward
order.

[test code]

  #include <stdio.h>

  static int x;

  static void __attribute__((constructor)) increment(void)
  {
           x += 1;
  }

  static void __attribute__((constructor)) multiply(void)
  {
          x *= 2;
  }

  int main(void)
  {
          printf("foo = %d\n", x);
          return 0;
  }

It should print 2 for forward order systems, 1 for reverse order systems.

I executed it on some archtes by using QEMU. I always got 2.



Masahiro Yamada (2):
  selftests: harness: remove unneeded __constructor_order_last()
  selftests: harness: rename __constructor_order for clarification

 .../drivers/s390x/uvdevice/test_uvdevice.c     |  6 ------
 tools/testing/selftests/hid/hid_bpf.c          |  6 ------
 tools/testing/selftests/kselftest_harness.h    | 18 ++++--------------
 tools/testing/selftests/rtc/rtctest.c          |  7 -------
 4 files changed, 4 insertions(+), 33 deletions(-)

-- 
2.40.1


^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2024-05-18 17:18 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-05-17 11:45 [PATCH 0/2] selftests: harness: refactor __constructor_order Masahiro Yamada
2024-05-17 11:45 ` [PATCH 1/2] selftests: harness: remove unneeded __constructor_order_last() Masahiro Yamada
2024-05-17 23:26   ` Kees Cook
2024-05-18  3:29     ` Masahiro Yamada
2024-05-18 17:18       ` Kees Cook
2024-05-17 21:27 ` [PATCH 0/2] selftests: harness: refactor __constructor_order Kees Cook

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).