]> git.ipfire.org Git - thirdparty/openembedded/openembedded-core-contrib.git/commit
io-uring-writev: add simple test for writting file with io_uring jansa/io_uring
authorMartin Jansa <martin.jansa@gmail.com>
Thu, 19 Oct 2023 11:11:11 +0000 (13:11 +0200)
committerMartin Jansa <martin.jansa@gmail.com>
Thu, 19 Oct 2023 11:45:53 +0000 (13:45 +0200)
commit38c813cffdf4931d16044bfe662880d63cbdcfa3
tree906173f8b4f91129cd02572e556482e156ac090a
parent4f84537670020a8d902248479efa9f062089c0d3
io-uring-writev: add simple test for writting file with io_uring

* pseudo doesn't support io_uring yet as shown after nodejs was upgraded
  and nodejs-native >= 20.3.0 with libuv >= 1.45.0 which has:
  https://github.com/libuv/libuv/pull/3952

* files created in do_install with nodejs-native aren't tracked by pseudo
  and will result in host-user-contamination QA issue or
  "KeyError: 'getpwuid(): uid not found" as documented in:
  https://github.com/shr-project/com.webos.app.minimal/commit/bd238047c8ce3cd085041d276613396b863213cf

* this is much simpler test for io_uring without the need to build whole
  nodejs-native, it's based on:
  https://unixism.net/2020/04/io-uring-by-example-part-1-introduction/
  just using writev instead of readv

* if it works fine, the file "test" will be tracked in pseudo database
  since the creation in ${D} like:
  core2-64-oe-linux/io-uring-writev/1.0 $ sqlite3 pseudo/files.db "select * from files"
  1|/OE/build/oe-core/tmp-glibc/work/core2-64-oe-linux/io-uring-writev/1.0/image|66305|48357743|0|0|16877|0|0
  2|/OE/build/oe-core/tmp-glibc/work/core2-64-oe-linux/io-uring-writev/1.0/image/test|66305|48316709|0|0|33188|0|0

  and it does in this case, because I haven't figured out how to call writev()
  without opening the fd of output file first where the openat() call gets
  intercepted by pseudo

  io-uring-writev/1.0 $ strace -v ./io-uring-writev test2 2>&1 | grep openat
  openat(AT_FDCWD, "/etc/ld.so.cache", O_RDONLY|O_CLOEXEC) = 3
  openat(AT_FDCWD, "/usr/lib64/libc.so.6", O_RDONLY|O_CLOEXEC) = 3
  openat(AT_FDCWD, "test2", O_WRONLY|O_CREAT, 0666) = 4

  while with libuv there was no openat() for the output files in strace

Signed-off-by: Martin Jansa <martin.jansa@gmail.com>
meta-selftest/recipes-test/io-uring/io-uring-writev.bb [new file with mode: 0644]
meta-selftest/recipes-test/io-uring/io-uring-writev/io-uring-writev.c [new file with mode: 0644]