Skip to content

Conversation

@JGsouzaa
Copy link

SQLite feature developed based on #11

*Development Summary:


[sqlite.rs file (NEW FILE)]:

Implemented the following functions:

  • check_db
  • _createdb
  • _check_schema
  • _fill_projects_table
  • _check_initial_row
  • store_run
  • store_mutants
  • check_mutation_folder
  • get_files_from_folder
  • get_file_diff
  • get_hash_from_diff
  • update_status_mutant
  • update_command_to_test_mutant
  • update_mutants_table

Implemented the following tests:

  • test_db_creation_and_seed
  • test_store_run_creates_row
  • test_store_mutants_inserts_rows
  • test_update_status_mutant
  • test_update_command_mutant

[main.rs file (MODIFICATIONS)]:

Implemented the following logic:

  • Added mod sqlite.rs
  • Optional SQLite flag for mutation + handler
  • Optional SQLite flag for analyze with --run_id + handler

[lib.rs file (MODIFICATIONS)]:

  • sqlite.rs module

[git_changes.rs file (MODIFICATIONS)]:

  • get_commit_hash function implementation

[error.rs file (MODIFICATIONS)]:

  • Added Sqlite and MissingDbPath errors

[analyze.rs file (MODIFICATIONS)]:

  • Adapted run_analysis signature to get db_path and run_id
  • Added update_status_mutant and update_command_to_test_mutant on current logic
  • Changed find_mutation_folders visibility to public so it can be called from the sqlite.rs module

[Cargo.toml file (MODIFICATIONS)]:

  • Added rusqlite and sha2 dependencies

*Additional comments:

  • strategy, config_json from the current execution config -> NOT IMPLEMENTED

  • The database schema follows the issue documentation entirely, with only one exception on table mutant that was inserted an additional column called file_name to query on analyze section

  • Apart from the code tests, the following functional tests were performed manually:

    • (mutate) -> --sqlite flag optional, normal behavior {OK}

    • (mutate --sqlite ) -> Creates/open "db/mutation.db" and uses it {OK}

    • (mutate --sqlite results.db) -> Creates/open "db/results.db" and uses it {OK}

    • (mutate --sqlite ...) -> Verify INSERT OR IGNORE INTO projects (name, repository_url) VALUES ('Bitcoin Core', 'https://github.com/bitcoin/bitcoin'); {OK}

    • (mutate --sqlite...) -> General behavior: Open DB (create if missing) Ensure projects seed (bitcoin core), create run, insert mutants {OK}

    • (analyze --sqlite) -> Asks for run_id {OK}

    • (analyze --sqlite <db_file> <run_id> ) -> Record standard commands {OK}

    • (analyze <without file (-f ...)> --sqlite <run_id> ...) -> Record only for run_id, behave like analyze normally {OK}


*Further implementations suggestion:

  • Modify logic when grabbing file extensions (current supports only for .cpp, .h and .py files)
  • Implement help options for flag --sqlite
  • Insert one more table column on table runs indicating the total number of mutants generated
  • Explore options for compress the data on column "diff" on table "mutants" if diffs become hard to store and read
  • Implement a folder called bcore-mutation on the project that it's running to hold "db" and "mutants" folders apart from original project

@JGsouzaa JGsouzaa force-pushed the feature/SQLite_persistence branch 2 times, most recently from d0ff404 to eb2257d Compare December 27, 2025 10:38
@JGsouzaa JGsouzaa force-pushed the feature/SQLite_persistence branch from eb2257d to a255f22 Compare December 27, 2025 10:39
Perform full analysis for a specific run id (obligatory):

```bash
bcore-mutation analyze --sqlite --run_id <run id number>
Copy link
Owner

Choose a reason for hiding this comment

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

I think the correct flag here is --runid, not --run_id.

Suggested change
bcore-mutation analyze --sqlite --run_id <run id number>
bcore-mutation analyze --sqlite --runid <run id number>

@brunoerg
Copy link
Owner

Please, you should better organize your commits by squashing some of them.

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