Skip to content

Commit

Permalink
Merge branch 'UnitTestBot:main' into main
Browse files Browse the repository at this point in the history
  • Loading branch information
ladisgin authored Apr 19, 2024
2 parents bcadead + e2e08a0 commit abf8757
Show file tree
Hide file tree
Showing 419 changed files with 16,233 additions and 2,900 deletions.
50 changes: 50 additions & 0 deletions .github/ISSUE_TEMPLATE/regression_checklist.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
---
name: Regression checklist
about: Checklist for smoke testing of release build
title: ''
labels: qa
assignees: ''
---

Get build from this run - https://github.com/UnitTestBot/UTBotCpp/actions/workflows/publish-utbot.yml

Setup dedicated server according to following manual - https://github.com/UnitTestBot/UTBotCpp/wiki/install-server
Setup local server according to following manual - https://github.com/UnitTestBot/UTBotCpp/wiki/docker-free-wsl2

_**Delete project folders with sample project on remote and local server if they are left from previous test runs.**_

VSCode:
- [ ] Install plugin (`Ctrl-Shift-P` - `Extensions: Install plugin from VSIX`)
- [ ] Verify version on plugin page (`Ctrl-Shift-X` search for `@installed unittestbot`)

- [ ] Open folder with unpacked attached sample project - UnitTestBot Wizard should be started
- [ ] SFTP and Sarif Viewer plugins are marked as installed on first page of the Wizard
- [ ] On Server configuration check that both local and server connection could be established.
- [ ] When cannot connect proper error should be shown
- [ ] Connect to remote server and complete the wizard - build folder created, project configured


- [ ] Open `lib\calc.c` file, generate tests for `div(int a, int b)` function - tests are generated, Sarif report is opened
- [ ] Run only one test - `regression` tests pass, `error` tests fails, coverage shown in `calc.c` file.
- [ ] Run all generated tests in test file - `regression` tests pass, `error` tests fails, coverage shown in `calc.c` file.


- [ ] Generate and run tests for items listed below. Before the test remove `tests` folder. After test verify proper number of tests files appeared and run one of them.
- [ ] File `lib\str_utils.c`
- [ ] Folder `src`
- [ ] Project

- [ ] Verbose
- [ ] On
- [ ] Off

- [ ] Log windows (writing to log could be unstable - see #430)
- [ ] UTBot: Client Log
- [ ] UTBot: Server Log
- [ ] UTBot: Test console

- [ ] Open UTBot Explorer (at left pane)
- [ ] [Target window](https://github.com/UnitTestBot/UTBotCpp/wiki/targets)
- [ ] Source Code window

- [ ] CLion plugin - do simple test - install plugin - configure to work with local server generate and run some test. Additionally verifying that coverage is generated.
44 changes: 22 additions & 22 deletions .github/workflows/build-utbot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -86,31 +86,31 @@ jobs:
run: |
export VERSION=$(date '+%Y.%m').$GITHUB_RUN_NUMBER
export RUN_INFO=$GITHUB_SERVER_URL/$GITHUB_REPOSITORY/actions/runs/$GITHUB_RUN_ID
chmod +x docker/action-scripts/build-utbot.sh
./docker/action-scripts/build-utbot.sh
chmod +x docker/action-scripts/build-clean-utbot.sh
./docker/action-scripts/build-clean-utbot.sh
- name: Run Integration Tests
run: |
chmod +x docker/action-scripts/build-vsix.sh
./docker/action-scripts/build-vsix.sh
chmod +x docker/action-scripts/integration-tests.sh
./docker/action-scripts/integration-tests.sh
- name: Setup Java for building CLion plugin
uses: actions/setup-java@v3
with:
distribution: zulu
java-version: 11
- name: Run CLion integration tests
run: |
chmod +x docker/action-scripts/runClionIntegrationTests.sh
./docker/action-scripts/runClionIntegrationTests.sh
- name: Upload logs
uses: actions/upload-artifact@v3
if: failure()
with:
name: test-report
path: |
/github/home/logs
clion-plugin/build/reports/tests/**/*
# - name: Setup Java for building CLion plugin
# uses: actions/setup-java@v3
# with:
# distribution: zulu
# java-version: 11
# - name: Run CLion integration tests
# run: |
# chmod +x docker/action-scripts/runClionIntegrationTests.sh
# ./docker/action-scripts/runClionIntegrationTests.sh
# - name: Upload logs
# uses: actions/upload-artifact@v3
# if: failure()
# with:
# name: test-report
# path: |
# /github/home/logs
# clion-plugin/build/reports/tests/**/*

build-utbot-and-generate-test:
needs: matrix-prep
Expand All @@ -137,8 +137,8 @@ jobs:

- name: Build UTBot
run: |
chmod +x docker/action-scripts/build-utbot.sh
./docker/action-scripts/build-utbot.sh
chmod +x docker/action-scripts/build-clean-utbot.sh
./docker/action-scripts/build-clean-utbot.sh
- name: Generate tests
run: |
Expand All @@ -153,7 +153,7 @@ jobs:

build-portable-container:
needs: build-utbot-and-generate-test
runs-on: ubuntu-latest
runs-on: ubuntu-20.04
env:
DOCKER_IMAGE_TAG: docker-image
PORTABLE_CONTAINER_NAME: Portable
Expand Down
58 changes: 58 additions & 0 deletions .github/workflows/docs-to-wiki.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
name: Documentation

on:
push:
branches:
- main
paths:
- "docs/**"
repository_dispatch:
types: [docs]
gollum:

env:
GIT_AUTHOR_NAME: Actionbot
GIT_AUTHOR_EMAIL: [email protected]
SYNC_CHANGES_REPO_NAME: docs-sync

jobs:
job-sync-docs-to-wiki:
runs-on: ubuntu-latest
if: github.event_name != 'gollum'
steps:
- name: Checkout Repo
uses: actions/checkout@v2
- name: Sync docs to wiki
uses: UnitTestBot/wiki-sync-action@main
with:
source: docs
destination: wiki
token: ${{ secrets.ACCESS_TOKEN }}
gitAuthorName: ${{ env.GIT_AUTHOR_NAME }}
gitAuthorEmail: ${{ env.GIT_AUTHOR_EMAIL }}

job-sync-wiki-to-docs:
runs-on: ubuntu-latest
if: github.event_name == 'gollum'
steps:
- name: Checkout Repo
uses: actions/checkout@v2
with:
token: ${{ secrets.ACCESS_TOKEN }} # allows us to push back to repo
- name: Sync Wiki to Docs
uses: UnitTestBot/wiki-sync-action@main
with:
source: wiki
destination: docs
token: ${{ secrets.ACCESS_TOKEN }}
gitAuthorName: ${{ env.GIT_AUTHOR_NAME }}
gitAuthorEmail: ${{ env.GIT_AUTHOR_EMAIL }}
branch: wiki_branch
- name: Create PR for success
run: |
BRANCH="$(git rev-parse --abbrev-ref HEAD)"
if [[ "$BRANCH" != "main" ]]; then
gh pr create --fill
fi
env:
GH_TOKEN: ${{ secrets.ACCESS_TOKEN }}
6 changes: 3 additions & 3 deletions .github/workflows/matrix.json
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
{
"include": [
{
"DOCKER_TAG": "2022.10.0",
"OPERATING_SYSTEM_TAG": "18.04",
"LLVM_VERSION_MAJOR": "10"
"DOCKER_TAG": "2024.03.0",
"OPERATING_SYSTEM_TAG": "20.04",
"LLVM_VERSION_MAJOR": "14"
}
]
}
11 changes: 11 additions & 0 deletions .github/workflows/publish-base-env.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,17 @@ jobs:
steps:
- uses: actions/checkout@v3

- name: Free Disk Space (Ubuntu)
uses: jlumbroso/free-disk-space@main
with:
tool-cache: true
android: true
dotnet: true
haskell: true
large-packages: true
docker-images: true
swap-storage: true

- name: Log in to the Container registry
uses: docker/login-action@v2
with:
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/publish-utbot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -77,8 +77,8 @@ jobs:
./docker/action-scripts/build-clion-plugin.sh
- name: build UTBot
run: |
chmod +x docker/action-scripts/build-utbot.sh
./docker/action-scripts/build-utbot.sh
chmod +x docker/action-scripts/build-clean-utbot.sh
./docker/action-scripts/build-clean-utbot.sh
shell: bash
- name: prepare UTBot release for Ubuntu
run: |
Expand All @@ -91,7 +91,7 @@ jobs:

auto_installation_check:
needs: publish
runs-on: ubuntu-latest
runs-on: ubuntu-20.04
steps:
- name: Checkout repository
uses: actions/checkout@v3
Expand Down
15 changes: 15 additions & 0 deletions COPYRIGHT_HEADER.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
/*
* Copyright 2022 UnitTestBot contributors (utbot.org)
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
5 changes: 2 additions & 3 deletions DEVNOTE.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,7 @@ needed dependencies such as Git, LLVM, GRPC, GoogleTest and others. **base_env**
dates. If you are developing the tool, you are most likely to need the most recent version
from [here](https://github.com/UnitTestBot/UTBotCpp/pkgs/container/utbotcpp%2Fbase_env).

Supported and tested development configuration are Ubuntu 18.04 / 20.04 or Windows Subsystem for Linux (Ubuntu 18.04 /
20.04).
Supported and tested development configuration are Ubuntu 20.04 or Windows Subsystem for Linux (Ubuntu 20.04).

1. Install docker for [Ubuntu](https://docs.docker.com/engine/install/ubuntu/)
or [WSL+Ubuntu](https://docs.docker.com/desktop/windows/wsl/)
Expand Down Expand Up @@ -112,4 +111,4 @@ Extensions > UnitTestBot. After UTBot configuration, you can select your source
toolbar on the left. Then, you can generate tests with the use of Command Palette. Press **F1** and type in "UTBot": You
will see tests generation options.

## [Troubleshooting](https://github.com/UnitTestBot/UTBotCpp/wiki/troubleshooting)
## [Troubleshooting](https://github.com/UnitTestBot/UTBotCpp/wiki/troubleshooting)
2 changes: 2 additions & 0 deletions NOTICE
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
UnitTestBot
Copyright 2022 UnitTestBot contributors (utbot.org)
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,14 @@ Features demonstration in 5 min (click to see on [YouTube](https://www.youtube.c

[![UTBot C/C++ Demo](https://img.youtube.com/vi/bDJyWEeYhvk/0.jpg)](https://www.youtube.com/watch?v=bDJyWEeYhvk "UTBot C/C++ Demo")

### Try online demo here: https://www.utbot.org/utbot
### Try UTBot demo online [here](https://www.utbot.org/demo/?language=C)!

More info on [wiki](https://github.com/UnitTestBot/UTBotCpp/wiki)


## How to install and use UTBot

For now, you can only use UTBot under Ubuntu 18.04 and above.
For now, you can only use UTBot under Ubuntu 20.04 and above.
Navigate to the [**Releases**](https://github.com/UnitTestBot/UTBotCpp/releases) GitHub page and download last version of UTBot.

UTBot is distrbuted as an archive that contains:
Expand Down
7 changes: 5 additions & 2 deletions build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,10 @@
set -e
set -o pipefail
pwd=$PWD
chmod +x $pwd/submodules/klee/build.sh $pwd/submodules/Bear/build.sh $pwd/server/build.sh
cd $pwd/submodules/klee && ./build.sh
chmod +x $pwd/submodules/build-klee.sh $pwd/submodules/Bear/build.sh $pwd/server/build.sh
cd $pwd/submodules && ./build-klee.sh
cd $pwd/submodules/Bear && ./build.sh
if [ "$1" = "gh" ]; then
rm -rf submodules
fi
cd $pwd/server && ./build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import org.utbot.cpp.clion.plugin.utils.activeProject
import org.utbot.cpp.clion.plugin.utils.client
import testsgen.Testgen

class AskServerToGenerateBuildDir : UTBotBaseAction(UTBot.message("projectConfigure.generate.buildDir")) {
class AskServerToGenerateBuildDir : UTBotBaseAction(UTBot.message("projectConfigure.generate.buildRelDir")) {

override fun actionPerformed(e: AnActionEvent) = CreateBuildDirRequest(
GrpcRequestBuilderFactory(e.activeProject()).createProjectConfigRequestBuilder(Testgen.ConfigMode.CREATE_BUILD_DIR),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ class CreateBuildDirRequest(
CreateBuildDirHandler(
client,
this,
UTBot.message("requests.buildDir.description.progress"),
UTBot.message("requests.buildRelDir.description.progress"),
cancellationJob
).handle()
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ class GrpcRequestBuilderFactory(
project.name,
project.path,
project.settings.storedSettings.testDirRelativePath,
project.settings.storedSettings.buildDirRelativePath
project.settings.storedSettings.buildDirRelPath
)
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ internal data class ProjectContextBuilder(
val projectName: String,
val projectPath: String,
val testDirRelativePath: String,
val buildDirRelativePath: String
val buildDirRelPath: String
) : GrpcRequestBuilder<Testgen.ProjectContext> {
override fun build(remoteMapping: RemoteMapping): Testgen.ProjectContext {
val projectNioPath = Paths.get(projectPath) // project path is not set by user, assuming it is valid
Expand All @@ -23,13 +23,14 @@ internal data class ProjectContextBuilder(
}
return Testgen.ProjectContext.newBuilder()
.setProjectPath(projectPath)
.setTestDirPath(
.setTestDirRelPath(
remoteMapping.convertToRemote(
projectNioPath.resolve(relativeTestsDirNioPath).toString(),
UTBot.message("settings.project.testsDir.wrong")
)
)
.setBuildDirRelativePath(buildDirRelativePath)
.setReportDirRelPath("utbot_report")
.setBuildDirRelPath(buildDirRelPath)
.setProjectName(projectName)
.setProjectPath(remoteMapping.convertToRemote(projectPath, UTBot.message("projectPath.wrong.conversion")))
.build()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,15 +24,15 @@ class UTBotAllProjectSettings(val project: Project) {
val buildDirPath: Path
get() {
try {
return Paths.get(project.path).resolve(storedSettings.buildDirRelativePath)
return Paths.get(project.path).resolve(storedSettings.buildDirRelPath)
} catch (e: InvalidPathException) {
throw IllegalPathException(
UTBot.message(
"paths.invalid",
"relative path to build dir",
storedSettings.buildDirRelativePath
storedSettings.buildDirRelPath
),
storedSettings.buildDirRelativePath
storedSettings.buildDirRelPath
)
}
}
Expand Down Expand Up @@ -82,7 +82,7 @@ class UTBotAllProjectSettings(val project: Project) {

fun predictPaths() {
storedSettings.remotePath = UTBotProjectStoredSettings.REMOTE_PATH_VALUE_FOR_LOCAL_SCENARIO
storedSettings.buildDirRelativePath = UTBotProjectStoredSettings.DEFAULT_RELATIVE_PATH_TO_BUILD_DIR
storedSettings.buildDirRelPath = UTBotProjectStoredSettings.DEFAULT_RELATIVE_PATH_TO_BUILD_DIR
storedSettings.targetPath = UTBotTarget.autoTarget.path
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -134,8 +134,8 @@ class UTBotConfigurable(private val myProject: Project) : BoundConfigurable(
}

private fun Panel.createPathsSettings() {
row(UTBot.message("settings.project.buildDir")) {
textField().bindText(settings::buildDirRelativePath).columns(COLUMNS_LARGE)
row(UTBot.message("settings.project.buildRelDir")) {
textField().bindText(settings::buildDirRelPath).columns(COLUMNS_LARGE)
.validateInput(ValidationCondition(UTBot.message("validation.not.empty")) {
it.text.stripLeadingSlashes().isNotEmpty()
})
Expand Down
Loading

0 comments on commit abf8757

Please sign in to comment.