Fix libcom test failure on RTEMS

This commit is contained in:
Zainab Olalekan
2023-08-01 10:09:17 -05:00
committed by Michael Davidsaver
parent bc5d347bb2
commit 7fd690e53e

View File

@@ -14,6 +14,7 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <fcntl.h>
#include "epicsUnitTest.h"
#include "epicsString.h"
@@ -198,10 +199,22 @@ void testStrTok(void)
static
void testEpicsStrPrintEscaped(void)
{
const char *filename = "testEpicsStrPrintEscaped";
const char *filename;
FILE *testFile;
FILE *readOnly;
#ifdef __rtems__
/* ensure there is a writable area */
mkdir( "/tmp", S_IRWXU );
filename = "/tmp/testEpicsStrPrintEscaped";
#else
filename = "testEpicsStrPrintEscaped";
#endif
// Avoid printing to stdout by redirecting everything to a file
FILE *testFile = fopen(filename, "a");
FILE *readOnly = fopen(filename, "r");
testFile = fopen(filename, "a");
readOnly = fopen(filename, "r");
testDiag("testEpicsStrPrintEscaped()");