-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- add nanoserver unit tests
- Loading branch information
Showing
10 changed files
with
154 additions
and
65 deletions.
There are no files selected for viewing
This file contains 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 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,33 @@ | ||
on: | ||
workflow_call: | ||
inputs: | ||
workflow: | ||
required: true | ||
type: string | ||
artifact: | ||
required: true | ||
type: string | ||
|
||
env: | ||
IMAGE_NAME: mcr.microsoft.com/windows/nanoserver:ltsc2022-amd64 | ||
|
||
jobs: | ||
test-nanoserver: | ||
runs-on: windows-2022 | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- name: pull windows container ${{ env.IMAGE_NAME }} | ||
shell: cmd | ||
run: | | ||
docker pull ${{ env.IMAGE_NAME }} | ||
docker images ${{ env.IMAGE_NAME }} | ||
- uses: actions/download-artifact@v3 | ||
with: | ||
name: ${{ inputs.artifact }} | ||
path: . | ||
|
||
- name: Test ${{ inputs.artifact }} build on nanoserver-ltsc2022 | ||
run: | | ||
tar -xf ./${{ inputs.artifact }}.tar.gz -C ./bin | ||
docker container run --rm -v ${{ github.workspace }}:C:\app -w C:\app\${{ inputs.workflow }} ${{ env.IMAGE_NAME }} C:\app\.tools\busybox64.exe bash test_windows.sh | ||
This file contains 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 |
---|---|---|
@@ -1,5 +1,6 @@ | ||
.idea/ | ||
|
||
release/ | ||
bin/ | ||
|
||
*.tar.gz |
This file contains 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 was deleted.
Oops, something went wrong.
This file contains 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,37 @@ | ||
#!/bin/bash | ||
dp0="$(realpath "$(dirname "$0")")" | ||
set -e | ||
|
||
tool_name="pcre2grep.exe" | ||
tool_version="10.40" | ||
echo "::set-output name=tool_name::$tool_name" | ||
echo "::set-output name=tool_version::$tool_version" | ||
|
||
download_url="https://github.com/PCRE2Project/pcre2/releases/download/pcre2-$tool_version/pcre2-$tool_version.tar.gz" | ||
echo "::group::prepare sources $download_url" | ||
|
||
mkdir -p "$dp0/release/build" && cd "$dp0/release" | ||
wget "$download_url" -O "pcre2-$tool_version.tar.gz" | ||
tar -xf "pcre2-$tool_version.tar.gz" && cd "pcre2-$tool_version" | ||
|
||
echo "::endgroup::" | ||
|
||
echo "::group::build" | ||
|
||
cmake -DPCRE2_SUPPORT_JIT=ON -DPCRE2_BUILD_PCRE2_16=ON -DPCRE2_BUILD_PCRE2_32=ON -B build -DPCRE2_STATIC_RUNTIME=ON | ||
|
||
cmake --build build --config Release | ||
|
||
echo "::endgroup::" | ||
|
||
cp -f "$dp0/release/pcre2-$tool_version/build/Release/$tool_name" "$dp0/release/build" | ||
|
||
cd "$dp0/release/build" | ||
|
||
{ printf 'SHA-256: %s (msvc) | ||
' "$(sha256sum $tool_name)" | ||
} > build-msvc.md | ||
|
||
cat build-msvc.md | ||
|
||
tar -czvf ../build-msvc.tar.gz . |
This file contains 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 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,3 @@ | ||
@echo off | ||
set grep="..\bin\pcre2grep.exe" | ||
echo "sha": "b1", | %grep% --only-matching "(?<=""sha"":\s"")[^,]+(?="")" |
This file contains 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,26 @@ | ||
#!/bin/bash | ||
|
||
grep="../bin/pcre2grep" | ||
|
||
testVersion() { | ||
assertEquals "pcre2grep version 10.40 2022-04-14" "$("$grep" --version)" | ||
} | ||
|
||
testDoubleQuotesWithSpaces() { | ||
assertEquals "test-quotes.zip" "$(echo "test-quotes.zip" | "$grep" --only-matching "[^"" ]*quotes\.zip")" | ||
} | ||
|
||
testParenthesesBracesEscapeDoubleQuotes() { | ||
assertEquals "a1" "$(printf ' "sha": "a1",' | "$grep" --only-matching "(?<=\"sha\":\s\")[^,]+(?=\")")" | ||
} | ||
|
||
testParenthesesBracesSingleQuotes() { | ||
assertEquals "a1" "$(printf ' "sha": "a1",' | "$grep" --only-matching '(?<="sha":\s")[^,]+(?=")')" | ||
} | ||
|
||
testUtf8Smile() { | ||
assertEquals "test-utf8-π.zip" "$(echo "test-utf8-π.zip" | "$grep" "utf8-π\.zip")" | ||
} | ||
|
||
# Load and run shUnit2. | ||
source "../.tests/shunit2/shunit2" |
This file contains 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,30 @@ | ||
#!/bin/bash | ||
|
||
grep="../bin/pcre2grep.exe" | ||
|
||
testVersion() { | ||
assertEquals "pcre2grep version 10.40 2022-04-14" "$("$grep" --version)" | ||
} | ||
|
||
testDoubleQuotesWithSpaces() { | ||
assertEquals "test-quotes.zip" "$(echo "test-quotes.zip" | "$grep" --only-matching "[^"" ]*quotes\.zip")" | ||
} | ||
|
||
testParenthesesBracesEscapeDoubleQuotes() { | ||
assertEquals "a1" "$(printf ' "sha": "a1",' | "$grep" --only-matching "(?<=\"sha\":\s\")[^,]+(?=\")")" | ||
} | ||
|
||
testParenthesesBracesSingleQuotes() { | ||
assertEquals "a1" "$(printf ' "sha": "a1",' | "$grep" --only-matching '(?<="sha":\s")[^,]+(?=")')" | ||
} | ||
|
||
testParenthesesBracesCmd() { | ||
assertEquals "b1" "$(cmd.exe /c test_cmd.bat)" | ||
} | ||
|
||
testUtf8Smile() { | ||
assertEquals "test-utf8-π.zip" "$(echo "test-utf8-π.zip" | "$grep" "utf8-π\.zip")" | ||
} | ||
|
||
# Load and run shUnit2. | ||
source "../.tests/shunit2/shunit2" |