diff --git a/src/utils/parser.py b/src/utils/parser.py index 4d077318e..36e67e9af 100644 --- a/src/utils/parser.py +++ b/src/utils/parser.py @@ -849,10 +849,10 @@ def apply_filters(workload, dir, is_gui, debug): # Verify valid kernel filter kernels_df = pd.read_csv(os.path.join(dir, "pmc_kernel_top.csv")) for kernel_id in workload.filter_kernel_ids: - if kernel_id > len(kernels_df["Kernel_Name"]): + if kernel_id >= len(kernels_df["Kernel_Name"]): error( "{} is an invalid kernel id. Please enter an id between 0-{}".format( - kernel_id, len(kernels_df["Kernel_Name"]) + kernel_id, len(kernels_df["Kernel_Name"]) - 1 ) ) kernels = [] diff --git a/tests/test_analyze_commands.py b/tests/test_analyze_commands.py index 19a214467..b4e0ffcce 100644 --- a/tests/test_analyze_commands.py +++ b/tests/test_analyze_commands.py @@ -421,7 +421,7 @@ def test_filter_kernel_2(): ], ): omniperf.main() - assert e.value.code == 0 + assert e.value.code == 1 with pytest.raises(SystemExit) as e: with patch( @@ -436,7 +436,7 @@ def test_filter_kernel_2(): ], ): omniperf.main() - assert e.value.code == 0 + assert e.value.code == 1 @pytest.mark.filter_kernel @@ -455,7 +455,7 @@ def test_filter_kernel_3(): ], ): omniperf.main() - assert e.value.code == 0 + assert e.value.code == 1 with pytest.raises(SystemExit) as e: with patch( @@ -471,7 +471,7 @@ def test_filter_kernel_3(): ], ): omniperf.main() - assert e.value.code == 0 + assert e.value.code == 1 @pytest.mark.dispatch