From d7da95d2e565dee20985e9c2648b3b712068051e Mon Sep 17 00:00:00 2001
From: gary_williams <gary_williams@localhost>
Date: Tue, 09 Oct 2007 10:09:14 +0000
Subject: [PATCH] prevent from writing files to TMPDIR
---
opends/tests/functional-tests/shared/functions/utils.xml | 31 +++++++++++++++++++------------
1 files changed, 19 insertions(+), 12 deletions(-)
diff --git a/opends/tests/functional-tests/shared/functions/utils.xml b/opends/tests/functional-tests/shared/functions/utils.xml
index 7e5694f..abca95a 100755
--- a/opends/tests/functional-tests/shared/functions/utils.xml
+++ b/opends/tests/functional-tests/shared/functions/utils.xml
@@ -634,13 +634,14 @@
class Test:
def __init__(self, group, suite, fullname, start, stop, failures, successes, issues, duration):
self.message=[]
- self.log='%s/test.log' % logsTestsDir
- self.errors='%s/error.log' % DIRECTORY_INSTANCE_DIR
- self.access='%s/access.log' % DIRECTORY_INSTANCE_DIR
+ self.log='%s/test.log' % logsTempDir
+ self.errors='%s/error.log' % logsTempDir
+ self.access='%s/access.log' % logsTempDir
for f in [self.log,self.errors,self.access]:
- fh=open(f,'w')
- fh.write('')
- fh.close()
+ if os.path.exists(logsTempDir):
+ fh=open(f,'w')
+ fh.write('')
+ fh.close()
self.group=group
self.suite=suite
self.fullname=fullname
@@ -681,7 +682,6 @@
xml += ' <log>%s' % newLine
xml += ' <![CDATA[%s' % newLine
if self.result!='pass':
- # TODO: wrap with try catch to get IOError without stopping the tests
try:
fh=open(self.log)
xml += fh.read()
@@ -693,7 +693,6 @@
xml += ' <error>%s' % newLine
xml += ' <![CDATA[%s' % newLine
if self.result!='pass':
- # TODO: wrap with try catch to get IOError without stopping the tests
try:
fh=open(self.errors)
xml += fh.read()
@@ -705,7 +704,6 @@
xml += ' <access>%s' % newLine
xml += ' <![CDATA[%s' % newLine
if self.result!='pass':
- # TODO: wrap with try catch to get IOError without stopping the tests
try:
fh=open(self.access)
xml += fh.read()
@@ -729,11 +727,20 @@
_leftPadding='... '
wrappedLog += '%s%s%s' % (_leftPadding,_line,newLine)
if category == 'access':
- fh=open(self.access,'a')
+ try:
+ fh=open(self.access,'a')
+ except IOError,details:
+ self.message.append('IOError: Opening %s for appending %s' % (self.access,details.args))
elif category == 'error':
- fh=open(self.errors,'a')
+ try:
+ fh=open(self.errors,'a')
+ except IOError,details:
+ self.message.append('IOError: Opening %s for appending %s' % (self.errors,details.args))
else:
- fh=open(self.log,'a')
+ try:
+ fh=open(self.log,'a')
+ except IOError,details:
+ self.message.append('IOError: Opening %s for appending %s' % (self.log,details.args))
fh.seek(0,2)
fh.write(wrappedLog)
fh.close()
--
Gitblit v1.10.0