forked from leusonmario/SMAT
-
Notifications
You must be signed in to change notification settings - Fork 3
Code Llama Tool Integration #17
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
nathaliafab
wants to merge
71
commits into
spgroup:master
Choose a base branch
from
nathaliafab:codellama-integration
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
71 commits
Select commit
Hold shift + click to select a range
71f2697
adicionado nova tool para gerar testes
nathaliafab 52ad4a2
gera outputs para diferentes branches
nathaliafab 77a5566
alterações nas funções
nathaliafab e585dba
Add try except block on compile test suite method
nathaliafab a5aeba5
Add some functions for better compilation work
nathaliafab cec679a
removed print
nathaliafab 4ee7db1
added/fixed logging
nathaliafab aa84b01
fix class and test naming
nathaliafab ddf12e7
change test not found result
nathaliafab b5c8f1b
removed unused functions and cleaned the code
nathaliafab 655d95d
simply not include not found tests
nathaliafab f4a6e29
remove unused imports
nathaliafab 1d427f1
varias coisa
nathaliafab 4db60de
calledprocesserror
nathaliafab e28295d
update requirements
nathaliafab 8a7c153
varias refatoração
nathaliafab 973adc3
é o refatoras
nathaliafab b70c052
melhor logging e mudança no path do output
nathaliafab e25abcb
reports nao sao sobrescritos
nathaliafab 131d001
conserto de varios bugs
nathaliafab e42e1b7
fix jar type search
nathaliafab ae8badc
update logging
nathaliafab 660838a
calc time
nathaliafab 6dfed76
better output
nathaliafab 8c88634
update req
nathaliafab ea9df20
a
nathaliafab fad3c28
fix: "targets" attr type
nathaliafab 44c3ff6
remove ignored modules from logging
nathaliafab 7169eeb
feat(model): migrate from local codellama-7b to API-based codellama-7…
nathaliafab 5fcc7ec
change test template logic and prompt messages
nathaliafab 083f140
update dependencies versions
nathaliafab cbedd6a
fixed var types
nathaliafab 4e2a94b
use the current repo name
nathaliafab 0453c4d
fixed some stylistic issues
nathaliafab 344d54d
parametrização dos dados da api
nathaliafab e132acc
creates a file to store compilation outputs
nathaliafab db8be5c
fixed get_config() function to support dicts inside dicts
nathaliafab 9d1f85e
move functions to utils
nathaliafab 038f41b
created api class
nathaliafab e8ad444
fixed scenario infos format and remove useless function
nathaliafab 8ba504d
conserto da lógica
nathaliafab 3f36b79
conserto de lógica + saída em arquivo json
nathaliafab 9195e6f
small fix logging message
nathaliafab e17eed8
get seed from config
nathaliafab 4e49187
remove version from requirements
nathaliafab 94003b0
typing issues
nathaliafab 6bc007c
change logic - special codellama
nathaliafab a19fb60
update config params
nathaliafab 32da8ca
dealing with paths - evosuite
nathaliafab 2c3237d
remove unused globals
nathaliafab 5f38ba8
remove implicit optional
nathaliafab 04b1d79
Merge pull request #1 from nathaliafab/new-prompts
nathaliafab e4643fd
Merge branch 'master' into codellama-integration
nathaliafab cfb8b62
Update nimrod/utils.py
nathaliafab 433eec2
Update nimrod/test_suites_execution/test_suite_executor.py
nathaliafab dda0c87
Update nimrod/test_suite_generation/generators/codellama_test_suite_g…
nathaliafab 5e6c389
Update nimrod/output_generation/semantic_conflicts_output_generator.py
nathaliafab 3fb1a94
refactor: rename codellama to ollama
nathaliafab 0c46b5f
docs: add docstrings for data loading and writing methods
nathaliafab 4210022
Update nimrod/test_suite_generation/generators/ollama_test_suite_gene…
nathaliafab f6dc6bc
Update nimrod/test_suites_execution/test_suite_executor.py
nathaliafab cca64e7
fix(tests): update compile timeout and standardize assertion methods
nathaliafab 5a05435
feat: add PromptManager class and prompt templates
nathaliafab 5784994
fix: update paths for compilation and execution results to use report…
nathaliafab 7f435b5
feat: enhance OllamaTestSuiteGenerator to support configurable model …
nathaliafab e99d5d0
feat: implement LLMOutputProcessor for output sanitization in OllamaT…
nathaliafab d7b02da
fix: update requirements.txt for specific tree_sitter versions and im…
nathaliafab bba8cf6
chore: update GitHub Actions workflow to use Python 3.10 and Java Tem…
nathaliafab ecbad7c
fix: update Maven setup action version and adjust env-config.json cre…
nathaliafab 65bf193
fix: update env-config.json creation to use dynamic MAVEN_HOME path
nathaliafab 74a3cc0
feat: add Docker support with Dockerfile and docker-compose.yml for c…
nathaliafab File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,17 @@ | ||
| services: | ||
| smat: | ||
| build: | ||
| context: . | ||
| dockerfile: docker/Dockerfile | ||
| args: | ||
| USER_ID: ${USER_ID} | ||
| GROUP_ID: ${GROUP_ID} | ||
| image: smat-ubuntu | ||
| container_name: smat_container | ||
| volumes: | ||
| # Mount the current directory to /app in the container | ||
| - .:/app | ||
| # Mount the dataset directory to /data/dataset in the container (read-only) | ||
| - /path/to/your/mergedataset/:/data/dataset:ro | ||
| stdin_open: true | ||
| tty: true |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,44 @@ | ||
| FROM ubuntu:22.04 | ||
|
|
||
| ENV DEBIAN_FRONTEND=noninteractive | ||
|
|
||
| ARG USER_ID | ||
| ARG GROUP_ID | ||
|
|
||
| # 1. Install system dependencies, Python, and Java in a single layer | ||
| RUN apt-get update && \ | ||
| apt-get install -y --no-install-recommends \ | ||
| python3.11 \ | ||
| python3-pip \ | ||
| python3.11-dev \ | ||
| openjdk-8-jdk \ | ||
| maven \ | ||
| git \ | ||
| curl \ | ||
| jq \ | ||
| build-essential \ | ||
| ca-certificates && \ | ||
|
|
||
| groupadd -g ${GROUP_ID} appuser && \ | ||
| useradd -m -u ${USER_ID} -g ${GROUP_ID} appuser && \ | ||
|
|
||
| update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.11 1 && \ | ||
|
|
||
| apt-get clean && rm -rf /var/lib/apt/lists/* | ||
|
|
||
| # 2. Set Environment Variables for Java and Maven | ||
| ENV JAVA_HOME=/usr/lib/jvm/java-8-openjdk-amd64 | ||
| ENV MAVEN_HOME=/usr/share/maven | ||
| ENV PATH="$MAVEN_HOME/bin:$JAVA_HOME/bin:$PATH" | ||
|
|
||
| # 3. Setup working directory and data mount point | ||
| WORKDIR /app | ||
| RUN mkdir -p /data/dataset && chown appuser:appuser /data/dataset | ||
|
|
||
| # 4. Install Python dependencies | ||
| COPY --chown=appuser:appuser requirements.txt . | ||
| RUN python3 -m pip install --no-cache-dir --upgrade pip && \ | ||
| python3 -m pip install --no-cache-dir -r requirements.txt ruff mypy pytest | ||
|
|
||
| USER appuser | ||
| CMD ["/bin/bash", "-i"] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,109 @@ | ||
| # Running SMAT with Docker Compose | ||
|
|
||
| This guide explains how to run SMAT in a containerized environment using **Docker Compose**. This ensures a consistent environment with Python 3.11, Java 8, and Maven, regardless of your host operating system. | ||
|
|
||
| ## 1. Prerequisites | ||
|
|
||
| Install Docker on your system: | ||
|
|
||
| * **Docker Desktop** (Recommended for Windows and Mac): [Download here](https://docs.docker.com/desktop/) | ||
| * **Docker Engine** (For Linux): [Installation Guide](https://docs.docker.com/engine/install/) | ||
|
|
||
| --- | ||
|
|
||
| ## 2. Configuration | ||
|
|
||
| Before running the container, you need to configure three files to ensure the paths match the Docker environment. | ||
|
|
||
| ### A. Docker Compose (Dataset Path) | ||
|
|
||
| Open `docker-compose.yml` and point the dataset volume to your local path: | ||
|
|
||
| ```yaml | ||
| volumes: | ||
| - .:/app | ||
| # Replace the path below with the path to your dataset on your host machine | ||
| - /path/to/your/mergedataset/:/data/dataset:ro | ||
|
|
||
| ``` | ||
|
|
||
| *Note: The `:ro` flag ensures your dataset is read-only for safety.* | ||
|
|
||
| ### B. SMAT Input Config (`input-smat.json`) | ||
|
|
||
| The `input-smat.json` should be in the **root directory** of the project, so that the container can see it. Internally, the scenario jars must point to the `/data/dataset/` path, for example: | ||
|
|
||
| ```json | ||
| { | ||
| ... | ||
| "scenarioJars": { | ||
| "base": "/data/dataset/antlr4/69ff2669eec265e25721dbc27cb00f6c381d0b41/...", | ||
| ... | ||
| }, | ||
| ... | ||
| } | ||
| ``` | ||
|
|
||
| ### C. Environment Config (`nimrod/tests/env-config.json`) | ||
|
|
||
| Point the `input_smat` path to the location inside the container. If it is on the root folder: | ||
|
|
||
| ```json | ||
| "input_path": "/app/input-smat.json", | ||
| ``` | ||
|
|
||
| --- | ||
|
|
||
| ## 3. Running the Container | ||
|
|
||
| Navigate to the project root and run the following command according to your OS: | ||
|
|
||
| ### Linux & macOS (Terminal) | ||
|
|
||
| The following command passes your user and group IDs to avoid permission issues with generated files: | ||
|
|
||
| ```bash | ||
| USER_ID=$(id -u) GROUP_ID=$(id -g) docker compose run --rm --build smat | ||
| ``` | ||
|
|
||
| ### Windows (PowerShell) | ||
|
|
||
| In PowerShell, the variables are handled differently: | ||
|
|
||
| ```powershell | ||
| $env:USER_ID=1000; $env:GROUP_ID=1000; docker compose run --rm --build smat | ||
| ``` | ||
|
|
||
| *Note: On Windows, the default UID/GID 1000 is usually sufficient for Docker Desktop.* | ||
|
|
||
| --- | ||
|
|
||
| ## 4. Usage Inside the Container | ||
|
|
||
| Once the command finishes, you will be inside the Ubuntu shell at `/app`. You can run tests or start an analysis: | ||
|
|
||
| ```bash | ||
| # Check if the dataset is visible | ||
| ls /data/dataset | ||
|
|
||
| # Run SMAT analysis | ||
| python3 -m nimrod | ||
|
|
||
| # Run tests | ||
| pytest -k 'not test_general_behavior_study_semantic_conflict' | ||
| ``` | ||
|
|
||
| ### Command Breakdown: | ||
|
|
||
| * `run`: Starts a one-off container for interactive use. | ||
| * `--rm`: Automatically removes the container upon exit to keep your system clean. | ||
| * `--build`: Forces a rebuild of the image if you modified the Dockerfile or requirements. | ||
| * `smat`: The service name defined in `docker-compose.yml`. | ||
|
|
||
| --- | ||
|
|
||
| ## Troubleshooting | ||
|
|
||
| * **Dataset Not Found**: Ensure the path on the left side of the colon in `docker-compose.yml` is an absolute path to your local folder. | ||
| * **Permission Denied**: On Linux, double-check that `USER_ID` and `GROUP_ID` match the output of the `id` command on your host terminal. | ||
| * **File Changes**: Since we use volumes, any code change made on your host machine will be instantly reflected inside the container. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.