From 771c356482685559ac9c937377f6002ee3cd81f2 Mon Sep 17 00:00:00 2001 From: Cleber Rosa Date: Mon, 23 Feb 2015 09:19:09 -0300 Subject: [PATCH] doublefree test: fix the temporary directories being used This test is using the location of the source file as the build location, instead of the `srcdir` provided by the Test class. Also, since `srcdir` is a temporary directory, I believe we should not have to manually clean it up. Signed-off-by: Cleber Rosa --- examples/tests/doublefree.py | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/examples/tests/doublefree.py b/examples/tests/doublefree.py index d82add70..29b45418 100755 --- a/examples/tests/doublefree.py +++ b/examples/tests/doublefree.py @@ -1,6 +1,7 @@ #!/usr/bin/python import os +import shutil from avocado import test from avocado import job @@ -20,9 +21,10 @@ class DoubleFreeTest(test.Test): """ Build 'doublefree'. """ - self.cwd = os.getcwd() c_file = self.get_data_path(self.params.source) - self.srcdir = os.path.dirname(c_file) + c_file_name = os.path.basename(c_file) + dest_c_file = os.path.join(self.srcdir, c_file_name) + shutil.copy(c_file, dest_c_file) build.make(self.srcdir, env={'CFLAGS': '-g -O0'}, extra_args='doublefree') @@ -35,11 +37,5 @@ class DoubleFreeTest(test.Test): cmd_result = process.run(cmd) self.log.info(cmd_result) - def cleanup(self): - """ - Clean up 'doublefree'. - """ - os.unlink(os.path.join(self.srcdir, 'doublefree')) - if __name__ == "__main__": job.main() -- GitLab