refactor(lint): fix clippy lints #261
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
| name: Windows Test Suite | |
| on: [push, pull_request] | |
| env: | |
| CARGO_TERM_COLOR: always | |
| jobs: | |
| windows-tests-opt: | |
| name: "LLVM/OPT ${{ matrix.llvm-version[0] }} Windows" | |
| runs-on: windows-latest | |
| env: | |
| LLVM_INSTALL_PATH: C:\LLVM | |
| TEST_PLUGINS_PATH: tests\plugins\target\debug | |
| EX_PLUGINS_PATH: target\debug\examples | |
| strategy: | |
| matrix: | |
| llvm-version: | |
| - ["11", "11-0", "v11.0.1-rust-1.51/llvm-lld-11.0.1-rust-1.51-windows-x86_64.7z"] | |
| - ["12", "12-0", "v12.0.1-rust-1.55/llvm-lld-12.0.1-rust-1.55-windows-x86_64.7z"] | |
| - ["13", "13-0", "v13.0.0-rust-1.59/llvm-lld-13.0.0-rust-1.59-windows-x86_64.7z"] | |
| - ["14", "14-0", "v14.0.6-rust-1.64/llvm-lld-14.0.6-rust-1.64-windows-x86_64.7z"] | |
| - ["15", "15-0", "v15.0.0-rust-1.65/llvm-lld-15.0.0-rust-1.65-windows-x86_64.7z"] | |
| - ["16", "16-0", "v16.0.2-rust-1.71/llvm-lld-16.0.2-rust-1.71-windows-x86_64.7z"] | |
| - ["17", "17-0", "v17.0.6-rust-1.75/llvm-lld-17.0.6-rust-1.75-windows-x86_64.7z"] | |
| - ["18", "18-1", "v18.1.2-rust-1.78/llvm-lld-18.1.2-rust-1.78-windows-x86_64.7z"] | |
| steps: | |
| - name: Checkout Repo | |
| uses: actions/checkout@v2 | |
| - name: Setup LLVM Installation Path | |
| run: | | |
| mkdir ${{ env.LLVM_INSTALL_PATH }} | |
| echo ${{ env.LLVM_INSTALL_PATH }}\bin | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append | |
| - name: Check LLVM Artifacts In Cache | |
| id: cache-llvm | |
| uses: actions/cache@v3 | |
| with: | |
| path: | | |
| ${{ env.LLVM_INSTALL_PATH }}\bin\llvm-config.exe | |
| ${{ env.LLVM_INSTALL_PATH }}\bin\opt.exe | |
| ${{ env.LLVM_INSTALL_PATH }}\bin\LLVM-C.dll | |
| ${{ env.LLVM_INSTALL_PATH }}\lib\opt.lib | |
| ${{ env.LLVM_INSTALL_PATH }}\lib\LLVM-C.lib | |
| ${{ env.LLVM_INSTALL_PATH }}\include | |
| key: ${{ runner.os }}-llvm-${{ matrix.llvm-version[0] }}-opt | |
| - name: Download LLVM Binaries | |
| if: steps.cache-llvm.outputs.cache-hit != 'true' | |
| run: | | |
| Invoke-WebRequest -UserAgent 'GithubCI' -outfile llvm.7z https://github.com/jamesmth/llvm-project/releases/download/${{ matrix.llvm-version[2] }} | |
| 7z x -oC: llvm.7z | |
| - name: Build Tests | |
| run: | | |
| cargo b ` | |
| --manifest-path tests\plugins\Cargo.toml ` | |
| -p plugin* ` | |
| --no-default-features ` | |
| --features target-x86,llvm${{ matrix.llvm-version[1] }},win-link-opt | |
| - name: Run Tests | |
| run: | | |
| opt ` | |
| --load-pass-plugin="${{ env.TEST_PLUGINS_PATH }}\plugin1.dll" ` | |
| --passes="mpass,function(fpass)" ` | |
| tests/test.ll ` | |
| -disable-output | |
| opt ` | |
| --load-pass-plugin="${{ env.TEST_PLUGINS_PATH }}\plugin2.dll" ` | |
| --passes="mpass1,mpass2" ` | |
| tests/test.ll ` | |
| -disable-output | |
| opt ` | |
| --load-pass-plugin="${{ env.TEST_PLUGINS_PATH }}\plugin3.dll" ` | |
| --passes="mpass1,mpass2" ` | |
| tests/test.ll ` | |
| -disable-output | |
| opt ` | |
| --load-pass-plugin="${{ env.TEST_PLUGINS_PATH }}\plugin4.dll" ` | |
| --passes="mpass,function(fpass)" ` | |
| tests/test.ll ` | |
| -disable-output | |
| opt ` | |
| --load-pass-plugin="${{ env.TEST_PLUGINS_PATH }}\plugin5.dll" ` | |
| --passes="mpass,function(fpass)" ` | |
| tests/test.ll ` | |
| -disable-output | |
| opt ` | |
| --load-pass-plugin="${{ env.TEST_PLUGINS_PATH }}\plugin6.dll" ` | |
| --passes="default<O3>" ` | |
| tests/test.ll ` | |
| -disable-output | |
| opt ` | |
| --load-pass-plugin="${{ env.TEST_PLUGINS_PATH }}\plugin7.dll" ` | |
| --passes="lto<O3>" ` | |
| tests/test.ll ` | |
| -disable-output | |
| - name: Build Examples | |
| run: | | |
| cargo b ` | |
| --examples ` | |
| --features llvm${{ matrix.llvm-version[1] }},win-link-opt | |
| - name: Run Examples | |
| run: | | |
| opt ` | |
| --load-pass-plugin="${{ env.EX_PLUGINS_PATH }}\hello_world.dll" ` | |
| --passes="hello-world" ` | |
| tests/test.ll ` | |
| -disable-output | |
| opt ` | |
| --load-pass-plugin="${{ env.EX_PLUGINS_PATH }}\opcode_counter.dll" ` | |
| --passes="opcode-counter-printer" ` | |
| tests/test.ll ` | |
| -disable-output | |
| opt ` | |
| --load-pass-plugin="${{ env.EX_PLUGINS_PATH }}\inject_printf.dll" ` | |
| --passes="inject-func-call" ` | |
| tests/test.ll ` | |
| -disable-output | |
| opt ` | |
| --load-pass-plugin="${{ env.EX_PLUGINS_PATH }}\static_call_counter.dll" ` | |
| --passes="static-cc-printer" ` | |
| tests/test.ll ` | |
| -disable-output | |
| opt ` | |
| --load-pass-plugin="${{ env.EX_PLUGINS_PATH }}\string_obf.dll" ` | |
| --passes="string-obfuscator-pass" ` | |
| tests/test.ll ` | |
| -disable-output | |
| windows-tests-lld: | |
| name: "LLVM/LLD ${{ matrix.llvm-version[0] }} Windows" | |
| runs-on: windows-latest | |
| env: | |
| LLVM_INSTALL_PATH: C:\LLVM | |
| PLUGINS_PATH: tests\plugins\target\debug | |
| strategy: | |
| matrix: | |
| llvm-version: | |
| - ["13", "13-0", "1.59", "v13.0.0-rust-1.59/llvm-lld-13.0.0-rust-1.59-windows-x86_64.7z"] | |
| - ["14", "14-0", "1.64", "v14.0.6-rust-1.64/llvm-lld-14.0.6-rust-1.64-windows-x86_64.7z"] | |
| - ["15", "15-0", "1.65", "v15.0.0-rust-1.65/llvm-lld-15.0.0-rust-1.65-windows-x86_64.7z"] | |
| - ["16", "16-0", "1.71", "v16.0.2-rust-1.71/llvm-lld-16.0.2-rust-1.71-windows-x86_64.7z"] | |
| - ["17", "17-0", "1.75", "v17.0.6-rust-1.75/llvm-lld-17.0.6-rust-1.75-windows-x86_64.7z"] | |
| - ["18", "18-1", "1.78", "v18.1.2-rust-1.78/llvm-lld-18.1.2-rust-1.78-windows-x86_64.7z"] | |
| steps: | |
| - name: Checkout Repo | |
| uses: actions/checkout@v2 | |
| - name: Setup LLVM Installation Path | |
| run: | | |
| mkdir ${{ env.LLVM_INSTALL_PATH }} | |
| echo ${{ env.LLVM_INSTALL_PATH }}\bin | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append | |
| - name: Check LLVM Artifacts In Cache | |
| id: cache-llvm | |
| uses: actions/cache@v3 | |
| with: | |
| path: | | |
| ${{ env.LLVM_INSTALL_PATH }}\bin\llvm-config.exe | |
| ${{ env.LLVM_INSTALL_PATH }}\bin\lld.exe | |
| ${{ env.LLVM_INSTALL_PATH }}\bin\LLVM-C.dll | |
| ${{ env.LLVM_INSTALL_PATH }}\lib\lld.lib | |
| ${{ env.LLVM_INSTALL_PATH }}\lib\LLVM-C.lib | |
| ${{ env.LLVM_INSTALL_PATH }}\include | |
| key: ${{ runner.os }}-llvm-${{ matrix.llvm-version[0] }}-lld | |
| - name: Download LLVM Binaries | |
| if: steps.cache-llvm.outputs.cache-hit != 'true' | |
| run: | | |
| Invoke-WebRequest -UserAgent 'GithubCI' -outfile llvm.7z https://github.com/jamesmth/llvm-project/releases/download/${{ matrix.llvm-version[3] }} | |
| 7z x -oC: llvm.7z | |
| - name: Build Tests | |
| run: | | |
| cargo b ` | |
| --manifest-path tests\plugins\Cargo.toml ` | |
| -p plugin*-lld ` | |
| --no-default-features ` | |
| --features target-x86,llvm${{ matrix.llvm-version[1] }},win-link-lld | |
| - name: Run Tests | |
| run: | | |
| rustup install ${{ matrix.llvm-version[2] }} | |
| rustup default ${{ matrix.llvm-version[2] }} | |
| $env:RUSTFLAGS=" ` | |
| -Clinker-plugin-lto ` | |
| -Clinker=${{ env.LLVM_INSTALL_PATH }}\bin\lld.exe ` | |
| -Clink-arg=/load-pass-plugin:$env:GITHUB_WORKSPACE\${{ env.PLUGINS_PATH }}\plugin1_lld.dll ` | |
| -Clink-arg=/lto-newpm-passes:mpass ` | |
| " | |
| cargo b --manifest-path tests\test-rust\Cargo.toml --release | |
| $(cat C:\rust.ll) -eq "1" |