Skip to content

Add tests for HolisticTraceAnalysis/hta/utils#345

Closed
sijiaw-meta wants to merge 2 commits into
facebookresearch:mainfrom
sijiaw-meta:export-D104876398
Closed

Add tests for HolisticTraceAnalysis/hta/utils#345
sijiaw-meta wants to merge 2 commits into
facebookresearch:mainfrom
sijiaw-meta:export-D104876398

Conversation

@sijiaw-meta

@sijiaw-meta sijiaw-meta commented May 12, 2026

Copy link
Copy Markdown
Contributor

Summary:
Purpose: Add unit test coverage for HolisticTraceAnalysis/hta/utils to meet the >=90% per-file coverage target. Baseline did not exercise checker.py or validate_trace.py at all; utils.py and test_utils.py had partial coverage from existing tests.

Type: Test infrastructure

Changes:

  • New tests/test_checker.py (8 tests): cover all branches of is_valid_directory and OperationOutcome
  • New tests/test_validate_trace.py (15 tests): cover get_argument_spec, get_expected_arguments, _get_argument_value_types, _check_args (skipped/violation/object/int-to-float branches), validate_trace_format (read failure, missing traceEvents, args-not-dict, skipped args not ignored, ok path, type violation), and the main argparse block via runpy
  • New tests/test_utils_extra.py (34 tests): cover normalize_path (all branches), is_comm/memory/compute_kernel, get_kernel_type (all 4 branches), get_memory_kernel_type (Memset/DtoH/Unknown), merge_kernel_intervals, flatten_column_names, get_mp_pool_size, normalize_gpu_stream_numbers, get_value_from_dict, get_test_data_dir, and data_provider tuple/scalar branches
  • BUCK: register the 3 new test_unittest targets

Coverage:

  • checker.py: 0% -> 100%
  • test_utils.py: 60.7% -> 100%
  • utils.py: 56.0% -> 100%
  • validate_trace.py: 0% -> 96.4%
  • Folder total: 56.5% -> 98.8%

Differential Revision: D104876398

@meta-cla meta-cla Bot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label May 12, 2026
@meta-codesync

meta-codesync Bot commented May 12, 2026

Copy link
Copy Markdown

@sijiaw-meta has exported this pull request. If you are a Meta employee, you can view the originating Diff in D104876398.

@meta-codesync meta-codesync Bot changed the title Add tests for HolisticTraceAnalysis/hta/utils Add tests for HolisticTraceAnalysis/hta/utils (#345) May 12, 2026
sijiaw-meta added a commit to sijiaw-meta/HolisticTraceAnalysis that referenced this pull request May 12, 2026
Summary:

**Purpose:** Add unit test coverage for HolisticTraceAnalysis/hta/utils to meet the >=90% per-file coverage target. Baseline did not exercise checker.py or validate_trace.py at all; utils.py and test_utils.py had partial coverage from existing tests.

**Type:** Test infrastructure

**Changes:**
- New tests/test_checker.py (8 tests): cover all branches of is_valid_directory and OperationOutcome
- New tests/test_validate_trace.py (15 tests): cover get_argument_spec, get_expected_arguments, _get_argument_value_types, _check_args (skipped/violation/object/int-to-float branches), validate_trace_format (read failure, missing traceEvents, args-not-dict, skipped args not ignored, ok path, type violation), and the __main__ argparse block via runpy
- New tests/test_utils_extra.py (34 tests): cover normalize_path (all branches), is_comm/memory/compute_kernel, get_kernel_type (all 4 branches), get_memory_kernel_type (Memset/DtoH/Unknown), merge_kernel_intervals, flatten_column_names, get_mp_pool_size, normalize_gpu_stream_numbers, get_value_from_dict, get_test_data_dir, and data_provider tuple/scalar branches
- BUCK: register the 3 new test_unittest targets

**Coverage:**
- checker.py: 0% -> 100%
- test_utils.py: 60.7% -> 100%
- utils.py: 56.0% -> 100%
- validate_trace.py: 0% -> 96.4%
- Folder total: 56.5% -> 98.8%

Differential Revision: D104876398
sijiaw-meta added a commit to sijiaw-meta/HolisticTraceAnalysis that referenced this pull request May 12, 2026
Summary:

**Purpose:** Add unit test coverage for HolisticTraceAnalysis/hta/utils to meet the >=90% per-file coverage target. Baseline did not exercise checker.py or validate_trace.py at all; utils.py and test_utils.py had partial coverage from existing tests.

**Type:** Test infrastructure

**Changes:**
- New tests/test_checker.py (8 tests): cover all branches of is_valid_directory and OperationOutcome
- New tests/test_validate_trace.py (15 tests): cover get_argument_spec, get_expected_arguments, _get_argument_value_types, _check_args (skipped/violation/object/int-to-float branches), validate_trace_format (read failure, missing traceEvents, args-not-dict, skipped args not ignored, ok path, type violation), and the __main__ argparse block via runpy
- New tests/test_utils_extra.py (34 tests): cover normalize_path (all branches), is_comm/memory/compute_kernel, get_kernel_type (all 4 branches), get_memory_kernel_type (Memset/DtoH/Unknown), merge_kernel_intervals, flatten_column_names, get_mp_pool_size, normalize_gpu_stream_numbers, get_value_from_dict, get_test_data_dir, and data_provider tuple/scalar branches
- BUCK: register the 3 new test_unittest targets

**Coverage:**
- checker.py: 0% -> 100%
- test_utils.py: 60.7% -> 100%
- utils.py: 56.0% -> 100%
- validate_trace.py: 0% -> 96.4%
- Folder total: 56.5% -> 98.8%

Differential Revision: D104876398
sijiaw-meta added a commit to sijiaw-meta/HolisticTraceAnalysis that referenced this pull request May 12, 2026
Summary:

**Purpose:** Add unit test coverage for HolisticTraceAnalysis/hta/utils to meet the >=90% per-file coverage target. Baseline did not exercise checker.py or validate_trace.py at all; utils.py and test_utils.py had partial coverage from existing tests.

**Type:** Test infrastructure

**Changes:**
- New tests/test_checker.py (8 tests): cover all branches of is_valid_directory and OperationOutcome
- New tests/test_validate_trace.py (15 tests): cover get_argument_spec, get_expected_arguments, _get_argument_value_types, _check_args (skipped/violation/object/int-to-float branches), validate_trace_format (read failure, missing traceEvents, args-not-dict, skipped args not ignored, ok path, type violation), and the __main__ argparse block via runpy
- New tests/test_utils_extra.py (34 tests): cover normalize_path (all branches), is_comm/memory/compute_kernel, get_kernel_type (all 4 branches), get_memory_kernel_type (Memset/DtoH/Unknown), merge_kernel_intervals, flatten_column_names, get_mp_pool_size, normalize_gpu_stream_numbers, get_value_from_dict, get_test_data_dir, and data_provider tuple/scalar branches
- BUCK: register the 3 new test_unittest targets

**Coverage:**
- checker.py: 0% -> 100%
- test_utils.py: 60.7% -> 100%
- utils.py: 56.0% -> 100%
- validate_trace.py: 0% -> 96.4%
- Folder total: 56.5% -> 98.8%

Differential Revision: D104876398
@meta-codesync meta-codesync Bot changed the title Add tests for HolisticTraceAnalysis/hta/utils (#345) Add tests for HolisticTraceAnalysis/hta/utils May 20, 2026
Summary:

**Purpose:** Add unit test coverage for HolisticTraceAnalysis/hta/configs to meet the >=90% per-file coverage target. Baseline was 95.2% overall but event_args_yaml_parser.py was at 84.2%.

**Type:** Test infrastructure

**Changes:**
- Add 2 new tests in test_event_args_yaml_parser.py: test_parse_event_args_yaml_loads_local_file (covers the os.path.exists True branch that loads YAML from disk via mocked open) and test_main_runs_without_error (covers the main() function via captured stdout)
- event_args_yaml_parser.py: 84.2% -> 94.7% (folder total: 96.3%)

Differential Revision: D104876231
Summary:
**Purpose:** Add unit test coverage for HolisticTraceAnalysis/hta/utils to meet the >=90% per-file coverage target. Baseline did not exercise checker.py or validate_trace.py at all; utils.py and test_utils.py had partial coverage from existing tests.

**Type:** Test infrastructure

**Changes:**
- New tests/test_checker.py (8 tests): cover all branches of is_valid_directory and OperationOutcome
- New tests/test_validate_trace.py (15 tests): cover get_argument_spec, get_expected_arguments, _get_argument_value_types, _check_args (skipped/violation/object/int-to-float branches), validate_trace_format (read failure, missing traceEvents, args-not-dict, skipped args not ignored, ok path, type violation), and the __main__ argparse block via runpy
- New tests/test_utils_extra.py (34 tests): cover normalize_path (all branches), is_comm/memory/compute_kernel, get_kernel_type (all 4 branches), get_memory_kernel_type (Memset/DtoH/Unknown), merge_kernel_intervals, flatten_column_names, get_mp_pool_size, normalize_gpu_stream_numbers, get_value_from_dict, get_test_data_dir, and data_provider tuple/scalar branches
- BUCK: register the 3 new test_unittest targets

**Coverage:**
- checker.py: 0% -> 100%
- test_utils.py: 60.7% -> 100%
- utils.py: 56.0% -> 100%
- validate_trace.py: 0% -> 96.4%
- Folder total: 56.5% -> 98.8%

Differential Revision: D104876398
@meta-codesync

meta-codesync Bot commented May 21, 2026

Copy link
Copy Markdown

This pull request has been merged in 131d75c.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. fb-exported Merged meta-exported

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant