Re: [LTP] [PATCH] Add ftrace-stress-test to LTP

Li Zefan
2010-09-02T01:03:18Z

>> --- /dev/null
>> +++ b/testcases/kernel/tracing/ftrace_stress_test/ftrace_kvercmp.c
>> @@ -0,0 +1,37 @@
>> +#include <unistd.h>
>> +#include <stdlib.h>
>> +#include <stdio.h>
>> +#include <string.h>
>> +#include <sys/utsname.h>
>> +
>> +int main(int argc, char **argv)
>> +{
>> + struct utsname uval;
>> + int k1, k2, k3;
>> + int a1, a2, a3;
>> + unsigned long r1, r2;
>> +
>> + if (argc != 4) {
>> + fprintf(stderr, "Wrong arguments!\n");
>> + return -1;
>> + }
>> +
>> + a1 = strtol(argv[1], NULL, 10);
>> + a2 = strtol(argv[2], NULL, 10);
>> + a3 = strtol(argv[3], NULL, 10);
>> +
>> + uname(&uval);
>> +
>> + sscanf(uval.release, "%d.%d.%d", &k1, &k2, &k3);
>> +
>> + r1 = (a1 << 16) + (a2 << 8) + a3;
>> + r2 = (k1 << 16) + (k2 << 8) + k3;
>> +
>> + if (r1 > r2)
>> + return 0;
>> + else if (r1 == r2)
>> + return 1;
>> + else
>> + return 2;
>> +}
>
> This application could be replaced with tst_kvercmp out of the box;
> there's no reason why another program needs to be created for this.
>

This stress test was not written for LTP originally, so I had to write
this ftrace_kvercmp.

But I do have a reason to keep this. That is, using tst_kvercmp will
make it harder to run this test without LTP.

Anyway I'll remove it.

------------------------------------------------------------------------------
This SF.net Dev2Dev email is sponsored by:

Show off your parallel programming skills.
Enter the Intel(R) Threading Challenge 2010.