~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

TOMOYO Linux Cross Reference
Linux/tools/testing/selftests/bpf/prog_tests/endian.c

Version: ~ [ linux-6.11.5 ] ~ [ linux-6.10.14 ] ~ [ linux-6.9.12 ] ~ [ linux-6.8.12 ] ~ [ linux-6.7.12 ] ~ [ linux-6.6.58 ] ~ [ linux-6.5.13 ] ~ [ linux-6.4.16 ] ~ [ linux-6.3.13 ] ~ [ linux-6.2.16 ] ~ [ linux-6.1.114 ] ~ [ linux-6.0.19 ] ~ [ linux-5.19.17 ] ~ [ linux-5.18.19 ] ~ [ linux-5.17.15 ] ~ [ linux-5.16.20 ] ~ [ linux-5.15.169 ] ~ [ linux-5.14.21 ] ~ [ linux-5.13.19 ] ~ [ linux-5.12.19 ] ~ [ linux-5.11.22 ] ~ [ linux-5.10.228 ] ~ [ linux-5.9.16 ] ~ [ linux-5.8.18 ] ~ [ linux-5.7.19 ] ~ [ linux-5.6.19 ] ~ [ linux-5.5.19 ] ~ [ linux-5.4.284 ] ~ [ linux-5.3.18 ] ~ [ linux-5.2.21 ] ~ [ linux-5.1.21 ] ~ [ linux-5.0.21 ] ~ [ linux-4.20.17 ] ~ [ linux-4.19.322 ] ~ [ linux-4.18.20 ] ~ [ linux-4.17.19 ] ~ [ linux-4.16.18 ] ~ [ linux-4.15.18 ] ~ [ linux-4.14.336 ] ~ [ linux-4.13.16 ] ~ [ linux-4.12.14 ] ~ [ linux-4.11.12 ] ~ [ linux-4.10.17 ] ~ [ linux-4.9.337 ] ~ [ linux-4.4.302 ] ~ [ linux-3.10.108 ] ~ [ linux-2.6.32.71 ] ~ [ linux-2.6.0 ] ~ [ linux-2.4.37.11 ] ~ [ unix-v6-master ] ~ [ ccs-tools-1.8.9 ] ~ [ policy-sample ] ~
Architecture: ~ [ i386 ] ~ [ alpha ] ~ [ m68k ] ~ [ mips ] ~ [ ppc ] ~ [ sparc ] ~ [ sparc64 ] ~

  1 // SPDX-License-Identifier: GPL-2.0
  2 /* Copyright (c) 2020 Facebook */
  3 
  4 #include <test_progs.h>
  5 #include "test_endian.skel.h"
  6 
  7 static int duration;
  8 
  9 #define IN16 0x1234
 10 #define IN32 0x12345678U
 11 #define IN64 0x123456789abcdef0ULL
 12 
 13 #define OUT16 0x3412
 14 #define OUT32 0x78563412U
 15 #define OUT64 0xf0debc9a78563412ULL
 16 
 17 void test_endian(void)
 18 {
 19         struct test_endian* skel;
 20         struct test_endian__bss *bss;
 21         int err;
 22 
 23         skel = test_endian__open_and_load();
 24         if (CHECK(!skel, "skel_open", "failed to open skeleton\n"))
 25                 return;
 26         bss = skel->bss;
 27 
 28         bss->in16 = IN16;
 29         bss->in32 = IN32;
 30         bss->in64 = IN64;
 31 
 32         err = test_endian__attach(skel);
 33         if (CHECK(err, "skel_attach", "skeleton attach failed: %d\n", err))
 34                 goto cleanup;
 35 
 36         usleep(1);
 37 
 38         CHECK(bss->out16 != OUT16, "out16", "got 0x%llx != exp 0x%llx\n",
 39               (__u64)bss->out16, (__u64)OUT16);
 40         CHECK(bss->out32 != OUT32, "out32", "got 0x%llx != exp 0x%llx\n",
 41               (__u64)bss->out32, (__u64)OUT32);
 42         CHECK(bss->out64 != OUT64, "out16", "got 0x%llx != exp 0x%llx\n",
 43               (__u64)bss->out64, (__u64)OUT64);
 44 
 45         CHECK(bss->const16 != OUT16, "const16", "got 0x%llx != exp 0x%llx\n",
 46               (__u64)bss->const16, (__u64)OUT16);
 47         CHECK(bss->const32 != OUT32, "const32", "got 0x%llx != exp 0x%llx\n",
 48               (__u64)bss->const32, (__u64)OUT32);
 49         CHECK(bss->const64 != OUT64, "const64", "got 0x%llx != exp 0x%llx\n",
 50               (__u64)bss->const64, (__u64)OUT64);
 51 cleanup:
 52         test_endian__destroy(skel);
 53 }
 54 

~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

kernel.org | git.kernel.org | LWN.net | Project Home | SVN repository | Mail admin

Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.

sflogo.php