repairing the FILTER variable to take recursive wildcards ** into account

This commit is contained in:
BuildTools 2024-10-07 12:15:42 +02:00
parent b9b122efe2
commit 09f487f142
4 changed files with 13 additions and 12 deletions

View File

@ -6,7 +6,7 @@ import pytest
import glob import glob
from test_expect_pragma import ( from test_expect_pragma import (
TestExpectPragmas, TestCompiler, TestExpectPragmas, TestCompiler,
filter_pathnames, cat cat
) )
""" """
@ -69,21 +69,21 @@ MINIC_EVAL = os.path.join(
# MINIC_EVAL = os.path.join( # MINIC_EVAL = os.path.join(
# HERE, '..', '..', 'TP03', 'MiniC-type-interpret', 'Main.py') # HERE, '..', '..', 'TP03', 'MiniC-type-interpret', 'Main.py')
# Avoid duplicates
ALL_IN_MEM_FILES = list(set(ALL_FILES) | set(ALLOC_FILES))
ALL_IN_MEM_FILES.sort()
ALL_FILES = list(set(ALL_FILES))
ALL_FILES.sort()
if 'TEST_FILES' in os.environ: if 'TEST_FILES' in os.environ:
ALLOC_FILES = ALL_FILES ALLOC_FILES = ALL_FILES
ALL_IN_MEM_FILES = ALL_FILES ALL_IN_MEM_FILES = ALL_FILES
ALL_IN_MEM_FILES = list(set(ALL_FILES) | set(ALLOC_FILES))
if 'FILTER' in os.environ: if 'FILTER' in os.environ:
ALL_FILES = filter_pathnames(ALL_FILES, os.environ['FILTER']) FILTER_FILES = glob.glob(os.path.join(HERE, os.environ['FILTER']), recursive=True)
ALLOC_FILES = filter_pathnames(ALLOC_FILES, os.environ['FILTER']) ALL_FILES = list(set(FILTER_FILES) & set(ALL_FILES))
ALL_IN_MEM_FILES = filter_pathnames(ALL_IN_MEM_FILES, os.environ['FILTER']) ALLOC_FILES = list(set(FILTER_FILES) & set(ALLOC_FILES))
ALL_IN_MEM_FILES = list(set(FILTER_FILES) & set(ALL_IN_MEM_FILES))
# Avoid duplicates
ALL_IN_MEM_FILES.sort()
ALL_FILES = list(set(ALL_FILES))
ALL_FILES.sort()
class TestCodeGen(TestExpectPragmas, TestCompiler): class TestCodeGen(TestExpectPragmas, TestCompiler):
DISABLE_CODEGEN = DISABLE_CODEGEN DISABLE_CODEGEN = DISABLE_CODEGEN

View File

@ -5,7 +5,7 @@ import os
import sys import sys
from test_expect_pragma import ( from test_expect_pragma import (
TestExpectPragmas, cat, TestExpectPragmas, cat,
TestCompiler, filter_pathnames TestCompiler
) )
HERE = os.path.dirname(os.path.realpath(__file__)) HERE = os.path.dirname(os.path.realpath(__file__))
@ -34,7 +34,8 @@ if 'TEST_FILES' in os.environ:
MINIC_EVAL = os.path.join(IMPLEM_DIR, 'MiniCC.py') MINIC_EVAL = os.path.join(IMPLEM_DIR, 'MiniCC.py')
if 'FILTER' in os.environ: if 'FILTER' in os.environ:
ALL_FILES = filter_pathnames(ALL_FILES, os.environ['FILTER']) FILTER_FILES = glob.glob(os.path.join(HERE, os.environ['FILTER']), recursive=True)
ALL_FILES = list(set(FILTER_FILES) & set(ALL_FILES))
class TestInterpret(TestExpectPragmas, TestCompiler): class TestInterpret(TestExpectPragmas, TestCompiler):

Binary file not shown.

Binary file not shown.