Skip to content

Add unit tests and CI/CD for checkpatch autofix functions#1

Merged
Kilynho merged 7 commits into
developfrom
copilot/create-unit-tests-for-fixes
Dec 7, 2025
Merged

Add unit tests and CI/CD for checkpatch autofix functions#1
Kilynho merged 7 commits into
developfrom
copilot/create-unit-tests-for-fixes

Conversation

Copilot AI commented Dec 7, 2025

Copy link
Copy Markdown
Contributor

Implements automated testing for all 38 checkpatch autofix functions with CI/CD integration per project requirements.

Changes

  • test_fixes.py: 32 unit tests covering 30 active fix functions

    • Independent tests using temporary files, no kernel source dependency
    • Integration tests for multi-fix scenarios
    • 8 functions imported but untested (marked PROBLEMATIC in engine.py or rarely triggered)
  • .github/workflows/test.yml: GitHub Actions workflow

    • Triggers on push/PR to main/master/develop
    • Python 3.12 on Ubuntu, minimal permissions (contents: read)
  • TESTING.md: Step-by-step guide for adding tests when new fixes are implemented

    • Template pattern for test creation
    • Best practices and troubleshooting
  • Infrastructure: .gitignore, updated README with testing sections

Example Test Pattern

def test_fix_printk_info(self):
    """Test fix_printk_info converts printk(KERN_INFO) to pr_info."""
    content = 'printk(KERN_INFO "test message\\n");\n'
    test_file = self.create_test_file(content)
    
    result = fix_printk_info(test_file, 1)
    self.assertTrue(result)
    
    fixed_content = self.read_file(test_file)
    self.assertIn("pr_info", fixed_content)
    self.assertNotIn("printk", fixed_content)

All 32 tests pass. CodeQL security scan passed.

Original prompt

Crea tests unitarios para cada fix, crea nuevos cuando aparezcan nuevos fix y ejecutalos cada vez que se suba código al repositorio


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Copilot AI and others added 6 commits December 7, 2025 12:22
Co-authored-by: Kilynho <40294264+Kilynho@users.noreply.github.com>
Co-authored-by: Kilynho <40294264+Kilynho@users.noreply.github.com>
Co-authored-by: Kilynho <40294264+Kilynho@users.noreply.github.com>
…ssertion

Co-authored-by: Kilynho <40294264+Kilynho@users.noreply.github.com>
Co-authored-by: Kilynho <40294264+Kilynho@users.noreply.github.com>
Co-authored-by: Kilynho <40294264+Kilynho@users.noreply.github.com>
Copilot AI changed the title [WIP] Add unit tests for fixes and automate execution Add unit tests and CI/CD for checkpatch autofix functions Dec 7, 2025
Copilot AI requested a review from Kilynho December 7, 2025 12:37
@Kilynho Kilynho marked this pull request as ready for review December 7, 2025 12:39

@Kilynho Kilynho left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@copilot

@Kilynho Kilynho merged commit 43db041 into develop Dec 7, 2025
@Kilynho Kilynho deleted the copilot/create-unit-tests-for-fixes branch December 7, 2025 17:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants