[LTP] [PATCH v6] Refactor aiocp using new LTP API

Cyril Hrubis chrubis@suse.cz
Wed Aug 10 12:37:34 CEST 2022


Hi!
The runtime changes do not unfortunatelly work as expected.

First of all we have to check for the runtime in the function that
prepares the file with a random data, since that is quite slow as well.
Since that is done from the test setup it actually runs in a separate
runtime window so I would do just:

diff --git a/testcases/kernel/io/ltp-aiodio/aiocp.c b/testcases/kernel/io/ltp-aiodio/aiocp.c
index 816407284..2b34d8bbe 100644
--- a/testcases/kernel/io/ltp-aiodio/aiocp.c
+++ b/testcases/kernel/io/ltp-aiodio/aiocp.c
@@ -66,6 +66,9 @@ static void fill_with_rand_data(int fd, long long size)
        srand(time(NULL));

        while (i < size) {
+               if (!tst_remaining_runtime())
+                       tst_brk(TCONF, "Out of runtime!");
+
                for (j = 0; j < bufsize; j++) {
                        buf[j] = (rand() % (upper - lower + 1)) + lower;
                        i++;


Also the rand() function is way to slow, it's almost 10x faster for
500MB buffer if you move the buffer intialization out of the loop, i.e.
initialize the buffer with random data once and then write it over and
over.

Then again we would have to check in the async_run() otherwise we will
keep pushing new read request over and over until the queue has
finished.

Lastly we silently skip the check and report PASS when we are out of
runtime, that's not nice. I would be inclined to report TCONF if we end
up out of time before we managed to check that the data was copied
correctly. That wouldn't provide people with a false security.

-- 
Cyril Hrubis
chrubis@suse.cz


More information about the ltp mailing list