From 9ab942b40593bbccd35cb5a08f035842c09aecb4 Mon Sep 17 00:00:00 2001 From: moluopro Date: Wed, 19 Feb 2025 20:01:39 +0800 Subject: [PATCH 1/2] Corrected Building.md and added additional content. --- docs/Building-Dart-SDK-for-ARM-or-RISC-V.md | 23 +++++++++++++++++++++ docs/Building.md | 8 ++----- 2 files changed, 25 insertions(+), 6 deletions(-) diff --git a/docs/Building-Dart-SDK-for-ARM-or-RISC-V.md b/docs/Building-Dart-SDK-for-ARM-or-RISC-V.md index c7a589a9f0d6..73684780e326 100644 --- a/docs/Building-Dart-SDK-for-ARM-or-RISC-V.md +++ b/docs/Building-Dart-SDK-for-ARM-or-RISC-V.md @@ -63,3 +63,26 @@ You can create Debian packages targeting ARM or RISC-V as follows: $ ./tools/linux_dist_support/create_tarball.py $ ./tools/linux_dist_support/create_debian_packages.py -a {ia32, x64, arm, arm64, riscv64} ``` + +# Testing + +In addition to cross-compiling the Dart SDK, test items can also be cross-compiled. Even without the corresponding hardware, you can quickly verify if the source code modifications you made are correct. Below is a simple method for development on the riscv64 platform for your reference. + +Cross-compile the test items on x86_64 Linux to riscv64 and perform correctness check: +1. Follow the steps above to cross-compile the riscv64 sdk. +2. Cross-compile the test items by running: `./tools/build.py --mode release --arch riscv64 most run_ffi_unit_tests`. +3. Install the necessary QEMU dependencies: `sudo apt install qemu-user qemu-user-static qemu-system`. +4. Run the test items, e.g., `tests/lib`: + +```bash +export QEMU_LD_PREFIX=/usr/riscv64-linux-gnu + +./tools/test.py \ + --runtime vm \ + --progress color \ + --arch riscv64 \ + --mode release \ + --time \ + --tasks 8 \ + lib +``` \ No newline at end of file diff --git a/docs/Building.md b/docs/Building.md index 18fd1cfcd59a..f30089741dd9 100644 --- a/docs/Building.md +++ b/docs/Building.md @@ -189,7 +189,6 @@ Dart analyzer tests example: --progress color \ --arch x64 \ --mode release \ - --report \ --time \ --tasks 6 \ language @@ -198,13 +197,10 @@ Dart analyzer tests example: VM tests example: ```bash ./tools/test.py \ - --compiler none \ --runtime vm \ --progress color \ --arch x64 \ --mode release \ - --checked \ - --report \ --time \ --tasks 6 \ language @@ -218,13 +214,13 @@ Dart2JS example: --progress color \ --arch x64 \ --mode release \ - --checked \ - --report \ --time \ --tasks 6 \ language ``` +In the above examples: `--progress` is used to style the progress bar in terminal; `--time` is used to print time information; `--tasks` is used to set the number of parallel tasks; you can use `. /tools/test.py --help` for more details. + ## Troubleshooting and tips for browser tests To debug a browser test failure, you must start a local http server to serve the test. This is made easy with a helper script in dart/tools/testing. The error report from test.py gives the command line to start the server in a message that reads: ```bash From 2038b225e7ea8a93f23bf2998bb493525080c508 Mon Sep 17 00:00:00 2001 From: moluopro Date: Wed, 26 Feb 2025 10:34:29 +0800 Subject: [PATCH 2/2] Remove trailing white-space --- docs/Building-Dart-SDK-for-ARM-or-RISC-V.md | 12 ++++++------ docs/Building.md | 2 +- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/docs/Building-Dart-SDK-for-ARM-or-RISC-V.md b/docs/Building-Dart-SDK-for-ARM-or-RISC-V.md index 73684780e326..7e33f7bcdbf6 100644 --- a/docs/Building-Dart-SDK-for-ARM-or-RISC-V.md +++ b/docs/Building-Dart-SDK-for-ARM-or-RISC-V.md @@ -66,13 +66,13 @@ $ ./tools/linux_dist_support/create_debian_packages.py -a {ia32, x64, arm, arm64 # Testing -In addition to cross-compiling the Dart SDK, test items can also be cross-compiled. Even without the corresponding hardware, you can quickly verify if the source code modifications you made are correct. Below is a simple method for development on the riscv64 platform for your reference. +In addition to cross-compiling the Dart SDK, test items can also be cross-compiled. Even without the corresponding hardware, you can quickly verify if the source code modifications you made are correct. Below is a simple method for development on the riscv64 platform for your reference. -Cross-compile the test items on x86_64 Linux to riscv64 and perform correctness check: -1. Follow the steps above to cross-compile the riscv64 sdk. -2. Cross-compile the test items by running: `./tools/build.py --mode release --arch riscv64 most run_ffi_unit_tests`. -3. Install the necessary QEMU dependencies: `sudo apt install qemu-user qemu-user-static qemu-system`. -4. Run the test items, e.g., `tests/lib`: +Cross-compile the test items on x86_64 Linux to riscv64 and perform correctness check: +1. Follow the steps above to cross-compile the riscv64 sdk. +2. Cross-compile the test items by running: `./tools/build.py --mode release --arch riscv64 most run_ffi_unit_tests`. +3. Install the necessary QEMU dependencies: `sudo apt install qemu-user qemu-user-static qemu-system`. +4. Run the test items, e.g., `tests/lib`: ```bash export QEMU_LD_PREFIX=/usr/riscv64-linux-gnu diff --git a/docs/Building.md b/docs/Building.md index f30089741dd9..c7c6c8ddb1b8 100644 --- a/docs/Building.md +++ b/docs/Building.md @@ -219,7 +219,7 @@ Dart2JS example: language ``` -In the above examples: `--progress` is used to style the progress bar in terminal; `--time` is used to print time information; `--tasks` is used to set the number of parallel tasks; you can use `. /tools/test.py --help` for more details. +In the above examples: `--progress` is used to style the progress bar in terminal; `--time` is used to print time information; `--tasks` is used to set the number of parallel tasks; you can use `. /tools/test.py --help` for more details. ## Troubleshooting and tips for browser tests To debug a browser test failure, you must start a local http server to serve the test. This is made easy with a helper script in dart/tools/testing. The error report from test.py gives the command line to start the server in a message that reads: