rework vtest

This commit is contained in:
Igor Korsukov 2020-12-29 12:27:51 +02:00
parent 7d467d7545
commit fa1ae3c2db
542 changed files with 257 additions and 490 deletions

View file

@ -3,7 +3,7 @@ name: CI_codestyle
on:
pull_request:
branches:
- master_off
- master
jobs:
codestyle:

View file

@ -3,7 +3,7 @@ name: CI_Linux MU4
on:
pull_request:
branches:
- master_off
- master
schedule:
- cron: '0 4 */1 */1 *' # At 04:00 on every day-of-month
workflow_dispatch:

View file

@ -3,7 +3,7 @@ name: CI_MacOS MU4
on:
pull_request:
branches:
- master_off
- master
schedule:
- cron: '0 4 */1 */1 *' # At 04:00 on every day-of-month
workflow_dispatch:

View file

@ -9,78 +9,78 @@ jobs:
run_vtests:
runs-on: ubuntu-18.04
steps:
- name: Cancel Previous Runs
uses: styfle/cancel-workflow-action@0.5.0
with:
access_token: ${{ github.token }}
- name: Clone repository
uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Retrieve base commit for PR
- name: Get base commit for PR
if: github.event_name == 'pull_request'
run: |
export BASEREF=${{ github.event.pull_request.base.sha }}
if [ -z "$BASEREF" ]; then export found=0; else export found=1; fi
echo "BASEREF=$BASEREF" >> $GITHUB_ENV
echo "found=$found" >> $GITHUB_ENV
- name: Retrieve base commit for push commit
HEAD_REF=${{ github.event.pull_request.head.sha }}
BASE_REF=${{ github.event.pull_request.base.sha }}
if [ -z "$BASE_REF" ]; then DO_RUN='false'; else DO_RUN='true'; fi
echo "HEAD_REF=$HEAD_REF" >> $GITHUB_ENV
echo "BASE_REF=$BASE_REF" >> $GITHUB_ENV
echo "DO_RUN=$DO_RUN" >> $GITHUB_ENV
- name: Get base commit for push commit
if: github.event_name == 'push'
run: |
export BASEREF=$( git show -s --pretty=%P ${{ github.sha }} | head -c 10 )
if [ -z "$BASEREF" ]; then export found=0; else export found=1; fi
echo "BASEREF=$BASEREF" >> $GITHUB_ENV
echo "found=$found" >> $GITHUB_ENV
HEAD_REF=${{ github.sha }}
BASE_REF=$( git show -s --pretty=%P ${{ github.sha }} | head -c 10 )
if [ -z "$BASE_REF" ]; then DO_RUN='false'; else DO_RUN='true'; fi
echo "BASE_REF=$BASE_REF" >> $GITHUB_ENV
echo "DO_RUN=$DO_RUN" >> $GITHUB_ENV
- name: Setup the environment
if: contains( env.found, '1')
if: env.DO_RUN == 'true'
run: |
sudo bash ./build/ci/linux/setup.sh
- name: Build
if: contains( env.found, '1')
- name: Build current branch
if: env.DO_RUN == 'true'
run: |
source ./../musescore_environment.sh
make installdebug CPUS=2 PREFIX="$HOME/software" COVERAGE=ON
- name: Build reference branch
if: contains( env.found, '1')
run: |
source ./../musescore_environment.sh
mkdir -p "$HOME/softwarebase"
git checkout $BASEREF
mkdir -p "$HOME/musescore_current"
make clean
make installdebug CPUS=2 PREFIX="$HOME/softwarebase" COVERAGE=ON 2>/dev/null
- name: Run reference vtests
if: contains( env.found, '1')
make installdebug CPUS=2 PREFIX="$HOME/musescore_current" COVERAGE=ON
- name: Checkout on ref branch
if: env.DO_RUN == 'true'
uses: actions/checkout@v2
with:
ref: ${{ env.BASE_REF }}
- name: Build ref branch
if: env.DO_RUN == 'true'
run: |
source ./../musescore_environment.sh
cd vtest
export VTEST_MSCORE="$HOME/softwarebase/bin/mscore"
export VTEST_BROWSER=ls
export VTEST_DIR=$(pwd)
xvfb-run ./gen
- name: Run vtests
if: contains( env.found, '1')
mkdir -p "$HOME/musescore_ref"
make clean
make installdebug CPUS=2 PREFIX="$HOME/musescore_ref" COVERAGE=ON
- name: Checkout on current branch
if: env.DO_RUN == 'true'
uses: actions/checkout@v2
with:
ref: ${{ env.HEAD_REF }}
- name: Generate ref png
if: env.DO_RUN == 'true'
run: |
source ./../musescore_environment.sh
git checkout -
cd vtest
mkdir -p compare
find ./html -name "*-1.png" -exec mv '{}' ./compare \;
rm -rf html 2>/dev/null
export VTEST_MSCORE="$HOME/software/bin/mscore"
export VTEST_BROWSER=ls
export VTEST_DIR=$(pwd)
xvfb-run ./gen
- name: Compare vtests
if: contains( env.found, '1')
xvfb-run ./vtest/vtest.sh -c gen_ref -m $HOME/musescore_ref/bin/mscore
- name: Generate current png
if: env.DO_RUN == 'true'
run: |
source ./../musescore_environment.sh
cd vtest
export VTEST_DIR=$(pwd)
./gen_compare
xvfb-run ./vtest/vtest.sh -c gen_cur -m $HOME/musescore_current/bin/mscore
- name: Compare png
if: env.DO_RUN == 'true'
run: |
./vtest/vtest.sh -c compare
echo "VTEST_DIFF_FOUND=$VTEST_DIFF_FOUND" >> $GITHUB_ENV
- name: Upload artifact
if: contains( env.found, '1') && contains( env.VTEST_DIFF_FOUND, 'true')
if: env.DO_RUN == 'true'
uses: actions/upload-artifact@v1
with:
name: compare
path: ./vtest
name: VTest.Artifacts
path: ./vtest.artifacts
- name: Skip failure signal if PR is labeled 'vtests'
if: github.event_name == 'pull_request' && contains( env.found, '1') && contains( env.VTEST_DIFF_FOUND, 'true') && contains(github.event.pull_request.labels.*.name, 'vtests')
if: github.event_name == 'pull_request' && contains( env.DO_RUN, 'true') && contains( env.VTEST_DIFF_FOUND, 'true') && contains(github.event.pull_request.labels.*.name, 'vtests')
run: |
echo "This PR appears to change some of the visual tests."
echo "Please carefully review the new visual test results in the uploaded artifact that can be found here: https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}"
@ -88,13 +88,13 @@ jobs:
export VTEST_DIFF_FOUND=false
echo "VTEST_DIFF_FOUND=$VTEST_DIFF_FOUND" >> $GITHUB_ENV
- name: Emit failure signal for PR if differences are found
if: github.event_name == 'pull_request' && contains( env.found, '1') && contains( env.VTEST_DIFF_FOUND, 'true')
if: github.event_name == 'pull_request' && contains( env.DO_RUN, 'true') && contains( env.VTEST_DIFF_FOUND, 'true')
run: |
echo "This PR appears to change some of the visual tests."
echo "Please carefully review the new visual test results in the uploaded artifact that can be found here: https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}"
exit 1
- name: Comment push commit
if: github.event_name == 'push' && contains( env.found, '1') && contains( env.VTEST_DIFF_FOUND, 'true')
if: github.event_name == 'push' && contains( env.DO_RUN, 'true') && contains( env.VTEST_DIFF_FOUND, 'true')
uses: peter-evans/commit-comment@v1.1.0
with:
body: |

View file

@ -3,7 +3,7 @@ name: CI_Windows MU4
on:
pull_request:
branches:
- master_off
- master
schedule:
- cron: '0 4 */1 */1 *' # At 04:00 on every day-of-month
workflow_dispatch:

1
.gitignore vendored
View file

@ -16,6 +16,7 @@ build.xcode
applebuild
build.artifacts
build.symbols
vtest.artifacts
MuseScorePortable
/*.config
/*.creator

View file

@ -52,7 +52,8 @@ mu::Ret ConverterController::batchConvert(const io::path& batchJobFile)
mu::Ret ConverterController::convert(const io::path& in, const io::path& out)
{
LOGI() << "in: " << in;
TRACEFUNC;
LOGI() << "in: " << in << ", out: " << out;
auto notation = notationCreator()->newMasterNotation();
IF_ASSERT_FAILED(notation) {
return make_ret(Err::UnknownError);

View file

@ -1,27 +1,47 @@
MuseScore Visual Tests
======================
# MuseScore Visual Tests
The shell script "gen" creates a subdirectory `html` with the
HTML file `vtest.html` for visual compare including all needed
image files.
Travis generates this too and then uploads to http://vtest.musescore.org/index.html
The idea is to export the scores to png with the reference build of the MuseScore and the current one, and compare these pictures.
The main purpose is to run on CI for pull requests to the main branch.
Can also be used locally for development.
Requirements
---
## Requirements
In order to generate the diff between the reference
file and the generated one, *Image Magick* needs to be
installed and "compare" should be in the `PATH`.
Add a new test
---
- clone a mscx test file into `xxx.mscz`
- create the test by editing the `xxx.mscx` file
- create reference PNG `xxx-ref.png`:
mscore xxx.mscx -o -r 130 xxx-ref.png
- add the file to `gen` and `gen.bat`
## How to use
How to use on Windows
---
- Install *Image Magick*, add it to PATH
- Run `gen.bat`. It will use msvc.install as a default folder to search MuseScore.exe. If you use mingw build, specify the path to install folder manually:
`gen.bat win32install`
To create png files and compare them you can use the `vtest.sh` script.
### Generate reference png
If you do not have any generated reference png, then first you need to generate them.
* You need to build yourself or take anywhere a reference MuseScore build.
* Call the script from the repository root
```
vtest/vtest.sh -c gen_ref -m path/to/ref/mscore
```
* You can see the created files in `vtest.artifacts/ref`
### Generate current png
* You need to build yourself a MuseScore test build.
* Call the script from the repository root
```
vtest/vtest.sh -c gen_cur -m path/to/mscore
```
* You can see the created files in `vtest.artifacts/current`
### Compare
* Call the script from the repository root
```
vtest/vtest.sh -c compare
```
* You can see the created files in `vtest.artifacts/compare`
You can specify some paths explicitly, see `vtest.sh` source.
For Windows, try using Git Bash
## Add new test
Just put the new score in the `vtest/scores` directory.
Score can be in `mscx` and `mscz` format

Binary file not shown.

Before

Width:  |  Height:  |  Size: 14 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 17 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 9.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 8.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 8.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 7.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 54 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 8.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 13 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 14 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 14 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 9.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 9.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 8.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 7.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 10 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 14 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 36 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 9.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 9.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 10 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 9.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 8.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 7.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 20 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 9.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 9.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 7.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 7.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 8.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 7.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 7.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 8.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 9.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 9.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 8.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 8.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.6 KiB

View file

@ -1,14 +0,0 @@
#!/bin/sh
#
# edit file
#
MSCORE=../build.debug/mscore/mscore
echo $MSCORE $1
if test -f $1.mscz; then
$MSCORE $1.mscz;
else
$MSCORE $1.mscx;
fi

Binary file not shown.

Before

Width:  |  Height:  |  Size: 14 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 35 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 9.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 9.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 10 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 13 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 13 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 7.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 17 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 8.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 7.2 KiB

Some files were not shown because too many files have changed in this diff Show more