Skip to content
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

[Clean] Clean run nondex #1069

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
43 changes: 24 additions & 19 deletions auto-run-nondex/README.md
Original file line number Diff line number Diff line change
@@ -1,50 +1,48 @@
# `runNondex`
# runNondex

This script runs individual modules in the specified project with the `Nondex` tool and shows results automatically in the `markdown` format.

Output file is located inside the project folder and called `report_md.md` The output would only contain tests that are detected by the nondex tool as flaky, and the result includes the seeds used for the test and the status of the test result.
What repo we want to run Nondex on?

All the log information would be stored inside the `.runNondex` folder inside the project.
1. This repo has not appeared in the latest `pr-data.csv`
2. This repo contains pom.xml file.

Inside the `.runNondex` folder:
- `./LOGSSS` contains nondex logs for all submodules.
- `LOGresult` contains a list of file paths that contain test errors.
- `htmlOutput` contains a list of file paths for the HTML files generated by the nondex tool.


# Dependencies

It is recommended to use a virtual python environment for the required modules:
```bash
python3 -m venv <path_to_the_new_virtual_environment>
source <path_to_the_new_virtual_environment>/bin/activate
```

Make sure to first install packages in `requirements.txt`.

```bash
# sudo apt install python3-pip
cd auto-run-nondex
pip install -r requirements.txt
```
# runNondexAll

# `runNondexUnderAuthor`

This script runs all the valid repos under a given author using the `runNondex` script above.
This is simplified script for quick start
Go to folder of .pom.xml files, and check all the result in result.log

The valid repo is defined as:
# runNondex module:
```bash
./runNondex.sh <project_folder_path> <optional-directory-name>
```

1. This repo has not appeared in the latest `pr-data.csv`
2. This repo contains pom.xml file.
With the second parameter in `./runNondex.sh`, you can only run Nondex on modules in a certain directory instead of the entire project.


# runNondexUnderAuthor


### Usage:
```bash
./runNondex.sh <project_folder_path> <optional-directory-name>
./runNondexUnderAuthor.sh <author_repository_url> <path_where_you_want_to_clone_those repos>
```

With the second parameter in `./runNondex.sh`, you can only run Nondex on modules in a certain directory instead of the entire project.

How to find the Author?

> To find the author_repository_url, find the author that you want to run Nondex with, and get this author's repository overview url (e.g., https://github.com/orgs/spotify/repositories). Note that you don't need to provide the url with other parameters, as the script will automatically add the parameters needed.
>
Expand All @@ -65,3 +63,10 @@ With the second parameter in `./runNondex.sh`, you can only run Nondex on module
> `find . -maxdepth 1 -type d \( ! -name . \) -exec bash -c "cd '{}' && git rev-parse HEAD && git config --get remote.origin.url | rev | cut -c5- | rev && cat .runNondex/htmlOutput && cat report_md.md" \; &> progress_stats.md`


# Folder structure

All the log information would be stored inside the `.runNondex` folder inside the project.

- `./modulelog` contains nondex logs for all submodules.
- `result` contains a list of file paths that contain test errors.
- `htmlOutput` contains a list of file paths for the HTML files generated by the nondex tool.
22 changes: 15 additions & 7 deletions auto-run-nondex/runNondex.sh
Original file line number Diff line number Diff line change
@@ -1,25 +1,33 @@
#!/bin/bash
DIR="${PWD}"
nondex_version="2.1.1"
nondex_version="2.1.1" #LST version

runNondex () {
#get the modules
cd $1
mvn install -DskipTests
mvn -Dexec.executable='echo' -Dexec.args='${project.artifactId}' exec:exec -q -fn | tee modnames
if grep -q "[ERROR]" modnames; then
echo !!!!!
echo "ERROR: There are errors in the project"
exit 1
else
echo OK
echo "No errors detected"
fi

mkdir .runNondex
mkdir ./.runNondex/LOGSSS
mkdir ./.runNondex/modulelog


# run nondex on each module
input="modnames"
while IFS= read -r line
do
mvn edu.illinois:nondex-maven-plugin:$nondex_version:nondex -pl :$line -Dlicense.skip=true | tee ./.runNondex/LOGSSS/$line.log
mvn edu.illinois:nondex-maven-plugin:$nondex_version:nondex -pl :$line -Dlicense.skip -Drat.skip --fail-at-end | tee ./.runNondex/modulelog/$line.log
done < "$input"
grep -rnil "There are test failures" ./.runNondex/LOGSSS/* | tee ./.runNondex/LOGresult
input=".runNondex/LOGresult"
grep -rnil "There are test failures" ./.runNondex/modulelog/* | tee ./.runNondex/result

# format the result
input=".runNondex/result"
while IFS= read -r line
do
grep "test_results.html" $line | tee ./.runNondex/htmlOutput
Expand Down
5 changes: 5 additions & 0 deletions auto-run-nondex/runNondexAll.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# Assume this script is run from the folder of .pom.xml files

mvn edu.illinois:nondex-maven-plugin:2.1.1:nondex -Dlicense.skip -Drat.skip --fail-at-end | tee ./nondex.log

awk '/\[INFO\] Across all seeds:/{flag=1; next} /\[INFO\] Test results can be found at:/{flag=0} flag' "./nondex.log" > "./result"