1. 17 11月, 2021 1 次提交
    • P
      [wasm] renames and cleanup before modularization (#61596) · da0e0f73
      Pavel Savara 提交于
      - no imports from outer scope
      - move dotnet to -extern-pre-js
      - re-enable JS minification with ES2018
      - rename main javaScript files to main.js and test-main.js
      - sample and test script cleanup
      - rename set_exit_code method
      - rewrite test start as async method
      - improve script loading via script element on page in test
      - use BINDING.bind_static_method instead of INTERNAL where possible
      - better .d.ts exports
      - formatted html files
      - renamed modules.ts to imports.ts which makes more sense
      - improved error propagation
      - renamed __initializeImportsAndExports
      - delayed exit and stdout flush
      da0e0f73
  2. 22 10月, 2021 1 次提交
  3. 17 9月, 2021 1 次提交
  4. 18 8月, 2021 1 次提交
    • A
      [wasm] Add incremental build support (#57113) · 3e3b00c5
      Ankit Jain 提交于
      * Update tasks to support incremental build
      
      MonoAOTCompiler:
      - Compiles assemblies to .bc files.
      - Hashes for the .bc files are stored in a json cache file.
      - And uses .depfile generated by mono-aot-cross, to figure out the
        if any of the dependencies have changed
      - Writes out the actual .bc file only if the assembly, or it's
        dependencies changed
      
      EmccCompile.cs: Support a `%(Dependencies)` metadata on the source
      files, to compile the files only when needed.
      
      * Update wasm targets
      
      * don't pass unncessary args to RunTests
      
      * Add tests for incremental builds
      
      * Disable non-wasm builds, for testing
      
      * Add miggins LogAsErrorException.cs
      
      * Bump sdk for workload testing to 6.0.100-rc.1.21410.3
      
      * fix build
      
      * MonoAOTCompiler: use the full path to copy the final .bc file
      
      * Make the method used with `MemberData`, static
      
      otherwise xunit just shows a cryptic:
      ```
          Wasm.Build.Tests.RebuildTests.NoOpRebuild [STARTING]
          Wasm.Build.Tests.RebuildTests.NoOpRebuild [FAIL]
            System.NotSupportedException : Specified method is not supported.
      ```
      
      * add back builds
      
      * Split Wasm.Build.Tests into multiple helix jobs
      
      * Revert "add back builds"
      
      This reverts commit 1d031c04e13780ec73180ba6f06a37ee42c24203.
      
      * Split up native rebuild tests
      
      * remove non-test classes
      
      * add back builds
      
      This reverts commit b008130a7886c2e2b9f16c83641c1b8c936082f6.
      
      * MonoAOTCompiler: make cache optional
      
      * MonoAOTCompiler: handle the case where we have a cache entry, but the file on disk doesn't exist
      
      * Fix aot compiler task output
      
      * MonoAOTCompiler: Use hashes of .bc files instead of assemblies
      
      `--depfile` isn't supported on aot config used by android, and fails
      with:
      
      ```
      * Assertion at /__w/1/s/src/mono/mono/mini/aot-compiler.c:14216, condition `acfg->aot_opts.llvm_only && acfg->aot_opts.asm_only && acfg->aot_opts.llvm_outfile' not met
      ```
      
      Instead, use hashes of the .bc.tmp files generated, with the existing
      .bc files.
      
      * MonoAOTCompiler: Support more than one output file
      
      The earlier implementation assumed that there would be only one output
      file. But in some cases (eg. android), there are more than one, like
      `.s`, `.dll-llvm.o`.
      
      * -bump sdk for workload testing
      
      * MonoAOTCompiler: don't use tmp files at all, when cache isn't being
      
      .. used.
      Co-authored-by: NLarry Ewing <lewing@microsoft.com>
      3e3b00c5
  5. 16 8月, 2021 1 次提交
    • A
      [wasm] Don't use workload for tfm < net6.0 (#56606) · 98ca2ffa
      Ankit Jain 提交于
      * Bump sdk used for testing to 6.0.100-rc.1.21402.6
      
      * InstallWorkloadFromArtifacts: Add OnlyUpdateManifests parameter
      
      * [wasm] Run Wasm.Build.Tests with sdk/no-workload/+EMSDK
      
      Currently, Wasm.Build.Tests are run in two modes:
      
      1. sdk(`$(SdkVersionForWorkloadTesting)`)+workload installed
      2. sdk(from global.json)+EMSDK+LocalBuild targets
      
      this commit changes (2) to:
      
      2. sdk(`$(SdkVersionForWorkloadTesting)`), no workload installed, +
         EMSDK+LocalBuild targets
      
      This makes it closer to what a user would actually use.
      
      Also, for the workload tests, this removes `$(WasmNativeWorkload)`
      always being set to `true`. The workload should be setting that, and not
      the tests.
      
      * Wasm.Build.Tests: Add test for net5.0 blazor projects
      
      * Disable unrelated builds for now
      
      * Revert "Disable unrelated builds for now"
      
      This reverts commit 6fa0efe2ffcfdbcfaba3bdf519a7717809c22672.
      
      * Rename OnlyWasmBuildTests -> TestWasmBuildTests
      98ca2ffa
  6. 14 7月, 2021 1 次提交
  7. 08 7月, 2021 1 次提交
  8. 23 6月, 2021 1 次提交
  9. 28 5月, 2021 1 次提交
  10. 22 4月, 2021 1 次提交
    • S
      Shift Most of Wasm AOT test build to helix (#48226) · 6ca3d910
      Steve Pfister 提交于
      Since AOT'ing each test suite takes between 3-9 min, we need to shift the burden over to helix.
      
      ## This is done by:
      1. building the test assemblies on the build machine
         - the wasm part of the build is not executed on the build machine,
            because it has the AOT build part
      2. Zip up the test assembly+friends, *and* any bits required to run the wasm
          app build for that on helix (eg. emsdk, wasm app targets, cross compiler etc)
      3. Send all this to helix, and use a custom `aot-build.proj`
           - which recreates all the build inputs for the `WasmBuildApp` target
              using the paths for the assets on helix
           - then we can run `WasmBuildApp` for the build, resulting in a wasm app
             bundle.
      4. Run the tests!
      
      - We already have the bits required for building wasm apps on helix, supported
      for `Wasm.Build.Tests`, which we can use here too.
      
      ## Trimming:
      
      - Since, AOT can be so expensive, we use `EnableAggressiveTrimming=true`(EAT), but
         that means that we could have issues due to trimming.
      - And it can sometimes be unclear whether the build/test failures are due to trimming
           or AOT.
      
      - Because these builds+test runs are different from other builds, owing to the
         "build partially on helix" step, a normal EAT build would not be the same as 
      - to help with testing this, we add two lanes to `runtime-staging`:
         - `*_Mono_AOT`: builds AOT+EAT on helix
         - `*_Mono_EAT`: builds EAT, on helix
            - this is required because we want to run almost the same kinda
               build: 1. build test assembly; *2. send to helix; 3. build wasm app;* 4. run tests
      
      - This should effectively mean that we can see which errors might be due to EAT, and
         which are clearly because of EAT+AOT.
      Co-authored-by: NSteve Pfister <steve.pfister@microsoft.com>
      Co-authored-by: NMarek Safar <marek.safar@gmail.com>
      Co-authored-by: NMitchell Hwang <mitchell.hwang@microsoft.com>
      Co-authored-by: NAnkit Jain <radical@gmail.com>
      6ca3d910
  11. 14 4月, 2021 1 次提交
    • R
      [wasm] Initial test support on windows (#49830) · a504a9b3
      Radek Doulik 提交于
      Add support to run libraries tests on windows. Examples of how to run the tests:
      
          .\build.cmd libs.tests -test -os browser
          .\dotnet.cmd build /t:Test /p:TargetOS=Browser src\libraries\System.Collections.Concurrent\tests
          .\dotnet.cmd build /t:Test /p:TargetOS=Browser /p:JSEngine="SpiderMonkey" src\libraries\System.Text.Json\tests
      a504a9b3
  12. 30 3月, 2021 1 次提交
    • A
      [wasm] Wasm.Build.Tests: add support for shared builds (#49398) · 617a18d1
      Ankit Jain 提交于
      * [wasm] Wasm.Build.Tests: add support for shared builds
      
      - Essentially, we want to share builds wherever possible. Example cases:
      
          - Same build, but run with different hosts like v8/chrome/safari, as
            separate test runs
          - Same build but run with different command line arguments
      
      - Sharing builds especially helps when we are AOT'ing, which is slow!
      
      - This is done by caching the builds with the key:
      
          `public record BuildArgs(string ProjectName, string Config, bool AOT, string ProjectFileContents, string? ExtraBuildArgs);`
      
      - Also, ` SharedBuildClassFixture` is added, so that the builds can be
        cleaned up after all the tests in a particular class have finished
        running.
      
      - Each test run gets a randomly generated test id. This is used for
        creating:
        1. build paths, like `artifacts/bin/Wasm.Build.Tests/net6.0-Release/browser-wasm/xharness-output/logs/n1xwbqxi.ict`
        2. and the log for running with xharness, eg. for Chrome, are in
           `artifacts/bin/Wasm.Build.Tests/net6.0-Release/browser-wasm/xharness-output/logs/n1xwbqxi.ict/Chrome/`
      
      - split `WasmBuildAppTest.cs` into : `BuildTestBase.cs`, and
        `MainWithArgsTests.cs`.
      
      * [wasm] Wasm.Build.Tests: Add test for relinking with InvariantGlobalization
      
      * [wasm] Wasm.Build.Tests - Check `CultureInfo` for invariant culture
      
      .. tests. Code stolen from @maximlipin's https://github.com/dotnet/runtime/pull/49204/
      
      * fix invariant+aot test
      
      * [wasm] Fix the order of include paths
      
      For AOT we generate `pinvoke-table.h` in the obj directory. But there is
      one present in the runtime pack too.
      
      In my earlier changes the order in which these were passed as include
      search paths was changed from:
      
      `"-I/runtime/pack/microsoft.netcore.app.runtime.browser-wasm/Release/runtimes/browser-wasm/native/include/wasm" "-Iartifacts/obj/mono/Wasm.Console.Sample/wasm/Release/browser-wasm/wasm/"`
      
      .. which meant that the one from the runtime pack took precedence, and
      got used. So, fix the order!
      
      And change the property names to indicate where they are sourced from.
      
      * [wasm] Only test with Release config on CI
      
      * [wasm] Fallback to `dotnet xharness` if `XHARNESS_CLI_PATH` is not set.
      
      The environment variable is set on helix. During local testing it can be
      useful when using a locally built xharness.
      
      * [wasm] fix invariant test - 'en-ES' -> 'es-ES'
      
      * [wasm] RunWithEmSdkEnv: log the working directory also
      
      * [wasm] Re-enable wasm build tests
      
      * [wasm] Add regression test for issue #49588
      
      * fix test
      
      * [wasm] Cleanup, and add more tests
      
      * Update tests to track wasm relinking being default in some cases
      
      * Fix InvariantGlobalization to track change in wasm relinking defaults
      
      * [wasm] Update emsdk check message to track changes
      
      * [wasm] Update tests to track changes
      
      * [wasm] Move Scenario=BuildWasmApps to be submitted first
      
      TLDR;
      - this might help with the job getting scheduled first, and thus having
        a chance at completing at the same time as others.
      
      Reasoning:
      
      The problem this is trying to fix is:
      
      1. The helix step submits 3 jobs:
          a. library tests to be run with v8
          b. library tests to be run with browser (scenario=wasmtestonbrowser)
          c. Wasm.Build.Tests (scenario=buildwasmapps)
      
      2. The 3 jobs, individually take roughly 30mins each
      3. And they get submitted at roughly the same time
      4. But .. the first two seem to complete earlier, and the 3rd one
         completes 25-30mins later.
      
      The hypothesis is that all the machines might be busy processing the
      200+ work items from each of the first two steps, and so
      Wasm.Build.Tests get scheduled pretty late.
      
      So, here we move that to be submitted first, in the hope that it would
      be able to run in parallel with the other jobs.
      617a18d1
  13. 10 3月, 2021 1 次提交
    • A
      [wasm] Add Wasm.Build tests, for testing wasm app builds (#47683) · 8c64e307
      Ankit Jain 提交于
      * [wasm] Add Wasm.Build tests, for testing wasm app builds
      
      These tests will build wasm test projects, as part of each test method,
      and run them.
      
      Other library tests are run with `xharness`, and the test assembly is run
      under wasm.  But here we want to run them with xunit, outside wasm. So,
      this has different requirements for the helix payload, eg, the sdk,
      xunit console runner etc.
      
      To make it work, a new Scenario - `BuildWasmApps` is added, which emits
      it's archives in a `buildwasmapps/` folder, which makes it easy to pick
      up for the helix test run.
      
      The tests are added under `src/tests/BuildWasmApps/Wasm.Build.Tests`, but
      they use `Directory.Build*` from `src/libraries`, similar to how
      FunctionalTests do it.
      
      Another use case of this kinda scenario are the wasm debugger tests,
      in which the individual test methods launch wasm apps, and then debug
      them. (TBD)
      
      Tests:
      
      - The initial set of tests are just proof-of-concept, and more will be
        added once this is merged.
      
      Note: The individual tests build test projects, and then run them with
      `xharness`, under `v8`, and Chrome.
      
      * [wasm] Disable il stripping completely
      
      This uses `mono-cil-strip` from a mono installation. And in it's current
      form it can cause issues, so disabling it for now.
      
      * Bump helix timeout for tests from 30m to 60m
      
      * [wasm] Cleanup builing RunScriptCommand
      
      .. this allows supporting other properties from xunit*targets, eg. to
      run a particular test `$(XUnitMethodName)`, which adds `-method foobar`
      to the command line.
      
      * [wasm] Fix timeout string, 00:60:00 to 01:00:00
      
      * [wasm] Fix path to build support dir
      
      * cleanup
      
      * [wasm] fix InvariantGlobalization test
      
      * [wasm] cleanup Wasm.Build.Tests.csproj
      
      * [wasm] Add `include_aot` param for the test data
      
      * [wasm] Enable verbose output for xunit
      
      Instead of writing all the output to stdout also, use `-verbose` which
      gives output like:
      
      ```
            Wasm.Build.Tests.WasmBuildAppTest.InvariantGlobalization(config: "Debug", aot: False, invariantGlobalization: null) [STARTING]
        ============== wasm test =============
        ============== wasm test-browser =============
            Wasm.Build.Tests.WasmBuildAppTest.InvariantGlobalization(config: "Debug", aot: False, invariantGlobalization: null) [FINISHED] Time: 8.6357275s
      ```
      
      We log the detailed output to files anyway.
      
      * [wasm] fix tests
      
      * [wasm] Really enable verbose output for xunit, this time
      
      * [wasm] Update tests to track the xharness fix for expected-exit-code
      
      * [wasm] Bump browser job's timeout from 120 to 180 mins
      
      * Improve comment
      Co-authored-by: NMitchell Hwang <mitchhwang1418@gmail.com>
      
      * Update eng/testing/tests.mobile.targets
      Co-authored-by: NMitchell Hwang <mitchhwang1418@gmail.com>
      
      * Remove unrelated commit
      
      Instead, this is moved to a different AOT PR.
      
      Revert "[wasm] Disable il stripping completely"
      
      This reverts commit 25c2340a636be7d8973c09b6808a20466fdcd296.
      
      * Revert "Remove unrelated commit"
      
      This is needed because `mono-cil-strip` isn't available on helix. And we
      want to disable cil stripping anyway.
      
      This reverts commit ead13ee3d9c6d53a22b3c3051542057373c77b31.
      Co-authored-by: NMitchell Hwang <mitchhwang1418@gmail.com>
      8c64e307