summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPeter Harris <pharris@opentext.com>2013-06-03 16:09:11 -0400
committerPeter Harris <pharris@opentext.com>2013-06-03 18:14:39 -0400
commit95f4712a5554f2b591b22a6395de31f095071913 (patch)
treef838b2e7100ba6f1525eb170b541c14dc485fba4
parent001281cfbf7e0f9bce202e628baffa23714e273c (diff)
Write results directly to results directory
If an installed xtest is run, the user does not normally have write access to the test directory. Writing intermediate files and results directly to the results directory avoids a number of spurious FAILs and UNRESOLVEDs. Reviewed-by: Jamey Sharp <jamey@minilop.net> Signed-off-by: Peter Harris <pharris@opentext.com>
-rw-r--r--xts5/Xlib16/XrmCombineFileDatabase.m16
-rw-r--r--xts5/Xlib16/XrmGetFileDatabase.m10
-rw-r--r--xts5/Xlib16/XrmPutFileDatabase.m2
-rw-r--r--xts5/Xlib17/XReadBitmapFile.m6
-rw-r--r--xts5/Xlib17/XWriteBitmapFile.m16
-rw-r--r--xts5/Xt9/XtAppAddInput.m12
-rw-r--r--xts5/Xt9/XtAppMainLoop.m4
-rw-r--r--xts5/Xt9/XtAppNextEvent.m4
-rw-r--r--xts5/Xt9/XtAppPeekEvent.m4
-rw-r--r--xts5/Xt9/XtAppPending.m8
-rw-r--r--xts5/Xt9/XtAppProcessEvent.m12
-rw-r--r--xts5/XtC/XtAddInput.m12
-rw-r--r--xts5/XtC/XtMainLoop.m4
-rw-r--r--xts5/XtC/XtNextEvent.m4
-rw-r--r--xts5/XtC/XtPeekEvent.m6
-rw-r--r--xts5/XtC/XtProcessEvent.m10
-rw-r--r--xts5/include/XtTest.h1
-rw-r--r--xts5/include/xtlibproto.h2
-rw-r--r--xts5/src/lib/Makefile.am1
-rw-r--r--xts5/src/lib/block.c14
-rw-r--r--xts5/src/lib/checkarea.c2
-rw-r--r--xts5/src/lib/dumpimage.c2
-rw-r--r--xts5/src/lib/outfile.c67
-rw-r--r--xts5/src/lib/savimage.c2
-rw-r--r--xts5/src/lib/verimage.c7
-rw-r--r--xts5/src/xim/linklocale.c4
-rw-r--r--xts5/src/xim/xim_save.c2
27 files changed, 154 insertions, 80 deletions
diff --git a/xts5/Xlib16/XrmCombineFileDatabase.m b/xts5/Xlib16/XrmCombineFileDatabase.m
index 5881ae49..b06d4712 100644
--- a/xts5/Xlib16/XrmCombineFileDatabase.m
+++ b/xts5/Xlib16/XrmCombineFileDatabase.m
@@ -150,13 +150,13 @@ shall merge the contents of a resource file into a database.
gfd_return = XrmGetStringDatabase(src_spec1);
tet_infoline("PREP: Add data to resource file");
- (void)XrmPutFileDatabase(gfd_return, file_name_good);
+ (void)XrmPutFileDatabase(gfd_return, outfile(file_name_good));
tet_infoline("PREP: Add to database");
(void)XrmPutLineResource(&dst_database_id, dst_spec);
tet_infoline("TEST: Call to XrmCombineFileDatabase merges resource file into database");
- XrmCombineFileDatabase(file_name_good, &dst_database_id, True);
+ XrmCombineFileDatabase(outfile(file_name_good), &dst_database_id, True);
XSync(display_arg, 0);
XSetErrorHandler(unexp_err);
@@ -234,13 +234,13 @@ the entry in target_db.
(void)XrmPutLineResource(&gfd_return, src_spec3);
tet_infoline("PREP: Add data to resource file");
- (void)XrmPutFileDatabase(gfd_return, file_name_good);
+ (void)XrmPutFileDatabase(gfd_return, outfile(file_name_good));
tet_infoline("PREP: Add to database");
(void)XrmPutLineResource(&dst_database_id, dst_spec);
tet_infoline("TEST: Entry in the file replaces the database entry");
- XrmCombineFileDatabase(file_name_good, &dst_database_id, True);
+ XrmCombineFileDatabase(outfile(file_name_good), &dst_database_id, True);
XSync(display_arg, 0);
XSetErrorHandler(unexp_err);
@@ -318,13 +318,13 @@ replace the entry in target_db.
(void)XrmPutLineResource(&gfd_return, src_spec3);
tet_infoline("PREP: Add data to resource file");
- (void)XrmPutFileDatabase(gfd_return, file_name_good);
+ (void)XrmPutFileDatabase(gfd_return, outfile(file_name_good));
tet_infoline("PREP: Add to database");
(void)XrmPutLineResource(&dst_database_id, dst_spec);
tet_infoline("TEST: Entry in the file does not replace the database entry");
- XrmCombineFileDatabase(file_name_good, &dst_database_id, False);
+ XrmCombineFileDatabase(outfile(file_name_good), &dst_database_id, False);
XSync(display_arg, 0);
XSetErrorHandler(unexp_err);
@@ -401,12 +401,12 @@ filename in it.
gfd_return = XrmGetStringDatabase(src_spec1);
(void)XrmPutLineResource(&gfd_return, src_spec2);
(void)XrmPutLineResource(&gfd_return, src_spec3);
- (void)XrmPutFileDatabase(gfd_return, file_name_good);
+ (void)XrmPutFileDatabase(gfd_return, outfile(file_name_good));
dst_database_id = NULL;
tet_infoline("TEST: When target_db is NULL a new database is created");
- XrmCombineFileDatabase(file_name_good, &dst_database_id, True);
+ XrmCombineFileDatabase(outfile(file_name_good), &dst_database_id, True);
XSync(display_arg, 0);
XSetErrorHandler(unexp_err);
diff --git a/xts5/Xlib16/XrmGetFileDatabase.m b/xts5/Xlib16/XrmGetFileDatabase.m
index 9b6a60af..1094a9f7 100644
--- a/xts5/Xlib16/XrmGetFileDatabase.m
+++ b/xts5/Xlib16/XrmGetFileDatabase.m
@@ -169,7 +169,7 @@ char tbuf[256], *tptr;
XrmDatabase rdb;
/* Create a test database file. */
- f = fopen(XGFD_TEST_FILE, "w");
+ f = fopen(outfile(XGFD_TEST_FILE), "w");
if (f==(FILE *)NULL) {
delete("fopen() call to write database failed");
return;
@@ -189,7 +189,7 @@ XrmDatabase rdb;
fclose(f);
/* Call xname to read the database. */
- filename = XGFD_TEST_FILE;
+ filename = outfile(XGFD_TEST_FILE);
rdb = XCALL;
/* Verify the database was non-NULL, and contained the test information. */
@@ -213,7 +213,7 @@ XrmDatabase rdb;
/* Remove test database file. */
#ifndef TESTING
- unlink(XGFD_TEST_FILE); /* Compiling with CFLOCAL=-DTESTING */
+ unlink(outfile(XGFD_TEST_FILE)); /* Compiling with CFLOCAL=-DTESTING */
/* allows inspection of the testfile */
#endif
@@ -258,7 +258,7 @@ int a,b;
char tbuf[256], *tptr;
XrmDatabase rdb;
- f = fopen(XGFD_TEST_FILE, "w");
+ f = fopen(outfile(XGFD_TEST_FILE), "w");
if (f==(FILE *)NULL) {
delete("fopen() call to write database failed");
return;
@@ -290,7 +290,7 @@ XrmDatabase rdb;
}
/* Call xname to read the database. */
- filename = XGFD_TEST_FILE;
+ filename = outfile(XGFD_TEST_FILE);
rdb = XCALL;
/* Verify the database was non-NULL, and contained the test information. */
diff --git a/xts5/Xlib16/XrmPutFileDatabase.m b/xts5/Xlib16/XrmPutFileDatabase.m
index 2a636cf7..795635ce 100644
--- a/xts5/Xlib16/XrmPutFileDatabase.m
+++ b/xts5/Xlib16/XrmPutFileDatabase.m
@@ -107,7 +107,7 @@ purpose. It is provided "as is" without express or implied warranty.
void
XrmDatabase database = (XrmDatabase)NULL;
-char *stored_db = "xpfd_file";
+const char *stored_db = outfile("xpfd_file");
>>SET startup rmstartup
>>INCLUDE rescommon.mc
>>EXTERN
diff --git a/xts5/Xlib17/XReadBitmapFile.m b/xts5/Xlib17/XReadBitmapFile.m
index ab20cd3f..a754eae7 100644
--- a/xts5/Xlib17/XReadBitmapFile.m
+++ b/xts5/Xlib17/XReadBitmapFile.m
@@ -102,7 +102,7 @@ int
Display *display = Dsp;
Drawable d = (Drawable)defwin(display);
-char *filename = xrbf_name;
+const char *filename = outfile(xrbf_name);
unsigned int *width_return = &width;
unsigned int *height_return = &height;
Pixmap *bitmap_return = &bitmap;
@@ -191,13 +191,13 @@ int elements;
static void
xrbf_b_start() {
tpstartup();
- xrbf_create(xrbf_name, xrbf_one, xrbf_n_one);
+ xrbf_create(outfile(xrbf_name), xrbf_one, xrbf_n_one);
}
static void
xrbf_b_end() {
- unlink(xrbf_name);
+ unlink(outfile(xrbf_name));
tpcleanup();
}
diff --git a/xts5/Xlib17/XWriteBitmapFile.m b/xts5/Xlib17/XWriteBitmapFile.m
index f784fea9..996d6a35 100644
--- a/xts5/Xlib17/XWriteBitmapFile.m
+++ b/xts5/Xlib17/XWriteBitmapFile.m
@@ -101,7 +101,7 @@ purpose. It is provided "as is" without express or implied warranty.
int
Display *display = Dsp;
-char *filename = xwbf_name;
+const char *filename = outfile(xwbf_name);
Pixmap bitmap = xwbf_bm;
unsigned int width = xwbf_width;
unsigned int height = xwbf_height;
@@ -141,7 +141,7 @@ xwbf_start()
(char*)xwbf_data, xwbf_width, xwbf_height);
regid(Dsp, (union regtypes *)&xwbf_bm, REG_PIXMAP);
- (void)unlink(xwbf_name);
+ (void)unlink(outfile(xwbf_name));
}
static void
@@ -189,7 +189,7 @@ Verify the bitmap was read back, and the details were correct.
/* Read back bitmap with XReadBitmapFile. */
ret=XReadBitmapFile(display, DefaultRootWindow(display),
- xwbf_name, &w_ret, &h_ret, &pm_ret, &x_h_ret, &y_h_ret);
+ outfile(xwbf_name), &w_ret, &h_ret, &pm_ret, &x_h_ret, &y_h_ret);
/* Verify the bitmap was read back, and the details were correct. */
if (ret != BitmapSuccess) {
@@ -265,7 +265,7 @@ Verify the bitmap was read back, and the details were correct.
/* Read back bitmap with XReadBitmapFile. */
ret=XReadBitmapFile(display, DefaultRootWindow(display),
- xwbf_name, &w_ret, &h_ret, &pm_ret, &x_h_ret, &y_h_ret);
+ outfile(xwbf_name), &w_ret, &h_ret, &pm_ret, &x_h_ret, &y_h_ret);
/* Verify the bitmap was read back, and the details were correct. */
if (ret != BitmapSuccess) {
@@ -322,7 +322,7 @@ int ret;
/* Create a suitable bitmap. */
/* Create an unwritable directory. */
- if(mkdir(XWBF_DIR, XWBF_MODE)) {
+ if(mkdir(outfile(XWBF_DIR), XWBF_MODE)) {
int en = errno;
delete("Could not create the test subdirectory.");
report("errno %d", en);
@@ -331,7 +331,7 @@ int ret;
CHECK;
/* Call xname to write the bitmap file. */
- filename = XWBF_FILE;
+ filename = outfile(XWBF_FILE);
ret = XCALL;
/* Verify that a BitmapOpenFailed error occurred. */
@@ -346,8 +346,8 @@ int ret;
CHECKPASS(2);
- unlink(XWBF_FILE);
- rmdir(XWBF_DIR);
+ unlink(outfile(XWBF_FILE));
+ rmdir(outfile(XWBF_DIR));
>>ASSERTION Bad B 1
When insufficient memory is allocated, then a call to xname returns
diff --git a/xts5/Xt9/XtAppAddInput.m b/xts5/Xt9/XtAppAddInput.m
index 160cfa29..75c140ba 100644
--- a/xts5/Xt9/XtAppAddInput.m
+++ b/xts5/Xt9/XtAppAddInput.m
@@ -127,12 +127,12 @@ when the file descriptor
.A source
has data to be read and return an identifier for it.
>>CODE
-char *data;
+const char *data;
int status;
pid_t pid2;
if (config.posix_system != 0) {
- data = "tapaddinp.dat";
+ data = outfile("tapaddinp.dat");
FORK(pid2);
avs_xt_hier("Tapaddinp1", "XtAppAddInput");
sprintf(ebuf, "PREP: Open file %s for read", data);
@@ -171,13 +171,13 @@ when the file descriptor
.A source
is ready for writing.
>>CODE
-char *data;
+const char *data;
int status;
pid_t pid2;
if (config.posix_system != 0) {
avs_xt_hier("Tapaddinp1", "XtAppAddInput");
- data = "tapaddinp.dat";
+ data = outfile("tapaddinp.dat");
FORK(pid2);
sprintf(ebuf, "PREP: Open file %s for write", data);
tet_infoline(ebuf);
@@ -235,13 +235,13 @@ to be passed to
.A proc
when it is invoked.
>>CODE
-char *data;
+const char *data;
int status;
pid_t pid2;
if (config.posix_system != 0) {
avs_xt_hier("Tapaddinp1", "XtAppAddInput");
- data = "tapaddinp.dat";
+ data = outfile("tapaddinp.dat");
FORK(pid2);
sprintf(ebuf, "PREP: Open file %s for read", data);
tet_infoline(ebuf);
diff --git a/xts5/Xt9/XtAppMainLoop.m b/xts5/Xt9/XtAppMainLoop.m
index f4ddb7d5..8183829b 100644
--- a/xts5/Xt9/XtAppMainLoop.m
+++ b/xts5/Xt9/XtAppMainLoop.m
@@ -278,11 +278,11 @@ void XtAppMainLoop(app_context)
while it is blocked to read an event from the queue the
designated input source callback procedure shall be called.
>>CODE
-char *data;
+const char *data;
int status;
pid_t pid2;
- data = "tapmnloop.dat";
+ data = outfile("tapmnloop.dat");
sprintf(ebuf, "PREP: Open file %s for read", data);
tet_infoline(ebuf);
if ((fid = (FILE *)fopen(data, "w+")) == NULL) {
diff --git a/xts5/Xt9/XtAppNextEvent.m b/xts5/Xt9/XtAppNextEvent.m
index 491b5d0b..2b255860 100644
--- a/xts5/Xt9/XtAppNextEvent.m
+++ b/xts5/Xt9/XtAppNextEvent.m
@@ -264,7 +264,7 @@ void XtAppNextEvent(app_context, event_return)
is blocked the designated callback procedure for the input source
shall be called.
>>CODE
-char *data;
+const char *data;
pid_t pid2;
int i;
int status, waited;
@@ -272,7 +272,7 @@ XEvent loop_event;
Display *display;
XtInputMask processing;
- data = "tapnxevnt.dat";
+ data = outfile("tapnxevnt.dat");
FORK(pid2);
avs_xt_hier("Tapnxevnt4", "XtAppNextEvent");
sprintf(ebuf, "PREP: Open file %s for read", data);
diff --git a/xts5/Xt9/XtAppPeekEvent.m b/xts5/Xt9/XtAppPeekEvent.m
index 6c67f5de..2ec21f0a 100644
--- a/xts5/Xt9/XtAppPeekEvent.m
+++ b/xts5/Xt9/XtAppPeekEvent.m
@@ -185,9 +185,9 @@ Display *display;
XtInputMask processing;
Boolean status;
int i;
-char *data;
+const char *data;
- data = "tappkevnt.dat";
+ data = outfile("tappkevnt.dat");
avs_xt_hier("Tappkevnt2", "XtAppPeekEvent");
tet_infoline("PREP: Register timeout");
XtAppAddTimeOut(app_ctext, AVSXTLOOPTIMEOUT, XtTMO_Proc, topLevel);
diff --git a/xts5/Xt9/XtAppPending.m b/xts5/Xt9/XtAppPending.m
index b05c4caa..430a06c8 100644
--- a/xts5/Xt9/XtAppPending.m
+++ b/xts5/Xt9/XtAppPending.m
@@ -222,9 +222,9 @@ XEvent loop_event;
Display *display;
XtInputMask processing;
int i;
-char *data;
+const char *data;
- data = "tappendng.dat";
+ data = outfile("tappendng.dat");
FORK(pid2);
avs_xt_hier("Tappendng1", "XtAppPending");
tet_infoline("PREP: Register timeout");
@@ -279,9 +279,9 @@ XEvent loop_event;
Display *display;
XtInputMask processing;
int i;
-char *data;
+const char *data;
- data = "tappendng.dat";
+ data = outfile("tappendng.dat");
FORK(pid2);
avs_xt_hier("Tappendng1", "XtAppPending");
tet_infoline("PREP: Register timeout");
diff --git a/xts5/Xt9/XtAppProcessEvent.m b/xts5/Xt9/XtAppProcessEvent.m
index edf9d560..1b206fd4 100644
--- a/xts5/Xt9/XtAppProcessEvent.m
+++ b/xts5/Xt9/XtAppProcessEvent.m
@@ -257,9 +257,9 @@ pid_t pid2;
int status;
Display *display;
XEvent loop_event;
-char *data;
+const char *data;
- data = "tapprcevt.dat";
+ data = outfile("tapprcevt.dat");
FORK(pid2);
avs_xt_hier("Tapprcevt1", "XtAppProcessEvent");
tet_infoline("PREP: Create a test labelw_msg widget");
@@ -302,10 +302,10 @@ pid_t pid2;
int status;
Display *display;
XEvent loop_event;
-char *data;
+const char *data;
int i;
- data = "tapprcevt.dat";
+ data = outfile("tapprcevt.dat");
FORK(pid2);
avs_xt_hier("Tapprcevt1", "XtAppProcessEvent");
tet_infoline("PREP: Create a test labelw_msg widget");
@@ -366,10 +366,10 @@ pid_t pid2;
int status;
Display *display;
XEvent loop_event;
-char *data;
+const char *data;
int i;
- data = "tapprcevt.dat";
+ data = outfile("tapprcevt.dat");
FORK(pid2);
avs_xt_hier("Tapprcevt1", "XtAppProcessEvent");
tet_infoline("PREP: Create a test labelw_msg widget");
diff --git a/xts5/XtC/XtAddInput.m b/xts5/XtC/XtAddInput.m
index 519c6827..6f81c696 100644
--- a/xts5/XtC/XtAddInput.m
+++ b/xts5/XtC/XtAddInput.m
@@ -135,7 +135,7 @@ the file descriptor
.A source
has data to be read and return an identifier for it.
>>CODE
-char *data;
+const char *data;
int status = 0;
pid_t pid2;
pid_t pid3;
@@ -145,7 +145,7 @@ if (config.posix_system != 0) {
FORK(pid3);
avs_set_event(1, 0);
avs_xt_hier_def("Taddinput1", "XtAddInput");
- data = "data1";
+ data = outfile("data1");
FORK(pid2);
sprintf(ebuf, "PREP: Open file %s for read", data);
tet_infoline(ebuf);
@@ -192,7 +192,7 @@ the procedure that will be called when the file descriptor
.A source
is ready for writing.
>>CODE
-char *data;
+const char *data;
int status = 0;
pid_t pid2;
pid_t pid3;
@@ -202,7 +202,7 @@ if (config.posix_system != 0) {
FORK(pid3);
avs_set_event(1, 0);
avs_xt_hier_def("Taddinput1", "XtAddInput");
- data = "data1";
+ data = outfile("data1");
FORK(pid2);
sprintf(ebuf, "PREP: Open file %s for write", data);
tet_infoline(ebuf);
@@ -268,7 +268,7 @@ to be passed to
.A proc
when it is invoked.
>>CODE
-char *data;
+const char *data;
int status = 0;
pid_t pid2;
pid_t pid3;
@@ -278,7 +278,7 @@ if (config.posix_system != 0) {
FORK(pid3);
avs_set_event(1, 0);
avs_xt_hier_def("Taddinput1", "XtAddInput");
- data = "data1";
+ data = outfile("data1");
FORK(pid2);
sprintf(ebuf, "PREP: Open file %s for read", data);
tet_infoline(ebuf);
diff --git a/xts5/XtC/XtMainLoop.m b/xts5/XtC/XtMainLoop.m
index cd155bf5..93316181 100644
--- a/xts5/XtC/XtMainLoop.m
+++ b/xts5/XtC/XtMainLoop.m
@@ -340,9 +340,9 @@ pid_t pid2;
int invoked = 0;
pid_t pid3;
int pstatus;
-char *data;
+const char *data;
- data = "data1";
+ data = outfile("data1");
FORK(pid3);
avs_xt_hier_def("Tmainloop1", "XtMainLoop");
tet_infoline("PREP: Create a test labelw_msg widget");
diff --git a/xts5/XtC/XtNextEvent.m b/xts5/XtC/XtNextEvent.m
index 490c2d29..8a173619 100644
--- a/xts5/XtC/XtNextEvent.m
+++ b/xts5/XtC/XtNextEvent.m
@@ -302,11 +302,11 @@ XtInputMask processing;
int i;
pid_t pid3;
int pstatus;
-char *data;
+const char *data;
FORK(pid3);
avs_xt_hier_def("Tnxtevnt3", "XtNextEvent");
- data = "data1";
+ data = outfile("data1");
sprintf(ebuf, "PREP: Open file %s for read", data);
tet_infoline(ebuf);
if ((fid = (FILE *)fopen(data, "w+")) == NULL) {
diff --git a/xts5/XtC/XtPeekEvent.m b/xts5/XtC/XtPeekEvent.m
index ec39a655..a5464b2d 100644
--- a/xts5/XtC/XtPeekEvent.m
+++ b/xts5/XtC/XtPeekEvent.m
@@ -131,10 +131,10 @@ void XtTMO4_Proc(client_data, id)
XtPointer client_data;
XtIntervalId *id;
{
-char *data;
+const char *data;
avs_set_event(1, 1);
- data = "data1";
+ data = outfile("data1");
sprintf(ebuf, "PREP: Open file %s for read", data);
tet_infoline(ebuf);
if ((fid = (FILE *)fopen(data, "w+")) == NULL) {
@@ -337,4 +337,4 @@ int pstatus;
else {
tet_result(TET_PASS);
}
- unlink("data1");
+ unlink(outfile("data1"));
diff --git a/xts5/XtC/XtProcessEvent.m b/xts5/XtC/XtProcessEvent.m
index 048ed682..ea427314 100644
--- a/xts5/XtC/XtProcessEvent.m
+++ b/xts5/XtC/XtProcessEvent.m
@@ -123,7 +123,7 @@ Boolean *continue_to_dispatch;
}
sprintf(ebuf, "PREP: Open file %s for read", data);
tet_infoline(ebuf);
- if ((fid = (FILE *)fopen(data, "w+")) == NULL) {
+ if ((fid = (FILE *)fopen(outfile(data), "w+")) == NULL) {
sprintf(ebuf, "ERROR: Could not open file %s", data);
tet_infoline(ebuf);
tet_result(TET_FAIL);
@@ -455,7 +455,7 @@ int pstatus;
avs_xt_hier_def("Tprocevnt1", "XtProcessEvent");
sprintf(ebuf, "PREP: Open file %s for read", data);
tet_infoline(ebuf);
- if ((fid = (FILE *)fopen(data, "w+")) == NULL) {
+ if ((fid = (FILE *)fopen(outfile(data), "w+")) == NULL) {
sprintf(ebuf, "ERROR: Could not open file %s", data);
tet_infoline(ebuf);
tet_result(TET_FAIL);
@@ -472,7 +472,7 @@ int pstatus;
display = XtDisplay(rowcolw);
XtProcessEvent(XtIMAlternateInput);
LKROF(pid2, AVSXTTIMEOUT-4);
- unlink(data);
+ unlink(outfile(data));
KROF3(pid3, pstatus, AVSXTTIMEOUT-2);
if (pstatus != 0) {
tet_infoline("ERROR: Test process exited abnormally");
@@ -528,7 +528,7 @@ int pstatus;
XtProcessEvent(XtIMAlternateInput|XtIMXEvent|XtIMTimer);
}
LKROF(pid2, AVSXTTIMEOUT-4);
- unlink(data);
+ unlink(outfile(data));
KROF3(pid3, pstatus, AVSXTTIMEOUT-2);
if (pstatus != 0) {
tet_infoline("ERROR: Test process exited abnormally");
@@ -592,7 +592,7 @@ int pstatus;
XtProcessEvent(XtIMAll);
}
LKROF(pid2, AVSXTTIMEOUT-4);
- unlink(data);
+ unlink(outfile(data));
KROF3(pid3, pstatus, AVSXTTIMEOUT-2);
if (pstatus != 0) {
tet_infoline("ERROR: Test process exited abnormally");
diff --git a/xts5/include/XtTest.h b/xts5/include/XtTest.h
index 0d4429f1..04047272 100644
--- a/xts5/include/XtTest.h
+++ b/xts5/include/XtTest.h
@@ -101,6 +101,7 @@ SOFTWARE.
#include <X11/Shell.h>
#include "XtTestProto.h"
+#include "xtestlib.h"
/*
* Options are all set into this structure.
diff --git a/xts5/include/xtlibproto.h b/xts5/include/xtlibproto.h
index 33bd1de4..62c1cefd 100644
--- a/xts5/include/xtlibproto.h
+++ b/xts5/include/xtlibproto.h
@@ -354,6 +354,7 @@ int xtest_putenv(char *envstr);
int curofwin(Display *display, Cursor cursor, Window window);
int defcur(Display *display, Window window);
int spriteiswin(Display *display, Window window);
+const char *outfile(const char *fn);
#else
@@ -593,6 +594,7 @@ int xtest_putenv();
int curofwin();
int defcur();
int spriteiswin();
+char *outfile();
#endif
diff --git a/xts5/src/lib/Makefile.am b/xts5/src/lib/Makefile.am
index ce68bd58..0f703788 100644
--- a/xts5/src/lib/Makefile.am
+++ b/xts5/src/lib/Makefile.am
@@ -57,6 +57,7 @@ libxtest_la_SOURCES = badcmap.c \
notmember.c\
opendisp.c\
openfonts.c\
+ outfile.c\
pattern.c\
pfcount.c\
pointer.c\
diff --git a/xts5/src/lib/block.c b/xts5/src/lib/block.c
index be2499f6..ea55aab9 100644
--- a/xts5/src/lib/block.c
+++ b/xts5/src/lib/block.c
@@ -186,14 +186,14 @@ Block_Info *info;
delete("Unsupported speedfactor value: %d", config.speedfactor);
return(-1);
}
- fp = fopen(block_file, "w");
+ fp = fopen(outfile(block_file), "w");
if (fp == (FILE *) NULL) {
delete("Could not create block file: %s", block_file);
return(-1);
}
if (setjmp(jumptohere)) {
delete("Timeout in block routine");
- unlink(block_file);
+ unlink(outfile(block_file));
return(-1);
}
parent_status = 1;
@@ -201,7 +201,7 @@ Block_Info *info;
/*
* try removing block file just in case it still exists...
*/
- unlink(block_file);
+ unlink(outfile(block_file));
/*
* check for problems in block_parent_proc
*/
@@ -273,7 +273,7 @@ block_child_proc()
if (display == NULL)
exit(CHILD_EXIT_ERROR);
sleep(CHILD_SLEEP_TIME);
- if (access(block_file, F_OK))
+ if (access(outfile(block_file), F_OK))
exit(CHILD_EXIT_NOBLOCKING);
if (gevent == NULL) {
int retval;
@@ -298,17 +298,17 @@ block_parent_proc()
alarm(0);
if (parent_status == -1)
return;
- if (access(block_file, F_OK)) {
+ if (access(outfile(block_file), F_OK)) {
delete("Block file mysteriously disappeared: %s", block_file);
parent_status = -1;
return;
}
- if (unlink(block_file)) {
+ if (unlink(outfile(block_file))) {
/*
* return value of unlink() does not always indicate
* whether or not the file was removed...pc
*/
- if (!access(block_file, F_OK)) {
+ if (!access(outfile(block_file), F_OK)) {
delete("Block file could not be removed: %s", block_file);
parent_status = -1;
return;
diff --git a/xts5/src/lib/checkarea.c b/xts5/src/lib/checkarea.c
index 81bcb345..edb53153 100644
--- a/xts5/src/lib/checkarea.c
+++ b/xts5/src/lib/checkarea.c
@@ -385,7 +385,7 @@ extern int Errnum;
/* Making up an error file should be a subroutine.. */
sprintf(name, "Err%04d.err", Errnum++);
report("See file %s for details", name);
- unlink(name);
+ unlink(outfile(name));
dumpimage(bad, name, (struct area *)0);
dumpimage(good, name, (struct area *)0);
diff --git a/xts5/src/lib/dumpimage.c b/xts5/src/lib/dumpimage.c
index a5ffdccb..bca9c86c 100644
--- a/xts5/src/lib/dumpimage.c
+++ b/xts5/src/lib/dumpimage.c
@@ -136,7 +136,7 @@ unsigned long count;
extern int tet_thistest;
static int lasttest;
- fp = fopen(name, (lasttest==tet_thistest)? "a": "w");
+ fp = fopen(outfile(name), (lasttest==tet_thistest)? "a": "w");
if (fp == NULL) {
report("Could not create image file %s", name);
return;
diff --git a/xts5/src/lib/outfile.c b/xts5/src/lib/outfile.c
new file mode 100644
index 00000000..bbaa502d
--- /dev/null
+++ b/xts5/src/lib/outfile.c
@@ -0,0 +1,67 @@
+/*
+Copyright (c) Open Text SA and/or Open Text ULC
+
+Permission is hereby granted, free of charge, to any person obtaining a copy of
+this software and associated documentation files (the "Software"), to deal in
+the Software without restriction, including without limitation the rights to
+use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
+of the Software, and to permit persons to whom the Software is furnished to do
+so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all
+copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+SOFTWARE.
+*/
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <libgen.h>
+#include <X11/Xlib.h>
+#include <X11/Xutil.h>
+#include "xtest.h"
+#include "xtestlib.h"
+
+/*
+ * outfile takes a bare filename and returns a path to that file in the results
+ * directory. The caller should not free the return value (it will be freed
+ * automatically when tpcleanup is called at the end of each test).
+ */
+const char *
+outfile(const char *fn)
+{
+ char *out;
+ const char *path;
+ char *resfile = getenv("TET_RESFILE");
+ if (!resfile)
+ return fn;
+
+ resfile = strdup(resfile);
+ if (!resfile)
+ return fn;
+
+ path = dirname(resfile);
+ out = malloc(strlen(path) + strlen(fn) + 2);
+ if (!out) {
+ out = (char *)fn;
+ goto done;
+ }
+ regid(NULL, (union regtypes *)&out, REG_MALLOC);
+
+ sprintf(out, "%s/%s", path, fn);
+
+done:
+ free(resfile);
+ return out;
+}
diff --git a/xts5/src/lib/savimage.c b/xts5/src/lib/savimage.c
index 50ec8e40..9a63e1cd 100644
--- a/xts5/src/lib/savimage.c
+++ b/xts5/src/lib/savimage.c
@@ -185,7 +185,7 @@ unsigned long pix1, pix2;
, x, y, pix1, pix2);
sprintf(name, "Err%04d.err", Errnum++);
report("See file %s for details", name);
- unlink(name);
+ unlink(outfile(name));
dumpimage(newim, name, (struct area *)0);
dumpimage(im, name, (struct area *)0);
XDestroyImage(newim);
diff --git a/xts5/src/lib/verimage.c b/xts5/src/lib/verimage.c
index 037ead37..2cbee150 100644
--- a/xts5/src/lib/verimage.c
+++ b/xts5/src/lib/verimage.c
@@ -199,6 +199,9 @@ extern int CurVinf;
if (fp)
fclose(fp);
fp = fopen(name, "r");
+ /* Image file may be generated. If not present, check outfile location: */
+ if (!fp)
+ fp = fopen(outfile(name), "r");
lasttest = tet_thistest;
lastvinf = CurVinf;
}
@@ -305,11 +308,11 @@ ok:
report("A total of %d out of %d pixels were bad", bad, good+bad);
sprintf(errfile, "Err%04d.err", Errnum);
- unlink(errfile);
+ unlink(outfile(errfile));
dumpimage(imp, errfile, ap);
newpos = ftell(fp);
- errfp = fopen(errfile, "a");
+ errfp = fopen(outfile(errfile), "a");
if (errfp == NULL) {
report("Could not open pixel error file %s", errfile);
} else {
diff --git a/xts5/src/xim/linklocale.c b/xts5/src/xim/linklocale.c
index 5b2fd728..f517da89 100644
--- a/xts5/src/xim/linklocale.c
+++ b/xts5/src/xim/linklocale.c
@@ -163,7 +163,7 @@ char buf[BUF_LEN];
report("Could not open data file for locale %s", plocale);
return(False);
}
- fp2 = fopen(name2, "a+");
+ fp2 = fopen(outfile(name2), "a+");
if (fp2 == NULL)
{
report("Could not open data file %s", name2);
@@ -191,5 +191,5 @@ char name[128];
ic = tet_testlist[tet_thistest-1].icref;
sprintf(name, "a%d.dat", ic);
- unlink(name);
+ unlink(outfile(name));
}
diff --git a/xts5/src/xim/xim_save.c b/xts5/src/xim/xim_save.c
index 9c33568d..71209c7d 100644
--- a/xts5/src/xim/xim_save.c
+++ b/xts5/src/xim/xim_save.c
@@ -577,7 +577,7 @@ Bool xim_save_open(plocale,style)
pext);
/* figure out which file to open */
- xim_save_fp = fopen(fname,"w");
+ xim_save_fp = fopen(outfile(fname),"w");
if(xim_save_fp == NULL)
{
report("Could not open %s to save responses",fname);