Overview
Helium includes comprehensive validation tools to catch issues early in the development process. These tools verify patch compatibility, configuration correctness, and build consistency.Automated Validation
validate_patches.py - Complete Patch Validation
The most comprehensive validation tool, checking that all patches apply cleanly to the Chromium source tree.Resolve dependencies
Parses Chromium’s DEPS file to understand the repository structure and dependency versions
Retrieve source files
Downloads required files from Google’s repositories or reads from local source tree
When to use which mode:
- Remote: CI pipelines, automated testing, clean validation
- Local: Fast development iteration when you have source tree
- Cache: Debugging patch issues, inspecting source files
validate_config.py - Configuration Integrity
All-in-one validation for Helium’s configuration files.- What it validates
- Usage
- CI Integration
All patches exist at specified paths
All patches are referenced in series file
No duplicate patches in series
Each patch is parseable as unified diff
GN flags are alphabetically sorted
No duplicate GN flag definitions
downloads.ini conforms to schema
Download URLs and hashes are valid
Individual Validators
Patch File Validation
Validation checks performed
Validation checks performed
- Readability: All patches can be opened and read
- Parseability: Each patch is valid unified diff format
- Completeness: All referenced patches exist on disk
- Coverage: No unused patches in directory
- Uniqueness: No duplicate patch references
GN Flags Validation
- Unsorted flags (affects diff readability)
- Duplicate flag definitions (causes build errors)
- Malformed flag syntax
Downloads Configuration
Schema validation
Schema validation
Verifies:
- Required fields present (url, download_filename, output_path)
- Hash specifications valid (md5, sha1, sha256, sha512)
- Extractor types supported (tar, 7z, winrar)
- Output paths are relative
- URL variables are valid ()
- Hash URL format correct (scheme|path|algorithm)
File Existence Check
- Pruning lists reference valid files
- Domain substitution targets exist
- Resource files are present
- Test data is available
Testing Workflows
Pre-Commit Hook
Add to.git/hooks/pre-commit:
CI Pipeline
- GitHub Actions
- GitLab CI
- Local Testing
Development Iteration
Debugging Failed Validations
Patch Application Failures
Patch does not apply cleanly
Patch does not apply cleanly
Problem: Patch fails with context mismatchSolutions:
-
Update patch for current Chromium version:
-
Check if file was moved or renamed:
-
Use verbose mode to see exact failure:
File not found in source tree
File not found in source tree
Problem: Patch references file that doesn’t existCauses:
- File was removed in newer Chromium version
- File path changed
- File is in a dependency repository
Hash mismatch after domain substitution
Hash mismatch after domain substitution
Problem: Revert fails due to hash mismatchCauses:
- Files modified after domain substitution
- Cache doesn’t match current source tree
- Don’t modify files after domain substitution
- If needed, revert before making changes:
Configuration Issues
GN flags out of order
GN flags out of order
Problem:
check_gn_flags.py reports unsorted flagsSolution:Duplicate patches in series
Duplicate patches in series
Problem: Same patch listed multiple timesSolution:
- Edit
patches/series - Remove duplicate lines
- Verify:
Unused patches detected
Unused patches detected
Problem: Patch files exist but aren’t in seriesDecide:
- Add to
patches/seriesif needed - Delete if obsolete
- Move to archive directory if keeping for reference
Validation in Build Scripts
Integrate validation into build scripts:Performance Considerations
validate_patches.py --remote
Time: 10-20 minutes
Use: CI, clean validation
Requires: Internet, requests module
Use: CI, clean validation
Requires: Internet, requests module
validate_patches.py --local
Time: 1-2 minutes
Use: Development, iteration
Requires: Local source tree
Use: Development, iteration
Requires: Local source tree
validate_config.py
Time: 5-10 seconds
Use: Quick checks, pre-commit
Requires: Config files only
Use: Quick checks, pre-commit
Requires: Config files only
check_files_exist.py
Time: 1-5 seconds
Use: CI, quick validation
Requires: Source tree, file lists
Use: CI, quick validation
Requires: Source tree, file lists
Exit Codes Reference
All validation scripts use consistent exit codes:Success - All validations passed
Failure - One or more validations failed or warnings occurred
Best Practices
Always validate before committing
Always validate before committing
Run at minimum:For patch changes:
Use CI for comprehensive checks
Use CI for comprehensive checks
Local validation is fast but may miss issues. Always have CI run:
validate_config.pyvalidate_patches.py --remote- Code quality checks (pylint)
Cache source files for debugging
Cache source files for debugging
When debugging patch issues:
Keep validation fast
Keep validation fast
- Use
--localduring development - Only use
--remotefor final validation - Run
validate_config.pyfrequently (it’s fast)
See Also
Developer Utilities
Complete reference for all developer utilities
Build Utilities
Core build utilities for patches and domain substitution
CI/CD Setup
Setting up automated builds and testing
Contributing
Guidelines for contributing to Helium