Skip to content

Commit

Permalink
Rename results_dir to output_dir
Browse files Browse the repository at this point in the history
  • Loading branch information
rgonzalezfluendo authored and rubenrua committed Nov 26, 2023
1 parent 6d4f5a1 commit a9a9a0a
Show file tree
Hide file tree
Showing 5 changed files with 26 additions and 26 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -317,7 +317,7 @@ optional arguments:
-r RESOURCES, --resources RESOURCES
set the directory where resources are taken from
-o OUTPUT, --output OUTPUT
set the directory where test results will be stored
set the directory where decoder outputs will be stored
-ne, --no-emoji set to use plain text instead of emojis
-tsd TEST_SUITES_DIR, --test-suites-dir TEST_SUITES_DIR
set the directory where test suite will be read from
Expand Down
16 changes: 8 additions & 8 deletions fluster/fluster.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ def __init__(
def to_test_suite_context(
self,
decoder: Decoder,
results_dir: str,
output_dir: str,
test_vectors: List[str],
skip_vectors: List[str],
) -> TestSuiteContext:
Expand All @@ -96,7 +96,7 @@ def to_test_suite_context(
timeout=self.timeout,
failfast=self.failfast,
quiet=self.quiet,
results_dir=results_dir,
output_dir=output_dir,
reference=self.reference,
test_vectors=test_vectors,
skip_vectors=skip_vectors,
Expand Down Expand Up @@ -141,14 +141,14 @@ def __init__(
test_suites_dir: str,
decoders_dir: str,
resources_dir: str,
results_dir: str,
output_dir: str,
verbose: bool = False,
use_emoji: bool = True,
):
self.test_suites_dir = test_suites_dir
self.decoders_dir = decoders_dir
self.resources_dir = resources_dir
self.results_dir = results_dir
self.output_dir = output_dir
self.verbose = verbose
self.test_suites: List[TestSuite] = []
self.decoders = DECODERS
Expand All @@ -158,7 +158,7 @@ def __init__(
f"NOTE: Internal dirs used:\n"
f" * test_suites_dir: {self.test_suites_dir}\n"
f" * resources_dir: {self.resources_dir}\n"
f" * results_dir: {self.results_dir}"
f" * output_dir: {self.output_dir}"
)

@lru_cache(maxsize=128)
Expand Down Expand Up @@ -284,7 +284,7 @@ def run_test_suites(self, ctx: Context) -> None:
test_suite_res = test_suite.run(
ctx.to_test_suite_context(
decoder,
self.results_dir,
self.output_dir,
ctx.test_vectors_names,
ctx.skip_vectors_names,
)
Expand Down Expand Up @@ -326,8 +326,8 @@ def run_test_suites(self, ctx: Context) -> None:

self._show_summary_if_needed(ctx, results)

if not ctx.keep_files and os.path.isdir(self.results_dir):
rmtree(self.results_dir)
if not ctx.keep_files and os.path.isdir(self.output_dir):
rmtree(self.output_dir)

if (error and (not ctx.threshold and not ctx.time_threshold)) or no_test_run:
sys.exit(1)
Expand Down
10 changes: 5 additions & 5 deletions fluster/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
TEST_SUITES_DIR_SYS = "/usr/share/fluster/test_suites"
DECODERS_DIR = "decoders"
RESOURCES_DIR = "resources"
RESULTS_DIR = "fluster_results"
OUTPUT_DIR = "fluster_output"


def fluster_main() -> None:
Expand All @@ -55,7 +55,7 @@ def __init__(self) -> None:
self.resources_dir = os.path.join(
os.path.dirname(__file__), "..", RESOURCES_DIR
)
self.results_dir = os.path.join(gettempdir(), RESULTS_DIR)
self.output_dir = os.path.join(gettempdir(), OUTPUT_DIR)

is_installed = not os.path.exists(
os.path.join(os.path.dirname(__file__), "..", ".git")
Expand Down Expand Up @@ -97,7 +97,7 @@ def run(self) -> None:
test_suites_dir=args.test_suites_dir,
decoders_dir=self.decoders_dir,
resources_dir=args.resources,
results_dir=args.output,
output_dir=args.output,
use_emoji=not args.no_emoji,
)
args.func(args, fluster)
Expand Down Expand Up @@ -145,8 +145,8 @@ def _create_parser(self) -> argparse.ArgumentParser:
parser.add_argument(
"-o",
"--output",
help="set the directory where test results will be stored",
default=self.results_dir,
help="set the directory where decoder outputs will be stored",
default=self.output_dir,
)
parser.add_argument(
"-ne",
Expand Down
6 changes: 3 additions & 3 deletions fluster/test.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ def __init__(
test_suite: Any, # can't use TestSuite type because of circular dependency
test_vector: TestVector,
skip: bool,
results_dir: str,
output_dir: str,
reference: bool,
timeout: int,
keep_files: bool,
Expand All @@ -48,7 +48,7 @@ def __init__(
self.test_vector = test_vector
self.skip = skip
self.resources_dir = self.test_suite.resources_dir
self.results_dir = results_dir
self.output_dir = output_dir
self.reference = reference
self.timeout = timeout
self.keep_files = keep_files
Expand All @@ -64,7 +64,7 @@ def _test(self) -> None:

return

output_filepath = os.path.join(self.results_dir, self.test_vector.name + ".out")
output_filepath = os.path.join(self.output_dir, self.test_vector.name + ".out")

input_filepath = os.path.join(
self.resources_dir,
Expand Down
18 changes: 9 additions & 9 deletions fluster/test_suite.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ def __init__(
timeout: int,
failfast: bool,
quiet: bool,
results_dir: str,
output_dir: str,
reference: bool = False,
test_vectors: Optional[List[str]] = None,
skip_vectors: Optional[List[str]] = None,
Expand All @@ -82,7 +82,7 @@ def __init__(
self.timeout = timeout
self.failfast = failfast
self.quiet = quiet
self.results_dir = results_dir
self.output_dir = output_dir
self.reference = reference
self.test_vectors = test_vectors
self.skip_vectors = skip_vectors
Expand Down Expand Up @@ -405,10 +405,10 @@ def run(self, ctx: Context) -> Optional["TestSuite"]:
print(f"Skipping decoder {ctx.decoder.name} because it cannot be run")
return None

ctx.results_dir = os.path.join(ctx.results_dir, self.name)
if os.path.exists(ctx.results_dir):
rmtree(ctx.results_dir)
os.makedirs(ctx.results_dir)
ctx.output_dir = os.path.join(ctx.output_dir, self.name)
if os.path.exists(ctx.output_dir):
rmtree(ctx.output_dir)
os.makedirs(ctx.output_dir)

test_suite = self.clone()
tests = test_suite.generate_tests(ctx)
Expand All @@ -434,8 +434,8 @@ def run(self, ctx: Context) -> Optional["TestSuite"]:
if ctx.reference:
test_suite.to_json_file(test_suite.filename)

if not ctx.keep_files and os.path.isdir(ctx.results_dir):
rmtree(ctx.results_dir)
if not ctx.keep_files and os.path.isdir(ctx.output_dir):
rmtree(ctx.output_dir)

return test_suite

Expand All @@ -457,7 +457,7 @@ def generate_tests(self, ctx: Context) -> List[Test]:
self,
test_vector,
skip,
ctx.results_dir,
ctx.output_dir,
ctx.reference,
ctx.timeout,
ctx.keep_files,
Expand Down

0 comments on commit a9a9a0a

Please sign in to comment.