Re: [LTP] ltp-aiodio.part1 scenario FAIL with "No such file or directory",

Garrett Cooper
2010-09-09T07:58:05Z

[-- Attachment #1: Type: text/plain, Size: 1193 bytes --]

On Thu, Sep 9, 2010 at 12:26 AM, Jacky.Malcles <Jacky.Malcles@bull.net> wrote:
> Hi Garet,
>
> ltp-aiodio.part1 scenario FAIL with "No such file or directory",
>
> i.e:
> [root@xena5 ltp]# tail -f ltpaiodio1.logfile
> AD138                          FAIL       1
> AD044                          FAIL       1
>
> -----------------------------------------------
> Total Tests: 214
> Total Failures: 214
>
> (it does not find the datas :  PIDs pb,)
> detail:
> <<<test_start>>>
> tag=AD209 stime=1283955400
> cmdline="time aiocp -b 512k -n 32 -f SYNC $TMPDIR/aiodio.$$/junkfile
> $TMPDIR/aiodio.$$/ff2"
> contacts=""
> analysis=exit
> <<<test_output>>>
> /aiodio.12206/junkfile: No such file or directory
>
> real    0m0.011s
> user    0m0.000s
> sys     0m0.000s
> <<<execution_status>>>
> initiation_status="ok"
> duration=0 termination_type=exited termination_id=1 corefile=no
> so,
>
> I suggest, if you agree, the attached change to the scenario,

Or the test tools could be fixed to honor $TMP (the best solution
would be to implement a -f option, but this is the quick and dirty
solution... a proper solution could come later).
Thanks,
-Garrett

[-- Attachment #2: fix-ltp-aiodio.diff --]
[-- Type: application/octet-stream, Size: 4539 bytes --]

diff --git a/testcases/kernel/io/ltp-aiodio/aiodio_sparse.c b/testcases/kernel/io/ltp-aiodio/aiodio_sparse.c
index c38e08d..a609987 100644
--- a/testcases/kernel/io/ltp-aiodio/aiodio_sparse.c
+++ b/testcases/kernel/io/ltp-aiodio/aiodio_sparse.c
@@ -36,6 +36,7 @@
#include <unistd.h>
#include <sys/mman.h>
#include <sys/wait.h>
+#include <limits.h>

#include <libaio.h>

@@ -393,10 +394,10 @@ long long scale_by_kmg(long long value, char scale)

int main(int argc, char **argv)
{
+ char filename[PATH_MAX];
int pid[NUM_CHILDREN];
int num_children = 1;
int i;
- char *filename = "/test/aiodio/file";
long alignment = 512;
int readsize = 65536;
int writesize = 65536;
@@ -407,8 +408,10 @@ int main(int argc, char **argv)
extern char *optarg;
extern int optind, optopt, opterr;

- printf("Begin aiodio_sparse tests...\n");
+ printf("Begin aiodio_sparse tests...\n");

+ snprintf(filename, sizeof(filename), "%s/aiodio/file",
+ getenv("TMP") ? getenv("TMP") : "/tmp");

while ((c = getopt(argc, argv, "dr:w:n:a:s:i:")) != -1) {
char *endp;
diff --git a/testcases/kernel/io/ltp-aiodio/dio_append.c b/testcases/kernel/io/ltp-aiodio/dio_append.c
index 1ec8a84..75ac1a3 100644
--- a/testcases/kernel/io/ltp-aiodio/dio_append.c
+++ b/testcases/kernel/io/ltp-aiodio/dio_append.c
@@ -39,6 +39,7 @@
#include <stdio.h>
#include <unistd.h>
#include <memory.h>
+#include <limits.h>
#define NUM_CHILDREN 8

@@ -123,12 +124,15 @@ void dio_append(char *filename)

int main(int argc, char **argv)
{
+ char filename[PATH_MAX];
int pid[NUM_CHILDREN];
int num_children = 1;
int i;
- char *filename = "/test/aiodio/file";

- printf("Begin dio_append test...\n");
+ snprintf(filename, sizeof(filename), "%s/aiodio/file",
+ getenv("TMP") ? getenv("TMP") : "/tmp");
+
+ printf("Begin dio_append test...\n");

for (i = 0; i < num_children; i++) {
if ((pid[i] = fork()) == 0) {
diff --git a/testcases/kernel/io/ltp-aiodio/dio_sparse.c b/testcases/kernel/io/ltp-aiodio/dio_sparse.c
index 1754b04..aae53af 100644
--- a/testcases/kernel/io/ltp-aiodio/dio_sparse.c
+++ b/testcases/kernel/io/ltp-aiodio/dio_sparse.c
@@ -36,6 +36,7 @@
#include <memory.h>
#include <sys/mman.h>
#include <sys/wait.h>
+#include <limits.h>

#include "test.h"

@@ -279,10 +280,10 @@ long long scale_by_kmg(long long value, char scale)

int main(int argc, char **argv)
{
+ char filename[PATH_MAX];
int pid[NUM_CHILDREN];
int num_children = 1;
int i;
- char *filename = "/test/aiodio/file";
long alignment = 512;
int readsize = 65536;
int writesize = 65536;
@@ -292,6 +293,9 @@ int main(int argc, char **argv)
extern char *optarg;
extern int optind, optopt, opterr;

+ snprintf(filename, sizeof(filename), "%s/aiodio/file",
+ getenv("TMP") ? getenv("TMP") : "/tmp");
+
while ((c = getopt(argc, argv, "dr:w:n:a:s:")) != -1) {
char *endp;
switch (c) {
diff --git a/testcases/kernel/io/ltp-aiodio/dio_truncate.c b/testcases/kernel/io/ltp-aiodio/dio_truncate.c
index cba3b11..37363ea 100644
--- a/testcases/kernel/io/ltp-aiodio/dio_truncate.c
+++ b/testcases/kernel/io/ltp-aiodio/dio_truncate.c
@@ -35,6 +35,7 @@
#include <unistd.h>
#include <memory.h>
#include <string.h>
+#include <limits.h>

#define NUM_CHILDREN 8

@@ -128,10 +129,13 @@ void dio_append(char *filename, int fill)

int main(int argc, char **argv)
{
+ char filename[PATH_MAX];
int pid[NUM_CHILDREN];
int num_children = 1;
int i;
- char *filename = "/test/aiodio/file";
+
+ snprintf(filename, sizeof(filename), "%s/aiodio/file",
+ getenv("TMP") ? getenv("TMP") : "/tmp");

for (i = 0; i < num_children; i++) {
if ((pid[i] = fork()) == 0) {
diff --git a/testcases/kernel/io/ltp-aiodio/dirty.c b/testcases/kernel/io/ltp-aiodio/dirty.c
index 1cff3ec..7a28b44 100644
--- a/testcases/kernel/io/ltp-aiodio/dirty.c
+++ b/testcases/kernel/io/ltp-aiodio/dirty.c
@@ -31,17 +31,20 @@
#include <memory.h>
#include <stdio.h>
#include <unistd.h>
+#include <limits.h>

int main()
{
int fd;
int i;
char buf[32*1024];
- char filename[1024];
+ char filename[PATH_MAX];

- printf("Starting dirty tests...\n");
+ printf("Starting dirty tests...\n");
+
+ snprintf(filename, sizeof(filename), "%s/aiodio/file.xx.%d",
+ getenv("TMP") ? getenv("TMP") : "/tmp", getpid());

- sprintf(filename, "/test/aiodio/file.xx.%d", getpid());
fd = open(filename, O_CREAT|O_WRONLY, 0666);

memset(buf, 0xaa, sizeof(buf));
@@ -50,5 +53,5 @@ int main()
fsync(fd);
close(fd);
unlink(filename);
- return 0;
+ return 0;
}

[-- Attachment #3: Type: text/plain, Size: 247 bytes --]

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

Show off your parallel programming skills.
Enter the Intel(R) Threading Challenge 2010.
http://p.sf.net/sfu/intel-thread-sfd

[-- Attachment #4: Type: text/plain, Size: 155 bytes --]