From d0502a18a410c4d7b2a8a2cff4b47db1f3afbcf8 Mon Sep 17 00:00:00 2001 From: Viktoria Shirunova Date: Thu, 6 Oct 2022 13:41:48 +0300 Subject: [PATCH] es2panda/js test runner: Fix conflict of default report path and temporary path for downloading test suites. --- test/runner/utils.py | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/test/runner/utils.py b/test/runner/utils.py index 51acf3e99..97307ffd3 100644 --- a/test/runner/utils.py +++ b/test/runner/utils.py @@ -20,11 +20,11 @@ def download(name, git_url, revision, target_path, show_progress=False): raise Exception(f'Downloading {url_file} file failed.') print(f"Extracting archive {archive_file}") - if path.isdir(target_path): + if path.exists(target_path): shutil.rmtree(target_path) return_code = subprocess.call( - ['unzip', '-q', '-d', target_path, archive_file]) + ['unzip', '-q', '-d', path.dirname(target_path), archive_file]) if return_code: raise Exception(f'Failed to unzip {archive_file} file') @@ -35,12 +35,12 @@ def download(name, git_url, revision, target_path, show_progress=False): def generate(name, url, revision, build_dir, test_subdir="test", show_progress=False, process_copy=None, source_path=None): dest_path = path.join(build_dir, name) makedirs(dest_path, exist_ok=True) - stamp_file = path.join(dest_path, f'{name}.stamp') + stamp_file = path.join(dest_path, f'{name}-{revision}.stamp') - if path.isfile(stamp_file): + if path.exists(stamp_file): return dest_path - temp_path = path.join(path.sep, 'tmp', name) + temp_path = path.join(path.sep, 'tmp', name, f'{name}-{revision}') if not path.exists(temp_path): download( @@ -51,7 +51,8 @@ def generate(name, url, revision, build_dir, test_subdir="test", show_progress=F show_progress ) - temp_path = path.join(temp_path, f'{name}-{revision}') + if path.exists(dest_path): + shutil.rmtree(dest_path) if process_copy is not None: process_copy( @@ -75,7 +76,8 @@ def generate(name, url, revision, build_dir, test_subdir="test", show_progress=F def copy(source_path, dest_path): try: - shutil.rmtree(dest_path) + if path.exists(dest_path): + shutil.rmtree(dest_path) shutil.copytree(source_path, dest_path) except Exception as e: print(e) -- Gitee