From 2953db9d216f57901dd1d4332549bcba20c8de33 Mon Sep 17 00:00:00 2001 From: JiriPavela Date: Sun, 5 Nov 2023 20:31:02 +0100 Subject: [PATCH] Handle too long strings using experimental flag Base black configuration does not format strings that are too long. A `--experimental-string-processing` flag has been used to format them properly. --- perun/cli.py | 252 ++++--- perun/cli_groups/check_cli.py | 28 +- perun/cli_groups/config_cli.py | 8 +- perun/cli_groups/run_cli.py | 40 +- perun/cli_groups/utils_cli.py | 32 +- perun/collect/bounds/run.py | 6 +- perun/collect/complexity/makefiles.py | 15 +- perun/collect/complexity/run.py | 16 +- perun/collect/memory/run.py | 18 +- .../trace/optimizations/diff_tracing.py | 38 +- perun/collect/trace/run.py | 63 +- .../collect/trace/systemtap/script_compact.py | 6 +- perun/collect/trace/values.py | 5 +- perun/logic/index.py | 5 +- perun/logic/temp.py | 4 +- perun/postprocess/clusterizer/run.py | 2 +- .../postprocess/kernel_regression/methods.py | 11 +- perun/postprocess/kernel_regression/run.py | 29 +- perun/postprocess/moving_average/run.py | 32 +- perun/postprocess/regression_analysis/run.py | 2 +- perun/postprocess/regressogram/run.py | 6 +- perun/profile/helpers.py | 9 +- perun/thirdparty/pyqt_fit_port/kde_methods.py | 8 +- perun/thirdparty/pyqt_fit_port/utils.py | 9 +- perun/utils/cli_helpers.py | 8 +- perun/utils/exceptions.py | 17 +- perun/utils/script_helpers.py | 4 +- perun/view/bars/run.py | 11 +- perun/view/flow/run.py | 30 +- perun/view/scatter/factory.py | 3 +- perun/view/tableof/run.py | 41 +- tests/test_collect.py | 68 +- tests/test_config.py | 2 +- tests/test_fuzzing.py | 622 ++++++------------ tests/test_status.py | 8 +- tests/test_table.py | 73 +- tests/test_tracer.py | 107 ++- 37 files changed, 744 insertions(+), 894 deletions(-) diff --git a/perun/cli.py b/perun/cli.py index 0b9d1b7e4..a639deda8 100644 --- a/perun/cli.py +++ b/perun/cli.py @@ -94,15 +94,17 @@ "-d", default=False, is_flag=True, - help="Suppresses the catching of all exceptions from the CLI and generating of the " "dump.", + help="Suppresses the catching of all exceptions from the CLI and generating of the dump.", ) @click.option( "--no-pager", default=False, is_flag=True, - help="Disables the paging of the long standard output (currently" - " affects only ``status`` and ``log`` outputs). See " - ":ckey:`paging` to change the default paging strategy.", + help=( + "Disables the paging of the long standard output (currently" + " affects only ``status`` and ``log`` outputs). See " + ":ckey:`paging` to change the default paging strategy." + ), ) @click.option( "--no-color", @@ -116,8 +118,10 @@ "-v", count=True, default=0, - help="Increases the verbosity of the standard output. Verbosity " - "is incremental, and each level increases the extent of output.", + help=( + "Increases the verbosity of the standard output. Verbosity " + "is incremental, and each level increases the extent of output." + ), ) @click.option( "--version", @@ -133,8 +137,10 @@ type=(str, str), default=["", ""], callback=cli_helpers.configure_metrics, - help="Enables the collection of metrics into the given temp file" - "(first argument) under the supplied ID (second argument).", + help=( + "Enables the collection of metrics into the given temp file" + "(first argument) under the supplied ID (second argument)." + ), ) def cli( dev_mode: bool = False, @@ -195,13 +201,15 @@ def configure_local_perun(perun_path: str) -> None: metavar="", default="git", type=click.Choice(utils.get_supported_module_names("vcs")), - help="In parallel to initialization of Perun, initialize the vcs" - " of as well (by default ``git``).", + help=( + "In parallel to initialization of Perun, initialize the vcs" + " of as well (by default ``git``)." + ), ) @click.option( "--vcs-path", metavar="", - help="Sets the destination of wrapped vcs initialization at " ".", + help="Sets the destination of wrapped vcs initialization at .", ) @click.option( "--vcs-param", @@ -209,8 +217,10 @@ def configure_local_perun(perun_path: str) -> None: metavar="", multiple=True, callback=cli_helpers.vcs_parameter_callback, - help="Passes additional (key, value) parameter to initialization" - " of version control system, e.g. ``separate-git-dir dir``.", + help=( + "Passes additional (key, value) parameter to initialization" + " of version control system, e.g. ``separate-git-dir dir``." + ), ) @click.option( "--vcs-flag", @@ -218,25 +228,29 @@ def configure_local_perun(perun_path: str) -> None: metavar="", multiple=True, callback=cli_helpers.vcs_parameter_callback, - help="Passes additional flag to a initialization of version " "control system, e.g. ``bare``.", + help="Passes additional flag to a initialization of version control system, e.g. ``bare``.", ) @click.option( "--configure", "-c", is_flag=True, default=False, - help="After successful initialization of both systems, opens " - "the local configuration using the :ckey:`editor` set in shared " - "config.", + help=( + "After successful initialization of both systems, opens " + "the local configuration using the :ckey:`editor` set in shared " + "config." + ), ) @click.option( "--config-template", "-t", type=click.STRING, default="master", - help="States the configuration template that will be used for initialization of local" - " configuration. See :ref:`config-templates` for more details about predefined " - " configurations.", + help=( + "States the configuration template that will be used for initialization of local" + " configuration. See :ref:`config-templates` for more details about predefined " + " configurations." + ), ) def init(dst: str, configure: bool, config_template: str, **kwargs: Any) -> None: """Initializes performance versioning system at the destination path. @@ -316,8 +330,10 @@ def init(dst: str, configure: bool, config_template: str, **kwargs: Any) -> None is_flag=True, required=False, default=False, - help="Keeps the profile in filesystem after registering it in" - " Perun storage. Otherwise it is deleted.", + help=( + "Keeps the profile in filesystem after registering it in" + " Perun storage. Otherwise it is deleted." + ), ) @click.option( "--force", @@ -325,9 +341,11 @@ def init(dst: str, configure: bool, config_template: str, **kwargs: Any) -> None is_flag=True, default=False, required=False, - help="If set to true, then the profile will be registered in the minor version" - "index, even if its origin is different. WARNING: This can screw the " - "performance history of your project.", + help=( + "If set to true, then the profile will be registered in the minor version" + "index, even if its origin is different. WARNING: This can screw the " + "performance history of your project." + ), ) def add(profile: list[str], minor: Optional[str], **kwargs: Any) -> None: """Links profile to concrete minor version storing its content in the @@ -485,7 +503,7 @@ def remove( "-s", is_flag=True, default=False, - help="Shortens the output of ``log`` to include only most " "necessary information.", + help="Shortens the output of ``log`` to include only most necessary information.", ) def log(head: Optional[str], **kwargs: Any) -> None: """Shows history of versions and associated profiles. @@ -521,7 +539,7 @@ def log(head: Optional[str], **kwargs: Any) -> None: required=False, default=False, is_flag=True, - help="Shortens the output of ``status`` to include only most" " necessary information.", + help="Shortens the output of ``status`` to include only most necessary information.", ) @click.option( "--sort-by", @@ -532,9 +550,11 @@ def log(head: Optional[str], **kwargs: Any) -> None: callback=cli_helpers.set_config_option_from_flag( pcs.local_config, "format.sort_profiles_by", str ), - help="Sets the in the local configuration for sorting profiles. " - "Note that after setting the it will be used for sorting which is " - "considered in pending and index tags!", + help=( + "Sets the in the local configuration for sorting profiles. " + "Note that after setting the it will be used for sorting which is " + "considered in pending and index tags!" + ), ) def status(**kwargs: Any) -> None: """Shows the status of vcs, associated profiles and perun. @@ -587,7 +607,7 @@ def status(**kwargs: Any) -> None: default=None, is_eager=True, callback=cli_helpers.lookup_minor_version_callback, - help="Will check the index of different minor version " " during the profile lookup", + help="Will check the index of different minor version during the profile lookup", ) @click.pass_context def show(ctx: click.Context, profile: Profile, **_: Any) -> None: @@ -651,10 +671,12 @@ def show(ctx: click.Context, profile: Profile, **_: Any) -> None: callback=cli_helpers.set_config_option_from_flag( perun_config.runtime, "format.output_profile_template", str ), - help="Specifies the template for automatic generation of output filename" - " This way the postprocessed file will have a resulting filename w.r.t to this" - " parameter. Refer to :ckey:`format.output_profile_template` for more" - " details about the format of the template.", + help=( + "Specifies the template for automatic generation of output filename" + " This way the postprocessed file will have a resulting filename w.r.t to this" + " parameter. Refer to :ckey:`format.output_profile_template` for more" + " details about the format of the template." + ), ) @click.option( "--minor", @@ -663,7 +685,7 @@ def show(ctx: click.Context, profile: Profile, **_: Any) -> None: default=None, is_eager=True, callback=cli_helpers.lookup_minor_version_callback, - help="Will check the index of different minor version " " during the profile lookup", + help="Will check the index of different minor version during the profile lookup", ) @click.pass_context def postprocessby(ctx: click.Context, profile: Profile, **_: Any) -> None: @@ -746,8 +768,10 @@ def postprocessby(ctx: click.Context, profile: Profile, **_: Any) -> None: is_flag=True, default=False, is_eager=True, - help="If set to true, then for each specified minor versions, profiles for parents" - " will be collected as well", + help=( + "If set to true, then for each specified minor versions, profiles for parents" + " will be collected as well" + ), ) @click.option( "--cmd", @@ -756,8 +780,10 @@ def postprocessby(ctx: click.Context, profile: Profile, **_: Any) -> None: required=False, multiple=True, default=[""], - help="Command that is being profiled. Either corresponds to some" - " script, binary or command, e.g. ``./mybin`` or ``perun``.", + help=( + "Command that is being profiled. Either corresponds to some" + " script, binary or command, e.g. ``./mybin`` or ``perun``." + ), ) @click.option( "--args", @@ -765,7 +791,7 @@ def postprocessby(ctx: click.Context, profile: Profile, **_: Any) -> None: nargs=1, required=False, multiple=True, - help="Additional parameters for . E.g. ``status`` or " "``-al`` is command parameter.", + help="Additional parameters for . E.g. ``status`` or ``-al`` is command parameter.", ) @click.option( "--workload", @@ -774,7 +800,7 @@ def postprocessby(ctx: click.Context, profile: Profile, **_: Any) -> None: required=False, multiple=True, default=[""], - help="Inputs for . E.g. ``./subdir`` is possible workload" "for ``ls`` command.", + help="Inputs for . E.g. ``./subdir`` is possible workloadfor ``ls`` command.", ) @click.option( "--params", @@ -783,7 +809,7 @@ def postprocessby(ctx: click.Context, profile: Profile, **_: Any) -> None: required=False, multiple=True, callback=cli_helpers.single_yaml_param_callback, - help="Additional parameters for called collector read from " "file in YAML format.", + help="Additional parameters for called collector read from file in YAML format.", ) @click.option( "--output-filename-template", @@ -792,10 +818,12 @@ def postprocessby(ctx: click.Context, profile: Profile, **_: Any) -> None: callback=cli_helpers.set_config_option_from_flag( perun_config.runtime, "format.output_profile_template", str ), - help="Specifies the template for automatic generation of output filename" - " This way the file with collected data will have a resulting filename w.r.t " - " to this parameter. Refer to :ckey:`format.output_profile_template` for more" - " details about the format of the template.", + help=( + "Specifies the template for automatic generation of output filename" + " This way the file with collected data will have a resulting filename w.r.t " + " to this parameter. Refer to :ckey:`format.output_profile_template` for more" + " details about the format of the template." + ), ) @click.option( "--optimization-pipeline", @@ -890,10 +918,12 @@ def collect(ctx: click.Context, **kwargs: Any) -> None: nargs=1, required=True, multiple=True, - help="Initial sample of workloads (the so called corpus)." - "These will serve as initial workloads to evaluate the baseline for performance testing." - "The parameter expects either paths to files (which will be directly added), or " - "paths to directories (which will be recursively searched).", + help=( + "Initial sample of workloads (the so called corpus)." + "These will serve as initial workloads to evaluate the baseline for performance testing." + "The parameter expects either paths to files (which will be directly added), or " + "paths to directories (which will be recursively searched)." + ), ) @click.option( "--collector", @@ -901,9 +931,11 @@ def collect(ctx: click.Context, **kwargs: Any) -> None: nargs=1, default="time", type=click.Choice(utils.get_supported_module_names("collect")), - help="Collector that will be used to collect performance data and used to infer " - "baseline or target performance profiles. " - "The profiles are further used for performance testing.", + help=( + "Collector that will be used to collect performance data and used to infer " + "baseline or target performance profiles. " + "The profiles are further used for performance testing." + ), ) @click.option( "--collector-params", @@ -912,8 +944,10 @@ def collect(ctx: click.Context, **kwargs: Any) -> None: required=False, multiple=True, callback=cli_helpers.yaml_param_callback, - help="Additional parameters for the : " - "can be specified as a file in YAML format or as YAML string", + help=( + "Additional parameters for the : " + "can be specified as a file in YAML format or as YAML string" + ), ) @click.option( "--postprocessor", @@ -922,9 +956,11 @@ def collect(ctx: click.Context, **kwargs: Any) -> None: required=False, multiple=True, type=click.Choice(utils.get_supported_module_names("postprocess")), - help="After each collection of performance data, the fuzzer can run to " - "postprocess the collected resources (e.g. to create models of resources). " - "This can be used for more thorough performance analysis.", + help=( + "After each collection of performance data, the fuzzer can run to " + "postprocess the collected resources (e.g. to create models of resources). " + "This can be used for more thorough performance analysis." + ), ) @click.option( "--postprocessor-params", @@ -933,8 +969,10 @@ def collect(ctx: click.Context, **kwargs: Any) -> None: required=False, multiple=True, callback=cli_helpers.yaml_param_callback, - help="Additional parameters for the : " - "can be specified as a file in YAML format or as YAML string", + help=( + "Additional parameters for the : " + "can be specified as a file in YAML format or as YAML string" + ), ) @click.option( "--minor-version", @@ -944,8 +982,10 @@ def collect(ctx: click.Context, **kwargs: Any) -> None: multiple=True, callback=cli_helpers.minor_version_list_callback, default=["HEAD"], - help="Specifies the head minor version in the wrapped repository. " - "The fuzzing will be performed for this particular version of the project.", + help=( + "Specifies the head minor version in the wrapped repository. " + "The fuzzing will be performed for this particular version of the project." + ), ) @click.option( "--workloads-filter", @@ -955,16 +995,21 @@ def collect(ctx: click.Context, **kwargs: Any) -> None: type=str, metavar="", default="", - help="Regular expression that will the filter input workloads/corpus. " - "E.g. to restrict to certain filetypes, filenames or subdirectories.", + help=( + "Regular expression that will the filter input workloads/corpus. " + "E.g. to restrict to certain filetypes, filenames or subdirectories." + ), ) @click.option( "--skip-coverage-testing", is_flag=True, required=False, - help="If set to true, then the evaluation of mutations based on coverage testing will not be performed. " - "The coverage testing is a fast heuristic to filter out mutations that will probably not lead " - "to severe real degradation. The testing through perun is costly, though very precise.", + help=( + "If set to true, then the evaluation of mutations based on coverage testing will not be" + " performed. The coverage testing is a fast heuristic to filter out mutations that will" + " probably not lead to severe real degradation. The testing through perun is costly, though" + " very precise." + ), ) @click.option( "--source-path", @@ -1013,8 +1058,10 @@ def collect(ctx: click.Context, **kwargs: Any) -> None: default=10, type=click.FloatRange(0.001, None, False), metavar="", - help="The time limit before the input is classified as a hang/timeout (in seconds)." - " Default value is 10s.", + help=( + "The time limit before the input is classified as a hang/timeout (in seconds)." + " Default value is 10s." + ), ) @click.option( "--max-size", @@ -1023,10 +1070,12 @@ def collect(ctx: click.Context, **kwargs: Any) -> None: required=False, type=click.IntRange(1, None, False), metavar="", - help="Absolute value of the maximum size of the generated mutation wrt parent corpus. " - "The value will be adjusted wrt to the maximal size of the workloads in corpus. " - "Using this option, the maximal size of the generated mutation will be set to " - "max(size of the largest workload in corpus, ). ", + help=( + "Absolute value of the maximum size of the generated mutation wrt parent corpus. " + "The value will be adjusted wrt to the maximal size of the workloads in corpus. " + "Using this option, the maximal size of the generated mutation will be set to " + "max(size of the largest workload in corpus, ). " + ), ) @click.option( "--max-size-increase", @@ -1036,10 +1085,11 @@ def collect(ctx: click.Context, **kwargs: Any) -> None: default=1000000, type=click.IntRange(0, None, False), metavar="", - help="Absolute value of the maximal increase in the size of the generated mutation wrt parent corpus. " - "Using this option, the maximal size of generated mutation will be set to " - "(size of the largest corpus in workload + ). " - "Default value is 1 000 000 B = 1MB.", + help=( + "Absolute value of the maximal increase in the size of the generated mutation wrt parent" + " corpus. Using this option, the maximal size of generated mutation will be set to (size of" + " the largest corpus in workload + ). Default value is 1 000 000 B = 1MB." + ), ) @click.option( "--max-size-ratio", @@ -1048,10 +1098,11 @@ def collect(ctx: click.Context, **kwargs: Any) -> None: required=False, type=click.FloatRange(0.1, None, False), metavar="", - help="Relative value of the maximal increase in the size of the generated mutation wrt parent corpus. " - "Using this option, the maximal size of generated mutation will be set to " - "(size of the largest corpus in workload * ). " - " E.g. 1.5, max size=largest workload size * 1.5", + help=( + "Relative value of the maximal increase in the size of the generated mutation wrt parent" + " corpus. Using this option, the maximal size of generated mutation will be set to (size of" + " the largest corpus in workload * ). E.g. 1.5, max size=largest workload size * 1.5" + ), ) @click.option( "--exec-limit", @@ -1061,9 +1112,11 @@ def collect(ctx: click.Context, **kwargs: Any) -> None: default=100, type=click.IntRange(1, None, False), metavar="", - help="The maximum number of fuzzing iteration while gathering interesting inputs. " - "By interesting inputs we mean files that might potentially lead to timeouts, hang or severe " - "severe performance degradation.", + help=( + "The maximum number of fuzzing iteration while gathering interesting inputs. By interesting" + " inputs we mean files that might potentially lead to timeouts, hang or severe severe" + " performance degradation." + ), ) @click.option( "--interesting-files-limit", @@ -1073,10 +1126,11 @@ def collect(ctx: click.Context, **kwargs: Any) -> None: type=click.IntRange(1, None, False), metavar="", default=20, - help="The minimum number of gathered mutations, that are so called interesting, " - "before perun testing is performed. " - "By interesting inputs we mean files that might potentially lead to timeouts, hang or severe " - "severe performance degradation.", + help=( + "The minimum number of gathered mutations, that are so called interesting, before perun" + " testing is performed. By interesting inputs we mean files that might potentially lead to" + " timeouts, hang or severe severe performance degradation." + ), ) @click.option( "--coverage-increase-rate", @@ -1086,9 +1140,11 @@ def collect(ctx: click.Context, **kwargs: Any) -> None: default=1.5, type=click.FloatRange(0, None, False), metavar="", - help="The threshold of coverage increase against base coverage, which is used to evaluate, " - "whether the generated mutation is interesting for further evaluation by performance testing. " - "E.g 1.5, base coverage = 100 000, so threshold = 150 000.", + help=( + "The threshold of coverage increase against base coverage, which is used to evaluate," + " whether the generated mutation is interesting for further evaluation by performance" + " testing. E.g 1.5, base coverage = 100 000, so threshold = 150 000." + ), ) @click.option( "--mutations-per-rule", @@ -1098,8 +1154,10 @@ def collect(ctx: click.Context, **kwargs: Any) -> None: default="mixed", type=click.Choice(["unitary", "proportional", "probabilistic", "mixed"]), metavar="", - help="Strategy which determines how many mutations will be generated by certain" - " fuzzing rule in one iteration: unitary, proportional, probabilistic, mixed", + help=( + "Strategy which determines how many mutations will be generated by certain" + " fuzzing rule in one iteration: unitary, proportional, probabilistic, mixed" + ), ) @click.option( "--regex-rules", @@ -1109,8 +1167,10 @@ def collect(ctx: click.Context, **kwargs: Any) -> None: multiple=True, callback=cli_helpers.single_yaml_param_callback, metavar="", - help="Option for adding custom fuzzing rules specified by regular expressions," - " written in YAML format file.", + help=( + "Option for adding custom fuzzing rules specified by regular expressions," + " written in YAML format file." + ), ) @click.option( "--no-plotting", diff --git a/perun/cli_groups/check_cli.py b/perun/cli_groups/check_cli.py index bcff94224..2529c0ad8 100644 --- a/perun/cli_groups/check_cli.py +++ b/perun/cli_groups/check_cli.py @@ -23,10 +23,12 @@ "-f", is_flag=True, default=False, - help="Force comparison of the selected profiles even if their configuration" - "does not match. This may be necessary when, e.g., different project" - "versions build binaries with version information in their name" - "(python3.10 and python3.11), thus failing the consistency check. ", + help=( + "Force comparison of the selected profiles even if their configuration" + "does not match. This may be necessary when, e.g., different project" + "versions build binaries with version information in their name" + "(python3.10 and python3.11), thus failing the consistency check. " + ), ) @click.option( "--compute-missing", @@ -36,8 +38,10 @@ ), is_flag=True, default=False, - help="whenever there are missing profiles in the given point of history" - " the matrix will be rerun and new generated profiles assigned.", + help=( + "whenever there are missing profiles in the given point of history" + " the matrix will be rerun and new generated profiles assigned." + ), ) @click.option( "--models-type", @@ -47,10 +51,12 @@ multiple=False, type=click.Choice(check.get_supported_detection_models_strategies()), default=check.get_supported_detection_models_strategies()[0], - help="The detection models strategies predict the way of executing " - "the detection between two profiles, respectively between relevant " - "kinds of its models. Available only in the following detection " - "methods: Integral Comparison (IC) and Local Statistics (LS).", + help=( + "The detection models strategies predict the way of executing " + "the detection between two profiles, respectively between relevant " + "kinds of its models. Available only in the following detection " + "methods: Integral Comparison (IC) and Local Statistics (LS)." + ), ) def check_group(**_: Any) -> None: """Applies for the points of version history checks for possible performance changes. @@ -200,7 +206,7 @@ def check_all(minor_head: str = "HEAD") -> None: is_eager=True, callback=cli_helpers.lookup_minor_version_callback, metavar="", - help="Will check the index of different minor version " " during the profile lookup.", + help="Will check the index of different minor version during the profile lookup.", ) @click.pass_context def check_profiles( diff --git a/perun/cli_groups/config_cli.py b/perun/cli_groups/config_cli.py index a361396e3..6ad4ca64f 100644 --- a/perun/cli_groups/config_cli.py +++ b/perun/cli_groups/config_cli.py @@ -36,9 +36,11 @@ "store_type", flag_value="recursive", default=True, - help="Sets the nearest suitable config as the source config. The" - " lookup strategy can differ for ``set`` and " - "``get``/``edit``.", + help=( + "Sets the nearest suitable config as the source config. The" + " lookup strategy can differ for ``set`` and " + "``get``/``edit``." + ), ) @click.pass_context def config(ctx: click.Context, **kwargs: Any) -> None: diff --git a/perun/cli_groups/run_cli.py b/perun/cli_groups/run_cli.py index 7680a8176..2678c301a 100644 --- a/perun/cli_groups/run_cli.py +++ b/perun/cli_groups/run_cli.py @@ -22,10 +22,12 @@ callback=cli_helpers.set_config_option_from_flag( perun_config.runtime, "format.output_profile_template", str ), - help="Specifies the template for automatic generation of output filename" - " This way the file with collected data will have a resulting filename w.r.t " - " to this parameter. Refer to :ckey:`format.output_profile_template` for more" - " details about the format of the template.", + help=( + "Specifies the template for automatic generation of output filename" + " This way the file with collected data will have a resulting filename w.r.t " + " to this parameter. Refer to :ckey:`format.output_profile_template` for more" + " details about the format of the template." + ), ) @click.option( "--minor-version", @@ -43,8 +45,10 @@ is_flag=True, default=False, is_eager=True, - help="If set to true, then for each specified minor versions, profiles for parents" - " will be collected as well", + help=( + "If set to true, then for each specified minor versions, profiles for parents" + " will be collected as well" + ), ) @click.option( "--force-dirty", @@ -52,7 +56,7 @@ is_flag=True, default=False, callback=cli_helpers.unsupported_option_callback, - help="If set to true, then even if the repository is dirty, " "the changes will not be stashed", + help="If set to true, then even if the repository is dirty, the changes will not be stashed", ) @click.pass_context def run(ctx: click.Context, **kwargs: Any) -> None: @@ -105,8 +109,10 @@ def matrix(ctx: click.Context, quiet: bool, **kwargs: Any) -> None: nargs=1, required=True, multiple=True, - help="Command that is being profiled. Either corresponds to some" - " script, binary or command, e.g. ``./mybin`` or ``perun``.", + help=( + "Command that is being profiled. Either corresponds to some" + " script, binary or command, e.g. ``./mybin`` or ``perun``." + ), ) @click.option( "--args", @@ -114,7 +120,7 @@ def matrix(ctx: click.Context, quiet: bool, **kwargs: Any) -> None: nargs=1, required=False, multiple=True, - help="Additional parameters for . E.g. ``status`` or " "``-al`` is command parameter.", + help="Additional parameters for . E.g. ``status`` or ``-al`` is command parameter.", ) @click.option( "--workload", @@ -123,7 +129,7 @@ def matrix(ctx: click.Context, quiet: bool, **kwargs: Any) -> None: required=False, multiple=True, default=[""], - help="Inputs for . E.g. ``./subdir`` is possible workload" "for ``ls`` command.", + help="Inputs for . E.g. ``./subdir`` is possible workloadfor ``ls`` command.", ) @click.option( "--collector", @@ -132,7 +138,7 @@ def matrix(ctx: click.Context, quiet: bool, **kwargs: Any) -> None: required=True, multiple=True, type=click.Choice(utils.get_supported_module_names("collect")), - help="Profiler used for collection of profiling data for the" " given ", + help="Profiler used for collection of profiling data for the given ", ) @click.option( "--collector-params", @@ -141,7 +147,7 @@ def matrix(ctx: click.Context, quiet: bool, **kwargs: Any) -> None: required=False, multiple=True, callback=cli_helpers.yaml_param_callback, - help="Additional parameters for the read from the" " file in YAML format", + help="Additional parameters for the read from the file in YAML format", ) @click.option( "--postprocessor", @@ -150,8 +156,10 @@ def matrix(ctx: click.Context, quiet: bool, **kwargs: Any) -> None: required=False, multiple=True, type=click.Choice(utils.get_supported_module_names("postprocess")), - help="After each collection of data will run to " - "postprocess the collected resources.", + help=( + "After each collection of data will run to " + "postprocess the collected resources." + ), ) @click.option( "--postprocessor-params", @@ -160,7 +168,7 @@ def matrix(ctx: click.Context, quiet: bool, **kwargs: Any) -> None: required=False, multiple=True, callback=cli_helpers.yaml_param_callback, - help="Additional parameters for the read from the" " file in YAML format", + help="Additional parameters for the read from the file in YAML format", ) @click.pass_context def job(ctx: click.Context, **kwargs: Any) -> None: diff --git a/perun/cli_groups/utils_cli.py b/perun/cli_groups/utils_cli.py index 64c3bbb1b..fb2974277 100644 --- a/perun/cli_groups/utils_cli.py +++ b/perun/cli_groups/utils_cli.py @@ -53,8 +53,10 @@ def utils_group() -> None: "-ne", default=False, is_flag=True, - help="Will open the newly created files in the editor specified by " - ":ckey:`general.editor` configuration key.", + help=( + "Will open the newly created files in the editor specified by " + ":ckey:`general.editor` configuration key." + ), ) @click.option( "--supported-type", @@ -143,8 +145,10 @@ def temp_list(root: str, **kwargs: Any) -> None: "-w", flag_value=True, default=False, - help="Warn the user (and abort the deletion with no files deleted) if protected files" - " are present.", + help=( + "Warn the user (and abort the deletion with no files deleted) if protected files" + " are present." + ), ) @click.option( "--force", @@ -158,7 +162,7 @@ def temp_list(root: str, **kwargs: Any) -> None: "-k", flag_value=True, default=False, - help="If path refers to directory, empty tmp/ directories and subdirectories " "will be kept.", + help="If path refers to directory, empty tmp/ directories and subdirectories will be kept.", ) def temp_delete(path: str, warn: bool, force: bool, **kwargs: Any) -> None: """Deletes the temporary file or directory. @@ -200,8 +204,10 @@ def stats_group() -> None: type=int, default=stats.DEFAULT_STATS_LIST_TOP, show_default=True, - help="Show only stat files from top N minor versions. Show all results if set to 0. " - "The minor version to start at can be changed using --from-minor.", + help=( + "Show only stat files from top N minor versions. Show all results if set to 0. " + "The minor version to start at can be changed using --from-minor." + ), ) @click.option( "--from-minor", @@ -257,8 +263,10 @@ def stats_list_files(**kwargs: Any) -> None: type=int, default=stats.DEFAULT_STATS_LIST_TOP, show_default=True, - help="Show only top N minor versions. Show all versions if set to 0. " - "The minor version to start at can be changed using --from-minor.", + help=( + "Show only top N minor versions. Show all versions if set to 0. " + "The minor version to start at can be changed using --from-minor." + ), ) @click.option( "--from-minor", @@ -322,8 +330,10 @@ def stats_delete_group() -> None: metavar="", is_eager=True, callback=cli_helpers.check_stats_minor_callback, - help="Delete the stats file in the specified minor version (HEAD if not specified) " - 'or across all the minor versions if set to ".".', + help=( + "Delete the stats file in the specified minor version (HEAD if not specified) " + 'or across all the minor versions if set to ".".' + ), ) @click.option( "--keep-directory", diff --git a/perun/collect/bounds/run.py b/perun/collect/bounds/run.py index bad759572..b90cd70e3 100644 --- a/perun/collect/bounds/run.py +++ b/perun/collect/bounds/run.py @@ -139,8 +139,10 @@ def lookup_source_files(ctx: click.Context, __: click.Option, value: list[str]) multiple=True, metavar="", callback=lookup_source_files, - help="Directory, where source C files are stored. All of the existing files with " - "valid extensions (.c).", + help=( + "Directory, where source C files are stored. All of the existing files with " + "valid extensions (.c)." + ), ) def bounds(ctx: click.Context, **kwargs: Any) -> None: """Generates `memory` performance profile, capturing memory allocations of diff --git a/perun/collect/complexity/makefiles.py b/perun/collect/complexity/makefiles.py index 24ad0affa..30b42d041 100644 --- a/perun/collect/complexity/makefiles.py +++ b/perun/collect/complexity/makefiles.py @@ -223,8 +223,7 @@ def _link_libraries(cmake_file: TextIO, library_vars: list[str], target_name: st libraries = " ".join("${{{0}}}".format(lib) for lib in library_vars) # Create the target cmake_file.write( - f"\n# Link the libraries to the target\n" - f"target_link_libraries({target_name} {libraries})\n" + f"\n# Link the libraries to the target\ntarget_link_libraries({target_name} {libraries})\n" ) @@ -239,16 +238,20 @@ def _get_libs_path() -> str: libs_dir = os.path.join(os.path.dirname(__file__), "lib") if not _libraries_exist(libs_dir): log.cprintln( - "\nOne or more required libraries are missing - please compile them, " - "otherwise the data collection will not work.", + ( + "\nOne or more required libraries are missing - please compile them, " + "otherwise the data collection will not work." + ), "white", ) return libs_dir except NameError: # If the __file__ is not available, the user has to supply the libraries manually log.cprintln( - "\nUnable to locate the directory with profiling libraries automatically, " - 'please supply them manually into the "--target-dir" location', + ( + "\nUnable to locate the directory with profiling libraries automatically, " + 'please supply them manually into the "--target-dir" location' + ), "white", ) return "${CMAKE_SOURCE_DIR}" diff --git a/perun/collect/complexity/run.py b/perun/collect/complexity/run.py index 4691ba241..cce89955b 100644 --- a/perun/collect/complexity/run.py +++ b/perun/collect/complexity/run.py @@ -263,7 +263,7 @@ def _validate_input(**kwargs: Any) -> None: os.makedirs(target_dir) if os.path.exists(target_dir) and not os.path.isdir(target_dir): raise click.exceptions.BadParameter( - "The given --target-dir already exists and " "is not a directory" + "The given --target-dir already exists and is not a directory" ) if not kwargs["files"]: raise click.exceptions.BadParameter("At least one --files parameter must be supplied.") @@ -301,9 +301,11 @@ def _sampling_to_dictionary( "-f", type=click.Path(exists=True, resolve_path=True), multiple=True, - help="List of C/C++ source files that will be used to build the" - " custom binary with injected profiling commands. Must be valid" - " resolvable path", + help=( + "List of C/C++ source files that will be used to build the" + " custom binary with injected profiling commands. Must be valid" + " resolvable path" + ), ) @click.option("--rules", "-r", type=str, multiple=True, help="Marks the function for profiling.") @click.option( @@ -311,8 +313,10 @@ def _sampling_to_dictionary( "-if", type=str, default=configurator.DEFAULT_DATA_FILENAME, - help="Sets the different path for internal output filename for" - " storing temporary profiling data file name.", + help=( + "Sets the different path for internal output filename for" + " storing temporary profiling data file name." + ), ) @click.option( "--internal-storage-size", diff --git a/perun/collect/memory/run.py b/perun/collect/memory/run.py index 443d6ca3c..9301295c9 100644 --- a/perun/collect/memory/run.py +++ b/perun/collect/memory/run.py @@ -142,27 +142,31 @@ def after( "-s", default=DEFAULT_SAMPLING, type=click.FLOAT, - help="Sets the sampling interval for profiling the allocations." - " I.e. memory snapshots will be collected each " - " seconds.", + help=( + "Sets the sampling interval for profiling the allocations." + " I.e. memory snapshots will be collected each " + " seconds." + ), ) @click.option( "--no-source", multiple=True, - help="Will exclude allocations done from file during" " the profiling.", + help="Will exclude allocations done from file during the profiling.", ) @click.option( "--no-func", multiple=True, - help="Will exclude allocations done by function during" " the profiling.", + help="Will exclude allocations done by function during the profiling.", ) @click.option( "--all", "-a", is_flag=True, default=False, - help="Will record the full trace for each allocation, i.e. it" - " will include all allocators and even unreachable records.", + help=( + "Will record the full trace for each allocation, i.e. it" + " will include all allocators and even unreachable records." + ), ) @click.pass_context def memory(ctx: click.Context, **kwargs: Any) -> None: diff --git a/perun/collect/trace/optimizations/diff_tracing.py b/perun/collect/trace/optimizations/diff_tracing.py index 590c47d32..baa189bd5 100644 --- a/perun/collect/trace/optimizations/diff_tracing.py +++ b/perun/collect/trace/optimizations/diff_tracing.py @@ -17,40 +17,10 @@ # The set of ASM JUMP instruction that are omitted during the operands check JUMP_INSTRUCTIONS = { - "call", - "jmp", - "je", - "jne", - "jz", - "jnz", - "jg", - "jge", - "jnle", - "jnl", - "jl", - "jle", - "jnge", - "jng", - "ja", - "jae", - "jnbe", - "jnb", - "jb", - "jbe", - "jnae", - "jna", - "jxcz", - "jc", - "jnc", - "jo", - "jno", - "jp", - "jpe", - "jnp", - "jpo", - "js", - "jns", -} + "call", "jmp", "je", "jne", "jz", "jnz", "jg", "jge", "jnle", "jnl", "jl", "jle", "jnge", + "jng", "ja", "jae", "jnbe", "jnb", "jb", "jbe", "jnae", "jna", "jxcz", "jc", "jnc", "jo", + "jno", "jp", "jpe", "jnp", "jpo", "js", "jns", +} # fmt: skip # Delimiters used in the disassembly operands specification diff --git a/perun/collect/trace/run.py b/perun/collect/trace/run.py index 70df553e8..b6818288f 100644 --- a/perun/collect/trace/run.py +++ b/perun/collect/trace/run.py @@ -119,8 +119,7 @@ def after(**kwargs): # Inform the user WATCH_DOG.info( - "Processing raw performance data. " - "Note that this may take a while for large raw data files." + "Processing raw performance data. Note that this may take a while for large raw data files." ) data_size = os.stat(kwargs["config"].engine.data).st_size metrics.add_metric("data_size", data_size) @@ -176,9 +175,11 @@ def teardown(**kwargs): "-e", type=click.Choice(CollectEngine.available()), default=CollectEngine.default(), - help="Sets the data collection engine to be used:\n" - " - stap: the SystemTap framework\n" - " - ebpf: the eBPF framework", + help=( + "Sets the data collection engine to be used:\n" + " - stap: the SystemTap framework\n" + " - ebpf: the eBPF framework" + ), ) @click.option( "--strategy", @@ -186,8 +187,10 @@ def teardown(**kwargs): type=click.Choice(Strategy.supported()), default=Strategy.default(), required=True, - help="Select strategy for probing the binary. See documentation for" - " detailed explanation for each strategy.", + help=( + "Select strategy for probing the binary. See documentation for" + " detailed explanation for each strategy." + ), ) @click.option( "--func", @@ -215,8 +218,10 @@ def teardown(**kwargs): "-g", type=int, default=1, - help="Set the global sample for all probes, sampling parameter for specific" - " rules have higher priority.", + help=( + "Set the global sample for all probes, sampling parameter for specific" + " rules have higher priority." + ), ) @click.option( "--with-usdt/--no-usdt", @@ -227,8 +232,10 @@ def teardown(**kwargs): "--binary", "-b", type=click.Path(exists=True), - help="The profiled executable. If not set, then the command is considered " - "to be the profiled executable and is used as a binary parameter.", + help=( + "The profiled executable. If not set, then the command is considered " + "to be the profiled executable and is used as a binary parameter." + ), ) @click.option( "--libs", @@ -244,16 +251,20 @@ def teardown(**kwargs): "-t", type=float, default=0, - help="Set time limit (in seconds) for the profiled command, i.e. the command will be " - "terminated after reaching the time limit. Useful for, e.g., endless commands.", + help=( + "Set time limit (in seconds) for the profiled command, i.e. the command will be " + "terminated after reaching the time limit. Useful for, e.g., endless commands." + ), ) @click.option( "--zip-temps", "-z", is_flag=True, default=False, - help="Zip and compress the temporary files (SystemTap log, raw performance data, " - "watchdog log, etc.) into the Perun log directory before deleting them.", + help=( + "Zip and compress the temporary files (SystemTap log, raw performance data, " + "watchdog log, etc.) into the Perun log directory before deleting them." + ), ) @click.option( "--keep-temps", @@ -288,21 +299,25 @@ def teardown(**kwargs): "-o", type=click.Choice(OutputHandling.to_list()), default=OutputHandling.DEFAULT.value, - help="Sets the output handling of the profiled command:\n" - " - default: the output is displayed in the terminal\n" - " - capture: the output is being captured into a file as well as displayed" - " in the terminal (note that buffering causes a delay in the terminal output)\n" - " - suppress: redirects the output to the DEVNULL", + help=( + "Sets the output handling of the profiled command:\n" + " - default: the output is displayed in the terminal\n" + " - capture: the output is being captured into a file as well as displayed" + " in the terminal (note that buffering causes a delay in the terminal output)\n" + " - suppress: redirects the output to the DEVNULL" + ), ) @click.option( "--diagnostics", "-i", is_flag=True, default=False, - help="Enable detailed surveillance mode of the collector. The collector turns on " - "detailed logging (watchdog), verbose trace, capturing output etc. and stores " - "the logs and files in an archive (zip-temps) in order to provide as much " - "diagnostic data as possible for further inspection.", + help=( + "Enable detailed surveillance mode of the collector. The collector turns on " + "detailed logging (watchdog), verbose trace, capturing output etc. and stores " + "the logs and files in an archive (zip-temps) in order to provide as much " + "diagnostic data as possible for further inspection." + ), ) @click.option( "--stap-cache-off", diff --git a/perun/collect/trace/systemtap/script_compact.py b/perun/collect/trace/systemtap/script_compact.py index ff77e7141..94e693852 100644 --- a/perun/collect/trace/systemtap/script_compact.py +++ b/perun/collect/trace/systemtap/script_compact.py @@ -243,10 +243,8 @@ def _add_thread_probes(handle, binary, sampling_on): type=int(RecordType.THREAD_END), timestamp=STOPWATCH_NAME ), sampling_cleanup=( - ( - "delete {sampling_cnt}[tid(), *]\n delete {sampling_flag}[tid(), *]".format( - sampling_cnt=ARRAY_SAMPLE_COUNTER, sampling_flag=ARRAY_SAMPLE_FLAG - ) + "delete {sampling_cnt}[tid(), *]\n delete {sampling_flag}[tid(), *]".format( + sampling_cnt=ARRAY_SAMPLE_COUNTER, sampling_flag=ARRAY_SAMPLE_FLAG ) if sampling_on else "# Sampling cleanup omitted" diff --git a/perun/collect/trace/values.py b/perun/collect/trace/values.py index 445525851..3d567558c 100644 --- a/perun/collect/trace/values.py +++ b/perun/collect/trace/values.py @@ -162,10 +162,7 @@ def check(dependencies): MICRO_TO_SECONDS = 1000000.0 # The conversion constant for collected time records NANO_TO_SECONDS = 1000000000.0 # The conversion constant for collected time records DEFAULT_SAMPLE = 20 # The default global sampling for 'sample' strategies if not set by user -SUFFIX_DELIMITERS = ( - "_", - "-", -) # The set of supported delimiters between probe and its suffix +SUFFIX_DELIMITERS = ("_", "-") # The set of supported delimiters between probe and its suffix PS_FORMAT = "pid,ppid,pgid,cmd" # The format specification for an output from the 'ps' utility # Various sleep / wait related constants diff --git a/perun/logic/index.py b/perun/logic/index.py index 23fc3ffbb..9ff0844e8 100644 --- a/perun/logic/index.py +++ b/perun/logic/index.py @@ -315,7 +315,7 @@ def walk_index(index_handle: BinaryIO) -> Iterable[BasicIndexEntry]: index_version = store.read_int_from_handle(index_handle) if index_version > INDEX_VERSION: raise MalformedIndexFileException( - f"read index file is in format of different index version " + "read index file is in format of different index version " f"(read index file = {index_version}, supported = {INDEX_VERSION})" ) @@ -354,7 +354,8 @@ def print_index_from_handle(index_handle: BinaryIO) -> None: number_of_entries = store.read_int_from_handle(index_handle) print( - f"{index_prefix.decode('utf-8')}, index version {index_version} with {number_of_entries} entries\n" + f"{index_prefix.decode('utf-8')}, index version {index_version} with" + f" {number_of_entries} entries\n" ) for entry in walk_index(index_handle): diff --git a/perun/logic/temp.py b/perun/logic/temp.py index 8584415e0..81293b3d6 100644 --- a/perun/logic/temp.py +++ b/perun/logic/temp.py @@ -136,7 +136,7 @@ def temp_path(path: str) -> str: # The resulting path might end up out of tmp/ for both absolute or relative paths if not path.startswith(tmp_location): raise exceptions.InvalidTempPathException( - "The resulting path '{}' is not located in " "the perun tmp/ directory.".format(path) + "The resulting path '{}' is not located in the perun tmp/ directory.".format(path) ) return path @@ -525,7 +525,7 @@ def _delete_files(tmp_files: list[str], ignore_protected: bool, force: bool) -> if protected and not ignore_protected: # Abort the operation if ignore_protected is not set raise exceptions.ProtectedTempException( - "Aborted temporary files deletion due to a " "presence of protected files." + "Aborted temporary files deletion due to a presence of protected files." ) # Delete all the files and their potential records in the index for file in tmp_files: diff --git a/perun/postprocess/clusterizer/run.py b/perun/postprocess/clusterizer/run.py index c7f2de906..0b18f9fb2 100644 --- a/perun/postprocess/clusterizer/run.py +++ b/perun/postprocess/clusterizer/run.py @@ -150,7 +150,7 @@ def postprocess( default=0.01, type=click.FLOAT, required=False, - help="Specifies the width of the window" ", i.e. how many values will be taken by window.", + help="Specifies the width of the window, i.e. how many values will be taken by window.", ) @click.option( "--relative-window-width", diff --git a/perun/postprocess/kernel_regression/methods.py b/perun/postprocess/kernel_regression/methods.py index 18e730ed7..00f4b75c2 100644 --- a/perun/postprocess/kernel_regression/methods.py +++ b/perun/postprocess/kernel_regression/methods.py @@ -447,7 +447,10 @@ def valid_range_values( else: raise click_exp.BadOptionUsage( param.name or "", - f"Invalid values: 1.value must be < then the 2.value ({value[0]:.2f} >= {value[1]:.2f})", + ( + f"Invalid values: 1.value must be < then the 2.value ({value[0]:.2f} >=" + f" {value[1]:.2f})" + ), ) @@ -471,8 +474,10 @@ def valid_step_size(step: float, step_range: tuple[float, float]) -> bool: else: raise click_exp.BadOptionUsage( "--gamma-step/-gs", - f"Invalid values: step must be < then the length of the range " - f"({step:.5f} >= {range_length:.5f}) for range {step_range[0]}:{step_range[1]}", + ( + "Invalid values: step must be < then the length of the range " + f"({step:.5f} >= {range_length:.5f}) for range {step_range[0]}:{step_range[1]}" + ), ) diff --git a/perun/postprocess/kernel_regression/run.py b/perun/postprocess/kernel_regression/run.py index ef7d832b9..5f51b7329 100644 --- a/perun/postprocess/kernel_regression/run.py +++ b/perun/postprocess/kernel_regression/run.py @@ -98,10 +98,12 @@ def postprocess( "-bw", type=click.Choice(_BANDWIDTH_METHODS), default=_BANDWIDTH_METHODS[0], - help='Provides the method for bandwidth selection. Supported values are: "cv-ls": ' - 'least-squares cross validation and "aic": AIC Hurvich bandwidth estimation. ' - 'Default is "cv-ls". For more information about these methods you can visit ' - "Perun Documentation.", + help=( + 'Provides the method for bandwidth selection. Supported values are: "cv-ls": ' + 'least-squares cross validation and "aic": AIC Hurvich bandwidth estimation. ' + 'Default is "cv-ls". For more information about these methods you can visit ' + "Perun Documentation." + ), ) @click.option( "--efficient/--uniformly", @@ -291,8 +293,7 @@ def estimator_settings(ctx: click.Context, **kwargs: Any) -> None: "-bv", type=click.FloatRange(min=1e-10, max=None), required=True, - help="The float value of defined by user, which " - "will be used at kernel regression.", + help="The float value of defined by user, which will be used at kernel regression.", ) @click.pass_context def user_selection(ctx: click.Context, **kwargs: Any) -> None: @@ -336,9 +337,11 @@ def user_selection(ctx: click.Context, **kwargs: Any) -> None: "-bm", type=click.Choice(methods.BW_SELECTION_METHODS), default=methods.BW_SELECTION_METHODS[0], - help="Provides the helper method to determine the kernel bandwidth. The " - " will be used to compute the bandwidth, which will be " - "used at kernel regression.", + help=( + "Provides the helper method to determine the kernel bandwidth. The " + " will be used to compute the bandwidth, which will be " + "used at kernel regression." + ), ) @click.pass_context def method_selection(ctx: click.Context, **kwargs: Any) -> None: @@ -607,9 +610,11 @@ def kernel_smoothing(ctx: click.Context, **kwargs: Any) -> None: "-gs", type=click.FloatRange(min=1e-10, max=None), default=_DEFAULT_GAMMA_STEP, - help="Provides the size of the step, with which will be executed the iteration over " - "the given . Cannot be greater than length of , else " - "will be set to value of the lower bound of the .", + help=( + "Provides the size of the step, with which will be executed the iteration over " + "the given . Cannot be greater than length of , else " + "will be set to value of the lower bound of the ." + ), ) @click.pass_context def kernel_ridge(ctx: click.Context, **kwargs: Any) -> None: diff --git a/perun/postprocess/moving_average/run.py b/perun/postprocess/moving_average/run.py index c82011c5b..2603f3b4b 100644 --- a/perun/postprocess/moving_average/run.py +++ b/perun/postprocess/moving_average/run.py @@ -79,14 +79,18 @@ def common_sma_options( "--window_width", "-ww", type=click.IntRange(min=1, max=None), - help="Size of the moving window. This is a number of observations used " - "for calculating the statistic. Each window will be a fixed size.", + help=( + "Size of the moving window. This is a number of observations used " + "for calculating the statistic. Each window will be a fixed size." + ), ), click.option( "--center/--no-center", default=_DEFAULT_CENTER, - help="If set to False, the result is set to the right edge of the " - "window, else is result set to the center of the window", + help=( + "If set to False, the result is set to the right edge of the " + "window, else is result set to the center of the window" + ), ), ] return functools.reduce(lambda x, option: option(x), options, func_obj) @@ -97,8 +101,10 @@ def common_sma_options( "--window_type", "-wt", type=click.Choice(_WINDOW_TYPES), - help="Provides the window type, if not set then all points are evenly weighted. " - "For further information about window types see the notes in the documentation.", + help=( + "Provides the window type, if not set then all points are evenly weighted. " + "For further information about window types see the notes in the documentation." + ), ) @common_sma_options @click.pass_context @@ -175,9 +181,11 @@ def simple_moving_median(ctx: click.Context, **kwargs: Any) -> None: callback=methods.validate_decay_param, default=_DEFAULT_DECAY, type=click.Tuple([click.Choice(methods.get_supported_decay_params()), float]), - help='Exactly one of "com", "span", "halflife", "alpha" can be provided. Allowed ' - "values and relationship between the parameters are specified in the " - "documentation (e.g. --decay=com 3).", + help=( + 'Exactly one of "com", "span", "halflife", "alpha" can be provided. Allowed ' + "values and relationship between the parameters are specified in the " + "documentation (e.g. --decay=com 3)." + ), ) @click.pass_context def exponential_moving_average(ctx: click.Context, **kwargs: Any) -> None: @@ -227,8 +235,10 @@ def exponential_moving_average(ctx: click.Context, **kwargs: Any) -> None: "--min_periods", "-mp", type=click.IntRange(min=1, max=None), - help="Provides the minimum number of observations in window required to have a value." - " If the number of possible observations smaller then result is NaN.", + help=( + "Provides the minimum number of observations in window required to have a value." + " If the number of possible observations smaller then result is NaN." + ), ) @cli_helpers.resources_key_options @click.pass_context diff --git a/perun/postprocess/regression_analysis/run.py b/perun/postprocess/regression_analysis/run.py index c90f7b72c..d448e5dfb 100644 --- a/perun/postprocess/regression_analysis/run.py +++ b/perun/postprocess/regression_analysis/run.py @@ -86,7 +86,7 @@ def store_model_counts(analysis: list[dict[str, Any]]) -> None: type=click.Choice(methods.get_supported_param_methods()), required=True, multiple=False, - help="Will use the to find the best fitting models for" " the given profile.", + help="Will use the to find the best fitting models for the given profile.", ) @click.option( "--regression_models", diff --git a/perun/postprocess/regressogram/run.py b/perun/postprocess/regressogram/run.py index f74d57b60..cfb4074d9 100644 --- a/perun/postprocess/regressogram/run.py +++ b/perun/postprocess/regressogram/run.py @@ -71,8 +71,10 @@ def postprocess( required=False, default=_DEFAULT_STATISTIC, multiple=False, - help="Will use the to compute the values " - "for points within each bucket of regressogram.", + help=( + "Will use the to compute the values " + "for points within each bucket of regressogram." + ), ) @cli_helpers.resources_key_options @pass_profile diff --git a/perun/profile/helpers.py b/perun/profile/helpers.py index 5b8ed9f5b..6d79a3432 100644 --- a/perun/profile/helpers.py +++ b/perun/profile/helpers.py @@ -434,8 +434,10 @@ def sort_profiles(profile_list: list["ProfileInfo"], reverse_profiles: bool = Tr perun_log.warn( "invalid sort key '{}'".format(sort_order) + " Profiles will be sorted by '{}'\n\n".format(sort_order) - + "Please set sort key in config or cli to one" - " of ({}".format(", ".join(ProfileInfo.valid_attributes)) + ")" + + "Please set sort key in config or cli to one of ({}".format( + ", ".join(ProfileInfo.valid_attributes) + ) + + ")" ) sort_order = DEFAULT_SORT_KEY except MissingConfigSectionException: @@ -443,7 +445,8 @@ def sort_profiles(profile_list: list["ProfileInfo"], reverse_profiles: bool = Tr "missing set option 'format.sort_profiles_by'!" " Profiles will be sorted by '{}'\n\n".format(sort_order) + "Please run 'perun config edit' and set 'format.sort_profiles_by' to one" - " of ({}".format(", ".join(ProfileInfo.valid_attributes)) + ")" + " of ({}".format(", ".join(ProfileInfo.valid_attributes)) + + ")" ) profile_list.sort(key=operator.attrgetter(sort_order), reverse=reverse_profiles) diff --git a/perun/thirdparty/pyqt_fit_port/kde_methods.py b/perun/thirdparty/pyqt_fit_port/kde_methods.py index 95ff8c3fa..98eaeda78 100644 --- a/perun/thirdparty/pyqt_fit_port/kde_methods.py +++ b/perun/thirdparty/pyqt_fit_port/kde_methods.py @@ -865,7 +865,7 @@ def pdf(self, kde, points, out): return KDE1DMethod.pdf(self, kde, points, out) if not kde.closed: raise ValueError( - "Cyclic boundary conditions can only be used with " "closed or un-bounded domains." + "Cyclic boundary conditions can only be used with closed or un-bounded domains." ) xdata = kde.xdata @@ -902,7 +902,7 @@ def cdf(self, kde, points, out): return KDE1DMethod.cdf(self, kde, points, out) if not kde.closed: raise ValueError( - "Cyclic boundary conditions can only be used with " "closed or unbounded domains." + "Cyclic boundary conditions can only be used with closed or unbounded domains." ) xdata = kde.xdata @@ -948,7 +948,7 @@ def grid(self, kde, N=None, cut=None): return KDE1DMethod.grid(self, kde, N, cut) if kde.bounded and not kde.closed: raise ValueError( - "Error, cyclic boundary conditions require " "a closed or un-bounded domain." + "Error, cyclic boundary conditions require a closed or un-bounded domain." ) bw = kde.bandwidth * kde.lambdas data = kde.xdata @@ -982,7 +982,7 @@ def cdf_grid(self, kde, N=None, cut=None): if kde.lambdas.shape: return KDE1DMethod.cdf_grid(self, kde, N, cut) if not kde.closed: - raise ValueError("Error, cyclic boundary conditions require " "a closed domain.") + raise ValueError("Error, cyclic boundary conditions require a closed domain.") N = self.grid_size(N) if N <= 2**12: diff --git a/perun/thirdparty/pyqt_fit_port/utils.py b/perun/thirdparty/pyqt_fit_port/utils.py index b62916d5d..4a87718b3 100644 --- a/perun/thirdparty/pyqt_fit_port/utils.py +++ b/perun/thirdparty/pyqt_fit_port/utils.py @@ -199,7 +199,7 @@ def namedtuple(typename, field_names, verbose=False, rename=False): for name in (typename,) + field_names: if not all(c.isalnum() or c == "_" for c in name): raise ValueError( - f"Type names and field names can only contain alphanumeric characters " + "Type names and field names can only contain alphanumeric characters " f"and underscores: {name}" ) if _iskeyword(name): @@ -257,9 +257,10 @@ def __getnewargs__(self): reprtxt=reprtxt, ) for i, name in enumerate(field_names): - template += ( - " %s = _property(_itemgetter(%d), " - "doc='Alias for field number %d')\n" % (name, i, i) + template += " %s = _property(_itemgetter(%d), doc='Alias for field number %d')\n" % ( + name, + i, + i, ) if verbose: print(template) diff --git a/perun/utils/cli_helpers.py b/perun/utils/cli_helpers.py index 55f052d4c..c54e5b0ad 100644 --- a/perun/utils/cli_helpers.py +++ b/perun/utils/cli_helpers.py @@ -247,7 +247,10 @@ def config_key_validation_callback(_: click.Context, param: click.Option, value: :returns object: value for the argument """ if not config.is_valid_key(str(value)): - err_msg = f" argument '{value}' for {str(param.param_type_name)} config operation is in invalid format. " + err_msg = ( + f" argument '{value}' for {str(param.param_type_name)} config operation is in" + " invalid format. " + ) err_msg += "Valid key should be represented as sections delimited by dot (.), " err_msg += "e.g. general.paging is valid key." raise click.BadParameter(err_msg) @@ -549,7 +552,8 @@ def lookup_stats_file_callback(ctx: click.Context, _: click.Argument, value: str return stats.get_stats_file_path(value, in_minor, True) except StatsFileNotFoundException: raise click.BadParameter( - f"The requested file '{value}' does not exist in the stats directory for minor version '{in_minor}'." + f"The requested file '{value}' does not exist in the stats directory for minor" + f" version '{in_minor}'." ) return value diff --git a/perun/utils/exceptions.py b/perun/utils/exceptions.py index 596f12ed9..2509679df 100644 --- a/perun/utils/exceptions.py +++ b/perun/utils/exceptions.py @@ -35,7 +35,7 @@ def __init__(self, section_key: str) -> None: def __str__(self) -> str: return ( f"key '{self.section_key}' is not specified in configuration.\n" - f"See docs/config.rst for more details." + "See docs/config.rst for more details." ) @@ -49,7 +49,10 @@ def __init__(self, position: int, total: int, tag_source: str) -> None: self.tag = tag_source def __str__(self) -> str: - return f"invalid tag '{self.pos}@{self.tag}' (choose from interval <0@{self.tag}, {self.total}@{self.tag}>)" + return ( + f"invalid tag '{self.pos}@{self.tag}' (choose from interval <0@{self.tag}," + f" {self.total}@{self.tag}>)" + ) class ExternalEditorErrorException(Exception): @@ -334,7 +337,10 @@ def __init__(self, binary: str) -> None: """ super().__init__("") self.binary = binary - self.msg = f"Supplied binary parameter '{self.binary}' does not exist or is not an executable ELF file." + self.msg = ( + f"Supplied binary parameter '{self.binary}' does not exist or is not an executable ELF" + " file." + ) def __str__(self) -> str: return self.msg @@ -353,7 +359,10 @@ def __init__(self, logfile: str, code: int) -> None: self.code = code def __str__(self) -> str: - return f"SystemTap script compilation failure (code: {self.code}), see the corresponding {self.logfile} file." + return ( + f"SystemTap script compilation failure (code: {self.code}), see the corresponding" + f" {self.logfile} file." + ) class SystemTapStartupException(Exception): diff --git a/perun/utils/script_helpers.py b/perun/utils/script_helpers.py index c13918daa..a53a087fe 100644 --- a/perun/utils/script_helpers.py +++ b/perun/utils/script_helpers.py @@ -49,8 +49,8 @@ def template_name_filter(template_name: str) -> bool: ): log.error( f"cannot use {perun_dev_dir} as target developer directory " - f"(either not writeable or does not exist)\n\n" - f"Perhaps you are not working from perun dev folder?" + "(either not writeable or does not exist)\n\n" + "Perhaps you are not working from perun dev folder?" ) # Initialize the jinja2 environment and load all templates for template_type set diff --git a/perun/view/bars/run.py b/perun/view/bars/run.py index 1ad6a0399..a155d5eb8 100644 --- a/perun/view/bars/run.py +++ b/perun/view/bars/run.py @@ -51,8 +51,7 @@ def process_title(ctx: click.Context, _: click.Option, value: str) -> str: metavar="", is_eager=True, callback=cli_helpers.process_resource_key_param, - help="Sets key that is source of the data for the bars," - " i.e. what will be displayed on Y axis.", + help="Sets key that is source of the data for the bars, i.e. what will be displayed on Y axis.", ) @click.option( "--per", @@ -74,7 +73,7 @@ def process_title(ctx: click.Context, _: click.Option, value: str) -> str: metavar="", is_eager=True, callback=cli_helpers.process_resource_key_param, - help="Sets the key that will be used either for stacking or" " grouping of values", + help="Sets the key that will be used either for stacking or grouping of values", ) @click.option( "--stacked", @@ -83,7 +82,7 @@ def process_title(ctx: click.Context, _: click.Option, value: str) -> str: flag_value="stacked", default=True, is_eager=True, - help="Will stack the values by specified by" " option --by.", + help="Will stack the values by specified by option --by.", ) @click.option( "--grouped", @@ -91,7 +90,7 @@ def process_title(ctx: click.Context, _: click.Option, value: str) -> str: "grouping_type", flag_value="grouped", is_eager=True, - help="Will stack the values by specified by" " option --by.", + help="Will stack the values by specified by option --by.", ) # Bokeh graph specific @click.option( @@ -130,7 +129,7 @@ def process_title(ctx: click.Context, _: click.Option, value: str) -> str: "-v", default=False, is_flag=True, - help="The generated graph will be immediately opened in the" " browser (firefox will be used).", + help="The generated graph will be immediately opened in the browser (firefox will be used).", ) @pass_profile def bars(profile: Profile, filename: str, view_in_browser: bool, **kwargs: Any) -> None: diff --git a/perun/view/flow/run.py b/perun/view/flow/run.py index 7891cb7ce..748ca0e7d 100644 --- a/perun/view/flow/run.py +++ b/perun/view/flow/run.py @@ -52,9 +52,11 @@ def process_title(ctx: click.Context, _: click.Option, value: str) -> str: metavar="", is_eager=True, callback=cli_helpers.process_resource_key_param, - help="Sets key that is source of the data for the flow," - " i.e. what will be displayed on Y axis, e.g. the amount of" - " resources.", + help=( + "Sets key that is source of the data for the flow," + " i.e. what will be displayed on Y axis, e.g. the amount of" + " resources." + ), ) @click.option( "--through", @@ -66,9 +68,11 @@ def process_title(ctx: click.Context, _: click.Option, value: str) -> str: is_eager=True, callback=cli_helpers.process_continuous_key, default="snapshots", - help="Sets key that is source of the data value, i.e. the" - " independent variable, like e.g. snapshots or size of the" - " structure.", + help=( + "Sets key that is source of the data value, i.e. the" + " independent variable, like e.g. snapshots or size of the" + " structure." + ), ) @click.option( "--by", @@ -79,16 +83,20 @@ def process_title(ctx: click.Context, _: click.Option, value: str) -> str: metavar="", is_eager=True, callback=cli_helpers.process_resource_key_param, - help="For each one graph will be output, e.g." - " for each subtype or for each location of resource.", + help=( + "For each one graph will be output, e.g." + " for each subtype or for each location of resource." + ), ) @click.option( "--stacked", "-s", is_flag=True, default=False, - help="Will stack the y axis values for different keys" - " on top of each other. Additionaly shows the sum of the values.", + help=( + "Will stack the y axis values for different keys" + " on top of each other. Additionaly shows the sum of the values." + ), ) @click.option( "--accumulate/--no-accumulate", @@ -132,7 +140,7 @@ def process_title(ctx: click.Context, _: click.Option, value: str) -> str: "-v", default=False, is_flag=True, - help="The generated graph will be immediately opened in the" " browser (firefox will be used).", + help="The generated graph will be immediately opened in the browser (firefox will be used).", ) @pass_profile # Fixme: Consider breaking this to two diff --git a/perun/view/scatter/factory.py b/perun/view/scatter/factory.py index 4984257b2..d3bf7165c 100644 --- a/perun/view/scatter/factory.py +++ b/perun/view/scatter/factory.py @@ -258,8 +258,7 @@ def _build_model_legend(model: ProfileModel) -> str: if model["model"] == "moving_average": # Create a legend for moving_average model return ( - f"{model['moving_method']}: window={model['window_width']}, " - f"R^2={model['r_square']:.3f}" + f"{model['moving_method']}: window={model['window_width']}, R^2={model['r_square']:.3f}" ) if model["model"] == "kernel_regression": # Create a legend for kernel model diff --git a/perun/view/tableof/run.py b/perun/view/tableof/run.py index b4185982d..2d7154496 100644 --- a/perun/view/tableof/run.py +++ b/perun/view/tableof/run.py @@ -106,7 +106,10 @@ def process_filter(ctx: click.Context, option: click.Option, value: list[str]) - if val[0] not in headers: raise click.BadOptionUsage( option.name or "", - f"invalid key choice for filtering: {val[0]} (choose from {', '.join(headers)})", + ( + f"invalid key choice for filtering: {val[0]} (choose from" + f" {', '.join(headers)})" + ), ) return list(value) return value @@ -181,9 +184,11 @@ def process_output_file(ctx: click.Context, _: click.Option, value: str) -> str: "-tf", "output_to", flag_value="file", - help="The table will be saved into a file. By default, the name of the output file" - " is automatically generated, unless `--output-file` option does not specify" - " the name of the output file.", + help=( + "The table will be saved into a file. By default, the name of the output file" + " is automatically generated, unless `--output-file` option does not specify" + " the name of the output file." + ), default=True, ) @click.option( @@ -255,8 +260,10 @@ def tableof(*_: Any, **__: Any) -> None: multiple=True, metavar="", callback=process_headers, - help="Sets the headers that will be displayed in the table. If none are stated " - "then all of the headers will be outputed", + help=( + "Sets the headers that will be displayed in the table. If none are stated " + "then all of the headers will be outputed" + ), ) @click.option( "--sort-by", @@ -274,9 +281,11 @@ def tableof(*_: Any, **__: Any) -> None: metavar=" ", callback=process_filter, multiple=True, - help="Filters the table to rows, where == . If the `--filter` is set" - " several times, then rows satisfying all rules will be selected for different" - " keys; and the rows satisfying some rule will be selected for same key.", + help=( + "Filters the table to rows, where == . If the `--filter` is set" + " several times, then rows satisfying all rules will be selected for different" + " keys; and the rows satisfying some rule will be selected for same key." + ), ) @click.pass_context def resources( @@ -316,8 +325,10 @@ def resources( multiple=True, metavar="", callback=process_headers, - help="Sets the headers that will be displayed in the table. If none are stated " - "then all of the headers will be outputed", + help=( + "Sets the headers that will be displayed in the table. If none are stated " + "then all of the headers will be outputed" + ), ) @click.option( "--sort-by", @@ -335,9 +346,11 @@ def resources( metavar=" ", callback=process_filter, multiple=True, - help="Filters the table to rows, where == . If the `--filter` is set" - " several times, then rows satisfying all rules will be selected for different" - " keys; and the rows satisfying some rule will be sellected for same key.", + help=( + "Filters the table to rows, where == . If the `--filter` is set" + " several times, then rows satisfying all rules will be selected for different" + " keys; and the rows satisfying some rule will be sellected for same key." + ), ) def models( ctx: click.Context, diff --git a/tests/test_collect.py b/tests/test_collect.py index e71d577db..fb031350c 100644 --- a/tests/test_collect.py +++ b/tests/test_collect.py @@ -53,54 +53,21 @@ def _mocked_record_processing(_, __, ___, ____): def _mocked_symbols_extraction(_): - return [ - "_Z13SLList_insertP6SLListi", - "main", - "_fini", - "_init", - "_Z13SLList_removeP6SLListi", - "_ZN9SLListclsD1Ev", - "_ZN9SLListclsD2Ev", - "_ZN9SLListclsC1Ev", - "_ZN9SLListclsC2Ev", - "_ZN9SLListcls6InsertEi", - "__libc_csu_fini", - "_Z14SLList_destroyP6SLList", - "_start", - "_ZN9SLListcls10SLLelemclsC1Ei", - "_Z13SLList_searchP6SLListi", - "__libc_csu_init", - "_Z11SLList_initP6SLList", - "_ZN9SLListcls10SLLelemclsC2Ei", - "_ZN9SLListcls6SearchEi", - "deregister_tm_clones", - "register_tm_clones", - "__do_global_dtors_aux", - "frame_dummy", - "_dl_relocate_static_pie", - "_Z14SLList_destroyP6SLList", - "_ZN9SLListclsD1Ev", - "main", - "_ZN9SLListclsD2Ev", - "_fini", - "_ZN9SLListcls6SearchEi", - "_start", - "_Z11SLList_initP6SLList", - "_ZN9SLListcls10SLLelemclsC1Ei", - "_init", - "_ZN9SLListcls6InsertEi", - "_ZN9SLListcls10SLLelemclsC2Ei", - "_Z13SLList_insertP6SLListi", - "_ZN9SLListclsC2Ev", - "_Z13SLList_searchP6SLListi", - "__libc_csu_init", - "__libc_csu_fini", - "_ZN9SLListclsC1Ev", - "_Z13SLList_removeP6SLListi", - "_ZNSt8__detail12_Insert_baseIiSt4pairIKiSt6vectorI5ColorSaIS4_EEESaIS7_ENS_10_" - "Select1stESt8equal_toIiESt4hashIiENS_18_Mod_range_hashingENS_20_Default_ranged_hash" - "ENS_20_Prime_rehash_policyENS_17_Hashtable_traitsILb0ELb0ELb1EEEEC1Ev", - ] + return ["_Z13SLList_insertP6SLListi", "main", "_fini", "_init", "_Z13SLList_removeP6SLListi", + "_ZN9SLListclsD1Ev", "_ZN9SLListclsD2Ev", "_ZN9SLListclsC1Ev", "_ZN9SLListclsC2Ev", + "_ZN9SLListcls6InsertEi", "__libc_csu_fini", "_Z14SLList_destroyP6SLList", "_start", + "_ZN9SLListcls10SLLelemclsC1Ei", "_Z13SLList_searchP6SLListi", "__libc_csu_init", + "_Z11SLList_initP6SLList", "_ZN9SLListcls10SLLelemclsC2Ei", "_ZN9SLListcls6SearchEi", + "deregister_tm_clones", "register_tm_clones", "__do_global_dtors_aux", "frame_dummy", + "_dl_relocate_static_pie", "_Z14SLList_destroyP6SLList", "_ZN9SLListclsD1Ev", "main", + "_ZN9SLListclsD2Ev", "_fini", "_ZN9SLListcls6SearchEi", "_start", + "_Z11SLList_initP6SLList", "_ZN9SLListcls10SLLelemclsC1Ei", "_init", + "_ZN9SLListcls6InsertEi", "_ZN9SLListcls10SLLelemclsC2Ei", "_Z13SLList_insertP6SLListi", + "_ZN9SLListclsC2Ev", "_Z13SLList_searchP6SLListi", "__libc_csu_init", "__libc_csu_fini", + "_ZN9SLListclsC1Ev", "_Z13SLList_removeP6SLListi", + "_ZNSt8__detail12_Insert_baseIiSt4pairIKiSt6vectorI5ColorSaIS4_EEESaIS7_ENS_10_" + "Select1stESt8equal_toIiESt4hashIiENS_18_Mod_range_hashingENS_20_Default_ranged_hash" + "ENS_20_Prime_rehash_policyENS_17_Hashtable_traitsILb0ELb0ELb1EEEEC1Ev"] # fmt: skip def test_collect_complexity(monkeypatch, pcs_with_root, complexity_collect_job): @@ -160,7 +127,10 @@ def test_collect_complexity(monkeypatch, pcs_with_root, complexity_collect_job): monkeypatch.setattr(symbols, "extract_symbols", _mocked_symbols_extraction) more_rules = [ "Gif::Ctable::Ctable(Gif::Ctable&&)", - "std::tuple&& std::forward >(std::remove_reference >::type&)", + ( + "std::tuple&& std::forward" + " >(std::remove_reference >::type&)" + ), ] rules.extend(["-r{}".format(rule) for rule in more_rules]) result = runner.invoke( diff --git a/tests/test_config.py b/tests/test_config.py index 88a908946..b5f5effd1 100644 --- a/tests/test_config.py +++ b/tests/test_config.py @@ -192,7 +192,7 @@ def test_shared_dir_lookup(monkeypatch, capsys): assert win_dir.endswith("perun") monkeypatch.setattr("sys.platform", "linux") - assert config.lookup_shared_config_dir().endswith((".config/perun")) + assert config.lookup_shared_config_dir().endswith(".config/perun") monkeypatch.setattr("sys.platform", "sun") monkeypatch.setenv("PERUN_CONFIG_DIR", "") diff --git a/tests/test_fuzzing.py b/tests/test_fuzzing.py index f1616ee1f..0c9946a0f 100644 --- a/tests/test_fuzzing.py +++ b/tests/test_fuzzing.py @@ -71,28 +71,18 @@ def test_fuzzing_correct(pcs_with_root): result = runner.invoke( cli.fuzz_cmd, [ - "--cmd", - tail, - "--output-dir", - ".", - "--input-sample", - bin_workload, - "--timeout", - "0.25", - "--max-size", - "10", + "--cmd", tail, + "--output-dir", ".", + "--input-sample", bin_workload, + "--timeout", "0.25", + "--max-size", "10", "--no-plotting", "--skip-coverage-testing", - "--collector-params", - "time", - "repeat: 1", - "--collector-params", - "time", - "warmup: 0", - "--exec-limit", - "10", + "--collector-params", "time", "repeat: 1", + "--collector-params", "time", "warmup: 0", + "--exec-limit", "10", ], - ) + ) # fmt: skip asserts.predicate_from_cli(result, result.exit_code == 0) # 02. Testing tail on a directory of txt files with coverage @@ -101,37 +91,22 @@ def test_fuzzing_correct(pcs_with_root): result = runner.invoke( cli.fuzz_cmd, [ - "--cmd", - tail, - "--output-dir", - ".", - "--input-sample", - txt_workload, - "--timeout", - "0.25", - "--source-path", - os.path.dirname(tail), - "--gcno-path", - os.path.dirname(tail), - "--max-size-increase", - "35000", - "--coverage-increase-rate", - "1.05", - "--interesting-files-limit", - "2", - "--workloads-filter", - "(?notvalidregex?)", + "--cmd", tail, + "--output-dir", ".", + "--input-sample", txt_workload, + "--timeout", "0.25", + "--source-path", os.path.dirname(tail), + "--gcno-path", os.path.dirname(tail), + "--max-size-increase", "35000", + "--coverage-increase-rate", "1.05", + "--interesting-files-limit", "2", + "--workloads-filter", "(?notvalidregex?)", "--no-plotting", - "--collector-params", - "time", - "repeat: 1", - "--collector-params", - "time", - "warmup: 0", - "--exec-limit", - "10", + "--collector-params", "time", "repeat: 1", + "--collector-params", "time", "warmup: 0", + "--exec-limit", "10", ], - ) + ) # fmt: skip asserts.predicate_from_cli(result, result.exit_code == 0) # 03. Testing tail with xml files and regex_rules @@ -141,32 +116,20 @@ def test_fuzzing_correct(pcs_with_root): result = runner.invoke( cli.fuzz_cmd, [ - "--cmd", - tail, - "--output-dir", - ".", - "--input-sample", - xml_workload, - "--timeout", - "0.25", - "--max-size-ratio", - "3.5", - "--mutations-per-rule", - "probabilistic", - "--regex-rules", - regex_file, + "--cmd", tail, + "--output-dir", ".", + "--input-sample", xml_workload, + "--timeout", "0.25", + "--max-size-ratio", "3.5", + "--mutations-per-rule", "probabilistic", + "--regex-rules", regex_file, "--no-plotting", "--skip-coverage-testing", - "--collector-params", - "time", - "repeat: 1", - "--collector-params", - "time", - "warmup: 0", - "--exec-limit", - "10", + "--collector-params", "time", "repeat: 1", + "--collector-params", "time", "warmup: 0", + "--exec-limit", "10", ], - ) + ) # fmt: skip asserts.predicate_from_cli(result, result.exit_code == 0) # 04. Testing tail with empty xml file @@ -175,26 +138,17 @@ def test_fuzzing_correct(pcs_with_root): result = runner.invoke( cli.fuzz_cmd, [ - "--cmd", - tail, - "--output-dir", - ".", - "--input-sample", - xml_workload, - "--timeout", - "0.25", + "--cmd", tail, + "--output-dir", ".", + "--input-sample", xml_workload, + "--timeout", "0.25", "--no-plotting", "--skip-coverage-testing", - "--collector-params", - "time", - "repeat: 1", - "--collector-params", - "time", - "warmup: 0", - "--exec-limit", - "10", + "--collector-params", "time", "repeat: 1", + "--collector-params", "time", "warmup: 0", + "--exec-limit", "10", ], - ) + ) # fmt: skip asserts.predicate_from_cli(result, result.exit_code == 0) # 05. Testing tail with wierd file type and bad paths for coverage testing (-s, -g) @@ -203,31 +157,19 @@ def test_fuzzing_correct(pcs_with_root): result = runner.invoke( cli.fuzz_cmd, [ - "--cmd", - tail, - "--output-dir", - ".", - "--input-sample", - wierd_workload, - "--timeout", - "0.25", - "--max-size-ratio", - "3.5", - "--source-path", - ".", - "--gcno-path", - ".", + "--cmd", tail, + "--output-dir", ".", + "--input-sample", wierd_workload, + "--timeout", "0.25", + "--max-size-ratio", "3.5", + "--source-path", ".", + "--gcno-path", ".", "--no-plotting", - "--collector-params", - "time", - "repeat: 1", - "--collector-params", - "time", - "warmup: 0", - "--exec-limit", - "10", + "--collector-params", "time", "repeat: 1", + "--collector-params", "time", "warmup: 0", + "--exec-limit", "10", ], - ) + ) # fmt: skip asserts.predicate_from_cli(result, result.exit_code == 0) @@ -248,27 +190,17 @@ def test_fuzzing_sigabort(pcs_with_root): result = runner.invoke( cli.fuzz_cmd, [ - "--cmd", - sigabrt_init, - "--output-dir", - ".", - "--input-sample", - num_workload, - "--source-path", - os.path.dirname(sigabrt_init), - "--gcno-path", - os.path.dirname(sigabrt_init), - "--collector-params", - "time", - "repeat: 1", - "--collector-params", - "time", - "warmup: 0", - "--exec-limit", - "10", + "--cmd", sigabrt_init, + "--output-dir", ".", + "--input-sample", num_workload, + "--source-path", os.path.dirname(sigabrt_init), + "--gcno-path", os.path.dirname(sigabrt_init), + "--collector-params", "time", "repeat: 1", + "--collector-params", "time", "warmup: 0", + "--exec-limit", "10", "--no-plotting", ], - ) + ) # fmt: skip asserts.predicate_from_cli(result, result.exit_code == 1) asserts.predicate_from_cli(result, "SIGABRT" in result.output) @@ -282,30 +214,18 @@ def test_fuzzing_sigabort(pcs_with_root): result = runner.invoke( cli.fuzz_cmd, [ - "--cmd", - sigabrt_test, - "--output-dir", - ".", - "--input-sample", - num_workload, - "--timeout", - "1", - "--source-path", - os.path.dirname(sigabrt_test), - "--gcno-path", - os.path.dirname(sigabrt_test), - "--mutations-per-rule", - "unitary", - "--exec-limit", - "1", - "--collector-params", - "time", - "repeat: 1", - "--collector-params", - "time", - "warmup: 0", + "--cmd", sigabrt_test, + "--output-dir", ".", + "--input-sample", num_workload, + "--timeout", "1", + "--source-path", os.path.dirname(sigabrt_test), + "--gcno-path", os.path.dirname(sigabrt_test), + "--mutations-per-rule", "unitary", + "--exec-limit", "1", + "--collector-params", "time", "repeat: 1", + "--collector-params", "time", "warmup: 0", ], - ) + ) # fmt: skip asserts.predicate_from_cli(result, result.exit_code == 0) asserts.predicate_from_cli(result, "exit status 134" in result.output) @@ -327,27 +247,17 @@ def test_fuzzing_hangs(pcs_with_root): result = runner.invoke( cli.fuzz_cmd, [ - "--cmd", - hang_init, - "--output-dir", - ".", - "--input-sample", - num_workload, - "--source-path", - os.path.dirname(hang_init), - "--gcno-path", - os.path.dirname(hang_init), - "--hang-timeout", - "0.01", + "--cmd", hang_init, + "--output-dir", ".", + "--input-sample", num_workload, + "--source-path", os.path.dirname(hang_init), + "--gcno-path", os.path.dirname(hang_init), + "--hang-timeout", "0.01", "--no-plotting", - "--collector-params", - "time", - "repeat: 1", - "--collector-params", - "time", - "warmup: 0", + "--collector-params", "time", "repeat: 1", + "--collector-params", "time", "warmup: 0", ], - ) + ) # fmt: skip asserts.predicate_from_cli(result, result.exit_code == 1) asserts.predicate_from_cli(result, "Timeout" in result.output) @@ -363,33 +273,20 @@ def test_fuzzing_hangs(pcs_with_root): result = runner.invoke( cli.fuzz_cmd, [ - "--cmd", - hang_test, - "--output-dir", - ".", - "--input-sample", - num_workload, - "--timeout", - "1", - "--source-path", - os.path.dirname(hang_test), - "--gcno-path", - os.path.dirname(hang_test), - "--mutations-per-rule", - "proportional", - "--hang-timeout", - "0.05", - "--exec-limit", - "1", + "--cmd", hang_test, + "--output-dir", ".", + "--input-sample", num_workload, + "--timeout", "1", + "--source-path", os.path.dirname(hang_test), + "--gcno-path", os.path.dirname(hang_test), + "--mutations-per-rule", "proportional", + "--hang-timeout", "0.05", + "--exec-limit", "1", "--no-plotting", - "--collector-params", - "time", - "repeat: 1", - "--collector-params", - "time", - "warmup: 0", + "--collector-params", "time", "repeat: 1", + "--collector-params", "time", "warmup: 0", ], - ) + ) # fmt: skip asserts.predicate_from_cli(result, result.exit_code == 0) asserts.predicate_from_cli(result, "Timeout" in result.output) @@ -411,33 +308,20 @@ def always_true(*_, **__): result = runner.invoke( cli.fuzz_cmd, [ - "--cmd", - hang_test, - "--output-dir", - ".", - "--input-sample", - num_workload, - "--timeout", - "1", - "--source-path", - os.path.dirname(hang_test), - "--gcno-path", - os.path.dirname(hang_test), + "--cmd", hang_test, + "--output-dir", ".", + "--input-sample", num_workload, + "--timeout", "1", + "--source-path", os.path.dirname(hang_test), + "--gcno-path", os.path.dirname(hang_test), "--no-plotting", - "--interesting-files-limit", - "1", - "--collector-params", - "time", - "repeat: 1", - "--collector-params", - "time", - "warmup: 0", - "--mutations-per-rule", - "unitary", - "--exec-limit", - "1", + "--interesting-files-limit", "1", + "--collector-params", "time", "repeat: 1", + "--collector-params", "time", "warmup: 0", + "--mutations-per-rule", "unitary", + "--exec-limit", "1", ], - ) + ) # fmt: skip asserts.predicate_from_cli(result, result.exit_code == 0) asserts.predicate_from_cli(result, "Founded degradation mutations: 0" not in result.output) monkeypatch.setattr(perun_fuzz, "target_testing", original_target_testing) @@ -452,14 +336,11 @@ def test_fuzzing_incorrect(pcs_with_root): result = runner.invoke( cli.fuzz_cmd, [ - "--args", - "-al", - "--output-dir", - ".", - "--input-sample", - ".", + "--args", "-al", + "--output-dir", ".", + "--input-sample", ".", ], - ) + ) # fmt: skip asserts.predicate_from_cli(result, result.exit_code == 2) asserts.predicate_from_cli(result, "--cmd" in result.output) @@ -467,14 +348,11 @@ def test_fuzzing_incorrect(pcs_with_root): result = runner.invoke( cli.fuzz_cmd, [ - "--cmd", - "ls", - "--args", - "-al", - "--output-dir", - ".", + "--cmd", "ls", + "--args", "-al", + "--output-dir", ".", ], - ) + ) # fmt: skip asserts.predicate_from_cli(result, result.exit_code == 2) asserts.predicate_from_cli(result, "--input-sample" in result.output) @@ -482,14 +360,11 @@ def test_fuzzing_incorrect(pcs_with_root): result = runner.invoke( cli.fuzz_cmd, [ - "--cmd", - "ls", - "--args", - "-al", - "--input-sample", - ".", + "--cmd", "ls", + "--args", "-al", + "--input-sample", ".", ], - ) + ) # fmt: skip asserts.predicate_from_cli(result, result.exit_code == 2) asserts.predicate_from_cli(result, "--output-dir" in result.output) @@ -497,18 +372,13 @@ def test_fuzzing_incorrect(pcs_with_root): result = runner.invoke( cli.fuzz_cmd, [ - "--cmd", - "ls", - "--args", - "-al", - "--input-sample", - ".", - "--output-dir", - ".", - "--source-path", - "WTF~~notexisting", + "--cmd", "ls", + "--args", "-al", + "--input-sample", ".", + "--output-dir", ".", + "--source-path", "WTF~~notexisting", ], - ) + ) # fmt: skip asserts.predicate_from_cli(result, result.exit_code == 2) asserts.predicate_from_cli(result, "--source-path" in result.output) @@ -516,18 +386,13 @@ def test_fuzzing_incorrect(pcs_with_root): result = runner.invoke( cli.fuzz_cmd, [ - "--cmd", - "ls", - "--args", - "-al", - "--input-sample", - ".", - "--output-dir", - ".", - "--gcno-path", - "WTF~~notexisting", + "--cmd", "ls", + "--args", "-al", + "--input-sample", ".", + "--output-dir", ".", + "--gcno-path", "WTF~~notexisting", ], - ) + ) # fmt: skip asserts.predicate_from_cli(result, result.exit_code == 2) asserts.predicate_from_cli(result, "--gcno-path" in result.output) @@ -535,18 +400,13 @@ def test_fuzzing_incorrect(pcs_with_root): result = runner.invoke( cli.fuzz_cmd, [ - "--cmd", - "ls", - "--args", - "-al", - "--input-sample", - ".", - "--output-dir", - ".", - "--timeout", - "not_number", + "--cmd", "ls", + "--args", "-al", + "--input-sample", ".", + "--output-dir", ".", + "--timeout", "not_number", ], - ) + ) # fmt: skip asserts.predicate_from_cli(result, result.exit_code == 2) asserts.predicate_from_cli(result, "--timeout" in result.output) @@ -554,18 +414,13 @@ def test_fuzzing_incorrect(pcs_with_root): result = runner.invoke( cli.fuzz_cmd, [ - "--cmd", - "ls", - "--args", - "-al", - "--input-sample", - ".", - "--output-dir", - ".", - "--hang-timeout", - "0", + "--cmd", "ls", + "--args", "-al", + "--input-sample", ".", + "--output-dir", ".", + "--hang-timeout", "0", ], - ) + ) # fmt: skip asserts.predicate_from_cli(result, result.exit_code == 2) asserts.predicate_from_cli(result, "--hang-timeout" in result.output) @@ -573,18 +428,13 @@ def test_fuzzing_incorrect(pcs_with_root): result = runner.invoke( cli.fuzz_cmd, [ - "--cmd", - "ls", - "--args", - "-al", - "--input-sample", - ".", - "--output-dir", - ".", - "--max-size", - "1.5", + "--cmd", "ls", + "--args", "-al", + "--input-sample", ".", + "--output-dir", ".", + "--max-size", "1.5", ], - ) + ) # fmt: skip asserts.predicate_from_cli(result, result.exit_code == 2) asserts.predicate_from_cli(result, "--max-size" in result.output) @@ -592,18 +442,13 @@ def test_fuzzing_incorrect(pcs_with_root): result = runner.invoke( cli.fuzz_cmd, [ - "--cmd", - "ls", - "--args", - "-al", - "--input-sample", - ".", - "--output-dir", - ".", - "--max-size-increase", - "ola", + "--cmd", "ls", + "--args", "-al", + "--input-sample", ".", + "--output-dir", ".", + "--max-size-increase", "ola", ], - ) + ) # fmt: skip asserts.predicate_from_cli(result, result.exit_code == 2) asserts.predicate_from_cli(result, "--max-size-increase" in result.output) @@ -611,18 +456,13 @@ def test_fuzzing_incorrect(pcs_with_root): result = runner.invoke( cli.fuzz_cmd, [ - "--cmd", - "ls", - "--args", - "-al", - "--input-sample", - ".", - "--output-dir", - ".", - "--max-size-ratio", - "two_hundred", + "--cmd", "ls", + "--args", "-al", + "--input-sample", ".", + "--output-dir", ".", + "--max-size-ratio", "two_hundred", ], - ) + ) # fmt: skip asserts.predicate_from_cli(result, result.exit_code == 2) asserts.predicate_from_cli(result, "--max-size-ratio" in result.output) @@ -630,18 +470,13 @@ def test_fuzzing_incorrect(pcs_with_root): result = runner.invoke( cli.fuzz_cmd, [ - "--cmd", - "ls", - "--args", - "-al", - "--input-sample", - ".", - "--output-dir", - ".", - "--exec-limit", - "1.6", + "--cmd", "ls", + "--args", "-al", + "--input-sample", ".", + "--output-dir", ".", + "--exec-limit", "1.6", ], - ) + ) # fmt: skip asserts.predicate_from_cli(result, result.exit_code == 2) asserts.predicate_from_cli(result, "--exec-limit" in result.output) @@ -649,18 +484,13 @@ def test_fuzzing_incorrect(pcs_with_root): result = runner.invoke( cli.fuzz_cmd, [ - "--cmd", - "ls", - "--args", - "-al", - "--input-sample", - ".", - "--output-dir", - ".", - "--interesting-files-limit", - "-1", + "--cmd", "ls", + "--args", "-al", + "--input-sample", ".", + "--output-dir", ".", + "--interesting-files-limit", "-1", ], - ) + ) # fmt: skip asserts.predicate_from_cli(result, result.exit_code == 2) asserts.predicate_from_cli(result, "--interesting-files-limit" in result.output) @@ -668,18 +498,13 @@ def test_fuzzing_incorrect(pcs_with_root): result = runner.invoke( cli.fuzz_cmd, [ - "--cmd", - "ls", - "--args", - "-al", - "--input-sample", - ".", - "--output-dir", - ".", - "--coverage-increase-rate", - "notvalidfloat", + "--cmd", "ls", + "--args", "-al", + "--input-sample", ".", + "--output-dir", ".", + "--coverage-increase-rate", "notvalidfloat", ], - ) + ) # fmt: skip asserts.predicate_from_cli(result, result.exit_code == 2) asserts.predicate_from_cli(result, "--coverage-increase-rate" in result.output) @@ -687,18 +512,13 @@ def test_fuzzing_incorrect(pcs_with_root): result = runner.invoke( cli.fuzz_cmd, [ - "--cmd", - "ls", - "--args", - "-al", - "--input-sample", - ".", - "--output-dir", - ".", - "--regex-rules", - "e", + "--cmd", "ls", + "--args", "-al", + "--input-sample", ".", + "--output-dir", ".", + "--regex-rules", "e", ], - ) + ) # fmt: skip asserts.predicate_from_cli(result, result.exit_code == 1) @@ -730,33 +550,20 @@ def patched_check_output(*_, **__): result = runner.invoke( cli.fuzz_cmd, [ - "--cmd", - tail, - "--output-dir", - ".", - "--input-sample", - txt_workload, - "--timeout", - "0.25", - "--source-path", - os.path.dirname(tail), - "--gcno-path", - os.path.dirname(tail), - "--max-size-increase", - "35000", - "--coverage-increase-rate", - "1.05", - "--interesting-files-limit", - "1", + "--cmd", tail, + "--output-dir", ".", + "--input-sample", txt_workload, + "--timeout", "0.25", + "--source-path", os.path.dirname(tail), + "--gcno-path", os.path.dirname(tail), + "--max-size-increase", "35000", + "--coverage-increase-rate", "1.05", + "--interesting-files-limit", "1", "--no-plotting", - "--collector-params", - "time", - "repeat: 1", - "--collector-params", - "time", - "warmup: 0", + "--collector-params", "time", "repeat: 1", + "--collector-params", "time", "warmup: 0", ], - ) + ) # fmt: skip asserts.predicate_from_cli(result, result.exit_code == 0) asserts.predicate_from_cli(result, "Faults: 0" not in result.output) monkeypatch.setattr(utils, "run_safely_external_command", old_run_process) @@ -771,33 +578,20 @@ def patched_target_testing(*_, **__): result = runner.invoke( cli.fuzz_cmd, [ - "--cmd", - tail, - "--output-dir", - ".", - "--input-sample", - txt_workload, - "--timeout", - "1", - "--source-path", - os.path.dirname(tail), - "--gcno-path", - os.path.dirname(tail), - "--max-size-increase", - "35000", - "--coverage-increase-rate", - "1.05", - "--interesting-files-limit", - "1", + "--cmd", tail, + "--output-dir", ".", + "--input-sample", txt_workload, + "--timeout", "1", + "--source-path", os.path.dirname(tail), + "--gcno-path", os.path.dirname(tail), + "--max-size-increase", "35000", + "--coverage-increase-rate", "1.05", + "--interesting-files-limit", "1", "--no-plotting", - "--collector-params", - "time", - "repeat: 1", - "--collector-params", - "time", - "warmup: 0", + "--collector-params", "time", "repeat: 1", + "--collector-params", "time", "warmup: 0", ], - ) + ) # fmt: skip asserts.predicate_from_cli(result, result.exit_code == 0) asserts.predicate_from_cli(result, "Executing binary raised an exception" in result.output) monkeypatch.setattr(coverage_fuzz, "target_testing", old_target_perun_testing) diff --git a/tests/test_status.py b/tests/test_status.py index bcc60a0cf..f9911e5ec 100644 --- a/tests/test_status.py +++ b/tests/test_status.py @@ -316,7 +316,9 @@ def test_status_sort(monkeypatch, pcs_single_prof, capsys, valid_profile_pool): { "general": {"paging": "never"}, "format": { - "status": "\u2503 %type% \u2503 %collector% \u2503 (%time%) \u2503 %source% \u2503", + "status": ( + "\u2503 %type% \u2503 %collector% \u2503 (%time%) \u2503 %source% \u2503" + ), }, } ) @@ -334,7 +336,9 @@ def test_status_sort(monkeypatch, pcs_single_prof, capsys, valid_profile_pool): { "general": {"paging": "never"}, "format": { - "status": "\u2503 %type% \u2503 %collector% \u2503 (%time%) \u2503 %source% \u2503", + "status": ( + "\u2503 %type% \u2503 %collector% \u2503 (%time%) \u2503 %source% \u2503" + ), "sort_profiles_by": "bogus", }, }, diff --git a/tests/test_table.py b/tests/test_table.py index db842511b..1701c9ece 100644 --- a/tests/test_table.py +++ b/tests/test_table.py @@ -65,14 +65,11 @@ def test_table_cli(pcs_full): "tableof", "--to-stdout", "models", - "-h", - "uid", - "-h", - "model", - "-h", - "coeffs", + "-h", "uid", + "-h", "model", + "-h", "coeffs", ], - ) + ) # fmt: skip asserts.predicate_from_cli(result, result.exit_code == 0) with open(os.path.join(TABLE_TEST_DIR, "table_models_ref_pruned"), "r") as trb: assert_files_match_output(result, trb) @@ -84,14 +81,11 @@ def test_table_cli(pcs_full): "tableof", "--to-stdout", "models", - "-h", - "non-existant", - "-h", - "model", - "-h", - "coeffs", + "-h", "non-existant", + "-h", "model", + "-h", "coeffs", ], - ) + ) # fmt: skip asserts.predicate_from_cli(result, result.exit_code == 2) asserts.predicate_from_cli( result, "invalid choice for table header: non-existant" in result.output @@ -104,17 +98,13 @@ def test_table_cli(pcs_full): "0@p", "tableof", "--to-stdout", - "-f", - "latex", + "-f", "latex", "models", - "-h", - "uid", - "-h", - "model", - "-h", - "coeffs", + "-h", "uid", + "-h", "model", + "-h", "coeffs", ], - ) + ) # fmt: skip asserts.predicate_from_cli(result, result.exit_code == 0) with open(os.path.join(TABLE_TEST_DIR, "table_models_ref_latex"), "r") as trb: assert_files_match_output(result, trb) @@ -125,17 +115,13 @@ def test_table_cli(pcs_full): [ "0@p", "tableof", - "--output-file", - "test_output", + "--output-file", "test_output", "models", - "-h", - "uid", - "-h", - "model", - "-h", - "coeffs", + "-h", "uid", + "-h", "model", + "-h", "coeffs", ], - ) + ) # fmt: skip output_file = os.path.join(os.getcwd(), "test_output") asserts.predicate_from_cli(result, result.exit_code == 0) assert os.path.exists(output_file) @@ -151,16 +137,11 @@ def test_table_cli(pcs_full): "tableof", "--to-stdout", "models", - "--sort-by", - "r_square", - "--filter-by", - "model", - "linear", - "--filter-by", - "model", - "quadratic", + "--sort-by", "r_square", + "--filter-by", "model", "linear", + "--filter-by", "model", "quadratic", ], - ) + ) # fmt: skip asserts.predicate_from_cli(result, result.exit_code == 0) with open(os.path.join(TABLE_TEST_DIR, "table_models_ref_sorted_filtered"), "r") as trb: assert_files_match_output(result, trb) @@ -191,14 +172,10 @@ def test_table_cli(pcs_full): "tableof", "--to-stdout", "models", - "--filter-by", - "r_square", - "0", - "--filter-by", - "model", - "linear", + "--filter-by", "r_square", "0", + "--filter-by", "model", "linear", ], - ) + ) # fmt: skip asserts.predicate_from_cli(result, result.exit_code == 0) with open(os.path.join(TABLE_TEST_DIR, "table_models_ref_empty"), "r") as trb: assert_files_match_output(result, trb) diff --git a/tests/test_tracer.py b/tests/test_tracer.py index e25c209db..694be292b 100644 --- a/tests/test_tracer.py +++ b/tests/test_tracer.py @@ -239,37 +239,25 @@ def test_collect_trace_cli_no_stap(monkeypatch, pcs_full): "collect", "-c{}".format(target), "trace", - "-f", - "main", - "-f", - "main#2", - "-u", - "BEFORE_CYCLE", - "-u", - "BEFORE_CYCLE_end#3", - "-d", - "none", - "-d", - "none_again#2", - ] - + [ - "-g", - 2, + "-f", "main", + "-f", "main#2", + "-u", "BEFORE_CYCLE", + "-u", "BEFORE_CYCLE_end#3", + "-d", "none", + "-d", "none_again#2", + "-g", 2, "--no-usdt", - "-b", - target, - "-t", - 2, + "-b", target, + "-t", 2, "-z", "-k", "-vt", "-q", "-w", - "-o", - "suppress", + "-o", "suppress", "-i", ], - ) + ) # fmt: skip assert result.exit_code == 0 # Test that non-existing command is not accepted @@ -397,32 +385,21 @@ def test_collect_trace(pcs_with_root, trace_collect_job): [ "-c{}".format(target), "trace", - "-f", - "main", - "-f", - "main", - "-f", - "main#2", - "-f", - "main#2", - "-u", - "BEFORE_CYCLE", - "-u", - "BEFORE_CYCLE#3", - "-u", - "BEFORE_CYCLE_end", - "-u", - "BEFORE_CYCLE;BEFORE_CYCLE_end", - "-u", - "TEST_SINGLE#4", - "-u", - "TEST_SINGLE2", - "-f", - "test#-3", + "-f", "main", + "-f", "main", + "-f", "main#2", + "-f", "main#2", + "-u", "BEFORE_CYCLE", + "-u", "BEFORE_CYCLE#3", + "-u", "BEFORE_CYCLE_end", + "-u", "BEFORE_CYCLE;BEFORE_CYCLE_end", + "-u", "TEST_SINGLE#4", + "-u", "TEST_SINGLE2", + "-f", "test#-3", "-k", ] + binary, - ) + ) # fmt: skip assert result.exit_code == 0 print("TRACE OUTPUT: {}".format(result.stdout)) # Compare the created script with the correct one @@ -515,14 +492,12 @@ def test_collect_trace_strategies(monkeypatch, pcs_full): [ "-c{}".format(target), "trace", - "-s", - "userspace", + "-s", "userspace", "--no-usdt", - "-g", - "10", + "-g", "10", "-k", ], - ) + ) # fmt: skip assert result.exit_code == 0 assert _compare_collect_scripts( _get_latest_collect_script(), os.path.join(target_dir, "strategy5_script.txt") @@ -534,14 +509,12 @@ def test_collect_trace_strategies(monkeypatch, pcs_full): [ "-c{}".format(target), "trace", - "-s", - "u_sampled", + "-s", "u_sampled", "--no-usdt", - "-g", - "10", + "-g", "10", "-k", ], - ) + ) # fmt: skip assert result.exit_code == 0 assert _compare_collect_scripts( _get_latest_collect_script(), os.path.join(target_dir, "strategy5_script.txt") @@ -552,17 +525,13 @@ def test_collect_trace_strategies(monkeypatch, pcs_full): [ "-c{}".format(target), "trace", - "-s", - "userspace", - "-f", - "main#4", - "-f", - "_Z12QuickSortBadPii", - "-f", - "invalid", + "-s", "userspace", + "-f", "main#4", + "-f", "_Z12QuickSortBadPii", + "-f", "invalid", "-k", ], - ) + ) # fmt: skip assert result.exit_code == 0 assert _compare_collect_scripts( _get_latest_collect_script(), os.path.join(target_dir, "strategy6_script.txt") @@ -573,14 +542,12 @@ def test_collect_trace_strategies(monkeypatch, pcs_full): [ "-c{}".format(target), "trace", - "-s", - "userspace", + "-s", "userspace", "--no-usdt", - "-u", - "INVALID", + "-u", "INVALID", "-k", ], - ) + ) # fmt: skip assert result.exit_code == 0 assert _compare_collect_scripts( _get_latest_collect_script(), os.path.join(target_dir, "strategy7_script.txt")