1 // SPDX-License-Identifier: MIT
3 * Copyright © 2020 Intel Corporation
6 /* Just a quick and causal check of the shmem_utils API */
8 static int igt_shmem_basic(void *ignored
)
10 u32 datum
= 0xdeadbeef, result
;
15 file
= shmem_create_from_data("mock", &datum
, sizeof(datum
));
20 err
= shmem_read(file
, 0, &result
, sizeof(result
));
24 if (result
!= datum
) {
25 pr_err("Incorrect read back from shmemfs: %x != %x\n",
32 err
= shmem_write(file
, 0, &result
, sizeof(result
));
36 map
= shmem_pin_map(file
);
43 pr_err("Incorrect read back via mmap of last write: %x != %x\n",
50 shmem_unpin_map(file
, map
);
56 int shmem_utils_mock_selftests(void)
58 static const struct i915_subtest tests
[] = {
59 SUBTEST(igt_shmem_basic
),
62 return i915_subtests(tests
, NULL
);