diff --git a/apio/commands/test.py b/apio/commands/test.py index c7af0aef..c7876604 100644 --- a/apio/commands/test.py +++ b/apio/commands/test.py @@ -1,16 +1,25 @@ # -*- coding: utf-8 -*- # -- This file is part of the Apio project -# -- (C) 2016-2019 FPGAwars -# -- Author Jesús Arroyo +# -- (C) 2016-2024 FPGAwars +# -- Authors +# -- * Jesús Arroyo (2016-2019) +# -- * Juan Gonzalez (obijuan) (2019-2024) # -- Licence GPLv2 -"""TODO""" +"""Main implementation of APIO TEST command""" import click from apio.managers.scons import SCons from apio import util +# ------------------ +# -- CONSTANTS +# ------------------ +CMD = "test" # -- Comand name +PROJECT_DIR = "project_dir" # -- Option +TESTBENCH = "testbench" # -- Option -@click.command("test", context_settings=util.context_settings()) + +@click.command(CMD, context_settings=util.context_settings()) @click.pass_context @click.option( "-p", @@ -21,13 +30,21 @@ ) @click.option( "-t", - "--testbench", + f"--{TESTBENCH}", type=str, metavar="testbench", help="Test only this testbench file.", ) -def cli(ctx, project_dir, testbench): +def cli(ctx, **kwargs): + # def cli(ctx, project_dir, testbench): """Launch the verilog testbench testing.""" - exit_code = SCons(project_dir).test({"testbench": testbench}) + # -- Extract the arguments + project_dir = kwargs[PROJECT_DIR] + testbench = kwargs[TESTBENCH] + + # -- Create the scons object + scons = SCons(project_dir) + + exit_code = scons.test({"testbench": testbench}) ctx.exit(exit_code)