Robin
    • Create new note
    • Create a note from template
      • Sharing URL Link copied
      • /edit
      • View mode
        • Edit mode
        • View mode
        • Book mode
        • Slide mode
        Edit mode View mode Book mode Slide mode
      • Customize slides
      • Note Permission
      • Read
        • Only me
        • Signed-in users
        • Everyone
        Only me Signed-in users Everyone
      • Write
        • Only me
        • Signed-in users
        • Everyone
        Only me Signed-in users Everyone
      • Engagement control Commenting, Suggest edit, Emoji Reply
    • Invite by email
      Invitee

      This note has no invitees

    • Publish Note

      Share your work with the world Congratulations! 🎉 Your note is out in the world Publish Note

      Your note will be visible on your profile and discoverable by anyone.
      Your note is now live.
      This note is visible on your profile and discoverable online.
      Everyone on the web can find and read all notes of this public team.
      See published notes
      Unpublish note
      Please check the box to agree to the Community Guidelines.
      View profile
    • Commenting
      Permission
      Disabled Forbidden Owners Signed-in users Everyone
    • Enable
    • Permission
      • Forbidden
      • Owners
      • Signed-in users
      • Everyone
    • Suggest edit
      Permission
      Disabled Forbidden Owners Signed-in users Everyone
    • Enable
    • Permission
      • Forbidden
      • Owners
      • Signed-in users
    • Emoji Reply
    • Enable
    • Versions and GitHub Sync
    • Note settings
    • Note Insights New
    • Engagement control
    • Transfer ownership
    • Delete this note
    • Save as template
    • Insert from template
    • Import from
      • Dropbox
      • Google Drive
      • Gist
      • Clipboard
    • Export to
      • Dropbox
      • Google Drive
      • Gist
    • Download
      • Markdown
      • HTML
      • Raw HTML
Menu Note settings Note Insights Versions and GitHub Sync Sharing URL Create Help
Create Create new note Create a note from template
Menu
Options
Engagement control Transfer ownership Delete this note
Import from
Dropbox Google Drive Gist Clipboard
Export to
Dropbox Google Drive Gist
Download
Markdown HTML Raw HTML
Back
Sharing URL Link copied
/edit
View mode
  • Edit mode
  • View mode
  • Book mode
  • Slide mode
Edit mode View mode Book mode Slide mode
Customize slides
Note Permission
Read
Only me
  • Only me
  • Signed-in users
  • Everyone
Only me Signed-in users Everyone
Write
Only me
  • Only me
  • Signed-in users
  • Everyone
Only me Signed-in users Everyone
Engagement control Commenting, Suggest edit, Emoji Reply
  • Invite by email
    Invitee

    This note has no invitees

  • Publish Note

    Share your work with the world Congratulations! 🎉 Your note is out in the world Publish Note

    Your note will be visible on your profile and discoverable by anyone.
    Your note is now live.
    This note is visible on your profile and discoverable online.
    Everyone on the web can find and read all notes of this public team.
    See published notes
    Unpublish note
    Please check the box to agree to the Community Guidelines.
    View profile
    Engagement control
    Commenting
    Permission
    Disabled Forbidden Owners Signed-in users Everyone
    Enable
    Permission
    • Forbidden
    • Owners
    • Signed-in users
    • Everyone
    Suggest edit
    Permission
    Disabled Forbidden Owners Signed-in users Everyone
    Enable
    Permission
    • Forbidden
    • Owners
    • Signed-in users
    Emoji Reply
    Enable
    Import from Dropbox Google Drive Gist Clipboard
       Owned this note    Owned this note      
    Published Linked with GitHub
    • Any changes
      Be notified of any changes
    • Mention me
      Be notified of mention me
    • Unsubscribe
    # Guest Language Test Suite ### What is it? * *It is a tool* * The test suite provides test components, infrastructure, and result data to end users. * *It can act like a "roadmap" that implementors can choose to follow* * Guest language projects may find it useful to implement tests as a way to track their progress towards Component Model support. * The test suite will be structured with tests of increasing complexity so that implementors can pass simpler tests and build up to harder ones. * *It is an output of the Bytecode Alliance Guest Languages SIG* * The SIG will develop test suite infrastructure and contribute test implementations for affiliated projects. ### What is it not? * *It is not a specification or standard* * Languages are not required to implement or pass tests. * *It is not a benchmark* * Users are discouraged from comparing the performance of tests implemented in different languages. The test suite is focused on correctness, not performance and implementors are not expected to optimize or tune their implementations. * Test timings should only be used by test suite contributors to detect regressions and find opportunities to speed up the overall test suite. ### What is the test suite composed of? * **Test cases** that define the type and behavior a component must implement to pass, * **Source code implementations** of those test cases in various languages, * Guest language **toolchain configurations** for building components, * **Infrastructure** to automatically build, validate, and test implementations. ## Test Cases Each test case represents a specific set of Component-level functionality. For example a component exporting functions with numeric arguments and results. ### Test Type The type of the test component will be represented by a world. ```wit package test:numbers interface api { roundtrip-u8: func(a: u8) -> u8 roundtrip-s8: func(a: s8) -> s8 ... } world test { export api } world runner { import api export run: func() -> bool } ``` ### Test Runner For each test case, the logic for testing whether the component performed the correct behavior will be implemented as its own component. This component will import any functions that the test exports and invoke them in some way checking the results ``` assert_eq!(add_u32(1, 2), 3); assert_eq!(add_i32(4, -2), 2); ... ``` <div style="text-align:center"> <img src="https://hackmd.io/_uploads/SyRE7FHKa.png" /> </div> ### Test Facilities Some tests will involve imports and verifying that the test implementation invokes them in an appropriate way. To support this, test cases may also provide a Component implementing facilities for use by the test. ```py # key-value facility a = dict() def set(k: str, v: str): a[k] = v def get(k: str) -> Optional[str]: return a.get(k) ``` <div style="text-align:center"> <img src="https://hackmd.io/_uploads/rJAH7FrKT.png" /> </div> The test runner may also import exports of the tests facilities so that it can affect the way the test facilities behave during testing and observe the effects of import calls the test implementation makes. ## Source Code Implementations There will be source code implementations for test runners, facilities, and implementations in the test-suite folder of SIG-Guest-Languages. For each test case, each language may implement the test and exactly one language must implement the runner/facility. ``` test-suite ├───README.md ├───rust │ ├───numbers │ ├───numbers-runner │ └───... └───test-cases ├───wit │ └───numbers.wit └───config.json ``` ## Toolchain Configurations All code implemented in a given guest language ## Test Runner The test runner takes the build outputs ### Test Results Every test will be assigned one of the following outcomes. * ✅ Passed * Your test passed all checks * ❌ Failed * Your test failed at least one check * Your test crashed * Your implementation was not a valid component of the expected type * Your implementation failed to build * ⚠️ Not run * Test runner and/or facility crashed * Composer failed * Test runner and/or facility was not a valid component of the expected type * Test runner and/or facility failed to build * ❓ Unimplemented * Test not implemented for this language e.g. | Language | Test | Status | |-|-|-| | rust | numbers | ✅ Passed | | rust | records | ❌ Failed (3 failures) | ### Language Results The "scores" for a given language are the count of tests with each status. e.g. rust (1 ✅, 1 ❌, 0 ⚠️, 98 ❓) > **Note**: > Tests with any number of failed checks are failing tests. The UI and reports will never represent this as a completion percentage to discourage implementors from treating partial sucess like success. The number of failures will be reported to provide a way to see progress towards passing. ## Nix Questions * How will we handle platforms? * Can we easily include a common Nix library in the root of a repo that flakes within the repo use? * I've heard Nix only likes referring to things within the current dir which might make things challenging * How will we structure the Nix flakes? * We could model it after [Nixify](https://github.com/rvolosatovs/nixify/blob/main/examples/rust-lib/flake.nix) such that each test implementation has its own flake that uses some `nixComponent.rust.mkFlake`-style function to define how to build itself. * We could have each implementation just provide a Nix file that's an expression, but is not a flake in itself. # Motivation & Alternatives Considered * Using containers (rejected) * Where should the test-suite live?

    Import from clipboard

    Paste your markdown or webpage here...

    Advanced permission required

    Your current role can only read. Ask the system administrator to acquire write and comment permission.

    This team is disabled

    Sorry, this team is disabled. You can't edit this note.

    This note is locked

    Sorry, only owner can edit this note.

    Reach the limit

    Sorry, you've reached the max length this note can be.
    Please reduce the content or divide it to more notes, thank you!

    Import from Gist

    Import from Snippet

    or

    Export to Snippet

    Are you sure?

    Do you really want to delete this note?
    All users will lose their connection.

    Create a note from template

    Create a note from template

    Oops...
    This template has been removed or transferred.
    Upgrade
    All
    • All
    • Team
    No template.

    Create a template

    Upgrade

    Delete template

    Do you really want to delete this template?
    Turn this template into a regular note and keep its content, versions, and comments.

    This page need refresh

    You have an incompatible client version.
    Refresh to update.
    New version available!
    See releases notes here
    Refresh to enjoy new features.
    Your user state has changed.
    Refresh to load new user state.

    Sign in

    Forgot password

    or

    By clicking below, you agree to our terms of service.

    Sign in via Facebook Sign in via Twitter Sign in via GitHub Sign in via Dropbox Sign in with Wallet
    Wallet ( )
    Connect another wallet

    New to HackMD? Sign up

    Help

    • English
    • 中文
    • Français
    • Deutsch
    • 日本語
    • Español
    • Català
    • Ελληνικά
    • Português
    • italiano
    • Türkçe
    • Русский
    • Nederlands
    • hrvatski jezik
    • język polski
    • Українська
    • हिन्दी
    • svenska
    • Esperanto
    • dansk

    Documents

    Help & Tutorial

    How to use Book mode

    Slide Example

    API Docs

    Edit in VSCode

    Install browser extension

    Contacts

    Feedback

    Discord

    Send us email

    Resources

    Releases

    Pricing

    Blog

    Policy

    Terms

    Privacy

    Cheatsheet

    Syntax Example Reference
    # Header Header 基本排版
    - Unordered List
    • Unordered List
    1. Ordered List
    1. Ordered List
    - [ ] Todo List
    • Todo List
    > Blockquote
    Blockquote
    **Bold font** Bold font
    *Italics font* Italics font
    ~~Strikethrough~~ Strikethrough
    19^th^ 19th
    H~2~O H2O
    ++Inserted text++ Inserted text
    ==Marked text== Marked text
    [link text](https:// "title") Link
    ![image alt](https:// "title") Image
    `Code` Code 在筆記中貼入程式碼
    ```javascript
    var i = 0;
    ```
    var i = 0;
    :smile: :smile: Emoji list
    {%youtube youtube_id %} Externals
    $L^aT_eX$ LaTeX
    :::info
    This is a alert area.
    :::

    This is a alert area.

    Versions and GitHub Sync
    Get Full History Access

    • Edit version name
    • Delete

    revision author avatar     named on  

    More Less

    Note content is identical to the latest version.
    Compare
      Choose a version
      No search result
      Version not found
    Sign in to link this note to GitHub
    Learn more
    This note is not linked with GitHub
     

    Feedback

    Submission failed, please try again

    Thanks for your support.

    On a scale of 0-10, how likely is it that you would recommend HackMD to your friends, family or business associates?

    Please give us some advice and help us improve HackMD.

     

    Thanks for your feedback

    Remove version name

    Do you want to remove this version name and description?

    Transfer ownership

    Transfer to
      Warning: is a public team. If you transfer note to this team, everyone on the web can find and read this note.

        Link with GitHub

        Please authorize HackMD on GitHub
        • Please sign in to GitHub and install the HackMD app on your GitHub repo.
        • HackMD links with GitHub through a GitHub App. You can choose which repo to install our App.
        Learn more  Sign in to GitHub

        Push the note to GitHub Push to GitHub Pull a file from GitHub

          Authorize again
         

        Choose which file to push to

        Select repo
        Refresh Authorize more repos
        Select branch
        Select file
        Select branch
        Choose version(s) to push
        • Save a new version and push
        • Choose from existing versions
        Include title and tags
        Available push count

        Pull from GitHub

         
        File from GitHub
        File from HackMD

        GitHub Link Settings

        File linked

        Linked by
        File path
        Last synced branch
        Available push count

        Danger Zone

        Unlink
        You will no longer receive notification when GitHub file changes after unlink.

        Syncing

        Push failed

        Push successfully