Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tracking Issue for moving UI tests for libstd into unit tests #76268

Closed
jyn514 opened this issue Sep 3, 2020 · 10 comments
Closed

Tracking Issue for moving UI tests for libstd into unit tests #76268

jyn514 opened this issue Sep 3, 2020 · 10 comments
Labels
A-testsuite Area: The testsuite used to check the correctness of rustc C-cleanup Category: PRs that clean code up or issues documenting cleanup. C-tracking-issue Category: A tracking issue for an RFC or an unstable feature. E-easy Call for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue. E-mentor Call for participation: This issue has a mentor. Use #t-compiler/help on Zulip for discussion. Libs-Tracked Libs issues that are tracked on the team's project board. T-libs-api Relevant to the library API team, which will review and decide on the PR/issue.

Comments

@jyn514
Copy link
Member

jyn514 commented Sep 3, 2020

This is a tracking issue for switching UI tests in src/test/ui which only test the standard library into unit tests.

Rationale

This will:

  • Improve compile times for the test suite as a whole, since fewer binaries are being linked and run
  • Make it easier to find the code corresponding to a failing test
  • Allow running more tests without having to first build the stage1 compiler
  • Allow running more tests with miri (https://github.com/RalfJung/miri-test-libstd)

About tracking issues

Tracking issues are used to record the overall progress of implementation.
They are also uses as hubs connecting to other relevant issues, e.g., bugs or open design questions.
A tracking issue is however not meant for large scale discussion, questions, or bug reports about a feature.
Instead, open a dedicated issue for the specific matter and add the relevant feature gate label.

Mentoring instructions (or rather, suggested workflow for contributors)

Please first leave a comment here stating that you want to work on file xxx.rs or module xxx, to make sure that this implements Sync.

  1. Find a test in src/test/ui that has both // run-pass and a use of the standard library. The test also cannot use //~ WARN or any other error annotations, since that is not supported by #[test]. For more information about annotations see https://rustc-dev-guide.rust-lang.org/tests/adding.html#header_commands; if there is an annotation on the test that can't be replicated with #[test] or #[cfg(...)], feel free to skip it.
rg run-pass src/test/ui -l | xargs rg '(std|alloc|core)::' -l | xargs rg -v 'WARN' -l
  1. Move the test into the relevant part of library/. Add a #[test] annotation so it will be run by x.py test library/std. Make sure that it is actually being run - you can be sure by running x.py test --stage 0 library/std --test-args name_of_the_new_test and seeing at least one test run.

If it is unclear whether run-pass exercises standard library or a particular facet of the compiler, you can look at the PR/commit that introduced the test. If it was introduced together with the stdlib API it exercises, then it definitely belongs to library/. If the test would still work with #![no_core], it's testing the compiler and not the standard library, and shouldn't be moved.

Implementation history

For other candidates, see, for example, the tests in https://github.com/rust-lang/rust/blob/master/src/test/ui/consts/std/net/ipv6.rs.

Mentoring instructions for reviewers

I highly recommend git show -w --reverse --color-moved=dimmed-zebra --color-moved-ws=allow-indentation-change <base>.., where <base> is git merge-base origin/master <tip commit> and <tip commit> is the head of the branch.

@matklad has volunteered to review PRs implementing this. Add r? @matklad to the PR description to automatically assign review to them.

@jyn514 jyn514 added E-easy Call for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue. A-testsuite Area: The testsuite used to check the correctness of rustc E-mentor Call for participation: This issue has a mentor. Use #t-compiler/help on Zulip for discussion. T-libs-api Relevant to the library API team, which will review and decide on the PR/issue. C-tracking-issue Category: A tracking issue for an RFC or an unstable feature. labels Sep 3, 2020
CDirkx added a commit to CDirkx/rust that referenced this issue Sep 3, 2020
These tests are about the standard library, not the compiler itself, thus should live in `library`, see rust-lang#76268.
CDirkx added a commit to CDirkx/rust that referenced this issue Sep 3, 2020
CDirkx added a commit to CDirkx/rust that referenced this issue Sep 3, 2020
CDirkx added a commit to CDirkx/rust that referenced this issue Sep 3, 2020
CDirkx added a commit to CDirkx/rust that referenced this issue Sep 3, 2020
CDirkx added a commit to CDirkx/rust that referenced this issue Sep 3, 2020
CDirkx added a commit to CDirkx/rust that referenced this issue Sep 4, 2020
Move:
 - `src\test\ui\consts\const-nonzero.rs` to `library\core`
 - `src\test\ui\consts\ascii.rs` to `library\core`
 - `src\test\ui\consts\cow-is-borrowed` to `library\alloc`

Part of rust-lang#76268
matklad added a commit to matklad/rust that referenced this issue Sep 4, 2020
Move some Vec UI tests into alloc unit tests

A bit of work towards rust-lang#76268, makes a number of the Vec UI tests that are simply running code into unit tests. Ensured that they are being run when testing liballoc locally.
matklad added a commit to matklad/rust that referenced this issue Sep 4, 2020
Make `Ipv4Addr` and `Ipv6Addr` const tests unit tests under `library`

These tests are about the standard library, not the compiler itself, thus should live in `library`, see rust-lang#76268.
matklad added a commit to matklad/rust that referenced this issue Sep 4, 2020
Move various ui const tests to `library`

Move:
 - `src\test\ui\consts\const-nonzero.rs` to `library\core`
 - `src\test\ui\consts\ascii.rs` to `library\core`
 - `src\test\ui\consts\cow-is-borrowed` to `library\alloc`

Part of rust-lang#76268

r? @matklad
matklad added a commit to matklad/rust that referenced this issue Sep 4, 2020
Move some Vec UI tests into alloc unit tests

A bit of work towards rust-lang#76268, makes a number of the Vec UI tests that are simply running code into unit tests. Ensured that they are being run when testing liballoc locally.
matklad added a commit to matklad/rust that referenced this issue Sep 4, 2020
Make `Ipv4Addr` and `Ipv6Addr` const tests unit tests under `library`

These tests are about the standard library, not the compiler itself, thus should live in `library`, see rust-lang#76268.
matklad added a commit to matklad/rust that referenced this issue Sep 4, 2020
Move various ui const tests to `library`

Move:
 - `src\test\ui\consts\const-nonzero.rs` to `library\core`
 - `src\test\ui\consts\ascii.rs` to `library\core`
 - `src\test\ui\consts\cow-is-borrowed` to `library\alloc`

Part of rust-lang#76268

r? @matklad
matklad added a commit to matklad/rust that referenced this issue Sep 4, 2020
Move some Vec UI tests into alloc unit tests

A bit of work towards rust-lang#76268, makes a number of the Vec UI tests that are simply running code into unit tests. Ensured that they are being run when testing liballoc locally.
matklad added a commit to matklad/rust that referenced this issue Sep 4, 2020
Make `Ipv4Addr` and `Ipv6Addr` const tests unit tests under `library`

These tests are about the standard library, not the compiler itself, thus should live in `library`, see rust-lang#76268.
matklad added a commit to matklad/rust that referenced this issue Sep 4, 2020
Move various ui const tests to `library`

Move:
 - `src\test\ui\consts\const-nonzero.rs` to `library\core`
 - `src\test\ui\consts\ascii.rs` to `library\core`
 - `src\test\ui\consts\cow-is-borrowed` to `library\alloc`

Part of rust-lang#76268

r? @matklad
matklad added a commit to matklad/rust that referenced this issue Sep 4, 2020
Move some Vec UI tests into alloc unit tests

A bit of work towards rust-lang#76268, makes a number of the Vec UI tests that are simply running code into unit tests. Ensured that they are being run when testing liballoc locally.
matklad added a commit to matklad/rust that referenced this issue Sep 4, 2020
Make `Ipv4Addr` and `Ipv6Addr` const tests unit tests under `library`

These tests are about the standard library, not the compiler itself, thus should live in `library`, see rust-lang#76268.
matklad added a commit to matklad/rust that referenced this issue Sep 4, 2020
Move various ui const tests to `library`

Move:
 - `src\test\ui\consts\const-nonzero.rs` to `library\core`
 - `src\test\ui\consts\ascii.rs` to `library\core`
 - `src\test\ui\consts\cow-is-borrowed` to `library\alloc`

Part of rust-lang#76268

r? @matklad
m-ou-se added a commit to m-ou-se/rust that referenced this issue Nov 5, 2020
Move f64::NAN ui tests into `library`

This is a partial fix of rust-lang#76268.

r? ```@matklad```
m-ou-se added a commit to m-ou-se/rust that referenced this issue Nov 5, 2020
…brary-core, r=jyn514

Move range in ui test to ops test in library/core

Helps with rust-lang#76268

r? ````@matklad````
ayushmishra2005 pushed a commit to ayushmishra2005/rust that referenced this issue Nov 18, 2020
Dylan-DPC-zz pushed a commit to Dylan-DPC-zz/rust that referenced this issue Nov 24, 2020
Change ui test that are run-pass and that do not test the compiler to library tests

Part of rust-lang#76268, these are some of the relevant ui tests I found that can be replaced by library tests.

Note: this PR just moves the tests, I have not checked for any overlap between these tests and existing library tests. The only test I changed is `env_home_dir`, where I added code to restore the old home dir after testing.

All moved tests:

| ui test | library test file | test |
| --- | --- | --- |
| `const\ascii_ctype.rs` | `core\tests\ascii.rs` | `ascii_ctype_const` |
| `const\const-str-ptr.rs` | `alloc\tests\str.rs` | `const_str_ptr` |
| `assert-eq-trailing-comma.rs` | `core\tests\macros.rs` | `assert_eq_trailing_comma` |
| `assert-escape.rs` | `core\tests\macros.rs` | `assert_escape` |
| `assert-ne-trailing-comma.rs` | `core\tests\macros.rs` | `assert_ne_trailing_comma` |
| `atomic-access-bool.rs` | `core\tests\atomic.rs` | `atomic_access_bool` |
| `atomic-alignment.rs` | `core\tests\atomic.rs` | `atomic_alignment` |
| `atomic-compare_exchange.rs` | `core\tests\atomic.rs` | `atomic_compare_exchange` |
| ~~`atomic-print.rs`~~ | ~~`std\tests\process.rs`~~ | ~~`atomic_print`~~ |
| `bool.rs` | `core\tests\bool.rs` | `test_bool` |
| `bool_not.rs` | `core\tests\bool.rs` | `test_bool_not` |
| `char_unicode.rs` | `core\tests\unicode.rs` | `version` |
| `cmp-default.rs` | `core\tests\cmp.rs` | `cmp_default` |
| `deref-mut-on-ref.rs` | `core\tests\ops.rs` | `deref_mut_on_ref` |
| `deref-on-ref.rs` | `core\tests\ops.rs` | `deref_on_ref` |
| `env-home-dir.rs` | `std\tests\env.rs` | `env_home_dir` |
| ~~`env-vars.rs`~~ | ~~`std\tests\env.rs`~~ | ~~`env_vars`~~ |
| `extend-for-unit.rs` | `core\tests\iter.rs` | `extend_for_unit` |
| `offset_from.rs` | `core\tests\ptr.rs` | `offset_from` |
| `option-ext.rs` | `core\tests\option.rs` | `option_ext` |
| `result-opt-conversions.rs` | `core\tests\result.rs` | `result_opt_conversions` |
| `sleep.rs` | `std\tests\thread.rs` | `sleep` |
| ~~`try-wait.rs`~~ | ~~`std\tests\process.rs`~~ | ~~`try_wait`~~ |
| `utf8.rs` | `alloc\tests\str.rs` | `utf8` |
| `utf8_chars.rs` | `alloc\tests\str.rs` | `utf8_chars` |
| `wrapping-int-api.rs` | `core\tests\num\wrapping.rs` | `wrapping_int_api` |
Dylan-DPC-zz pushed a commit to Dylan-DPC-zz/rust that referenced this issue Nov 30, 2020
Change ui test that are run-pass and that do not test the compiler to library tests

Part of rust-lang#76268, these are some of the relevant ui tests I found that can be replaced by library tests.

Note: this PR just moves the tests, I have not checked for any overlap between these tests and existing library tests. The only test I changed is `env_home_dir`, where I added code to restore the old home dir after testing.

All moved tests:

| ui test | library test file | test |
| --- | --- | --- |
| `const\ascii_ctype.rs` | `core\tests\ascii.rs` | `ascii_ctype_const` |
| `const\const-str-ptr.rs` | `alloc\tests\str.rs` | `const_str_ptr` |
| `assert-eq-trailing-comma.rs` | `core\tests\macros.rs` | `assert_eq_trailing_comma` |
| `assert-escape.rs` | `core\tests\macros.rs` | `assert_escape` |
| `assert-ne-trailing-comma.rs` | `core\tests\macros.rs` | `assert_ne_trailing_comma` |
| `atomic-access-bool.rs` | `core\tests\atomic.rs` | `atomic_access_bool` |
| `atomic-alignment.rs` | `core\tests\atomic.rs` | `atomic_alignment` |
| `atomic-compare_exchange.rs` | `core\tests\atomic.rs` | `atomic_compare_exchange` |
| ~~`atomic-print.rs`~~ | ~~`std\tests\process.rs`~~ | ~~`atomic_print`~~ |
| `bool.rs` | `core\tests\bool.rs` | `test_bool` |
| `bool_not.rs` | `core\tests\bool.rs` | `test_bool_not` |
| `char_unicode.rs` | `core\tests\unicode.rs` | `version` |
| `cmp-default.rs` | `core\tests\cmp.rs` | `cmp_default` |
| `deref-mut-on-ref.rs` | `core\tests\ops.rs` | `deref_mut_on_ref` |
| `deref-on-ref.rs` | `core\tests\ops.rs` | `deref_on_ref` |
| `env-home-dir.rs` | `std\tests\env.rs` | `env_home_dir` |
| ~~`env-vars.rs`~~ | ~~`std\tests\env.rs`~~ | ~~`env_vars`~~ |
| `extend-for-unit.rs` | `core\tests\iter.rs` | `extend_for_unit` |
| `offset_from.rs` | `core\tests\ptr.rs` | `offset_from` |
| `option-ext.rs` | `core\tests\option.rs` | `option_ext` |
| `result-opt-conversions.rs` | `core\tests\result.rs` | `result_opt_conversions` |
| `sleep.rs` | `std\tests\thread.rs` | `sleep` |
| ~~`try-wait.rs`~~ | ~~`std\tests\process.rs`~~ | ~~`try_wait`~~ |
| `utf8.rs` | `alloc\tests\str.rs` | `utf8` |
| `utf8_chars.rs` | `alloc\tests\str.rs` | `utf8_chars` |
| `wrapping-int-api.rs` | `core\tests\num\wrapping.rs` | `wrapping_int_api` |
Dylan-DPC-zz pushed a commit to Dylan-DPC-zz/rust that referenced this issue Nov 30, 2020
…-core, r=jyn514

Remove const_fn_feature_flags test

## Overview

Helps with rust-lang#76268

I found `const_fn_feature_flags` is targeting feature-gate and remove it.

r? `@matklad`
Dylan-DPC-zz pushed a commit to Dylan-DPC-zz/rust that referenced this issue Nov 30, 2020
Move const ip in ui test to unit test

Helps with rust-lang#76268

r? `@matklad`
m-ou-se added a commit to m-ou-se/rust that referenced this issue Dec 1, 2020
Change ui test that are run-pass and that do not test the compiler to library tests

Part of rust-lang#76268, these are some of the relevant ui tests I found that can be replaced by library tests.

Note: this PR just moves the tests, I have not checked for any overlap between these tests and existing library tests. The only test I changed is `env_home_dir`, where I added code to restore the old home dir after testing.

All moved tests:

| ui test | library test file | test |
| --- | --- | --- |
| `const\ascii_ctype.rs` | `core\tests\ascii.rs` | `ascii_ctype_const` |
| `const\const-str-ptr.rs` | `alloc\tests\str.rs` | `const_str_ptr` |
| `assert-eq-trailing-comma.rs` | `core\tests\macros.rs` | `assert_eq_trailing_comma` |
| `assert-escape.rs` | `core\tests\macros.rs` | `assert_escape` |
| `assert-ne-trailing-comma.rs` | `core\tests\macros.rs` | `assert_ne_trailing_comma` |
| `atomic-access-bool.rs` | `core\tests\atomic.rs` | `atomic_access_bool` |
| `atomic-alignment.rs` | `core\tests\atomic.rs` | `atomic_alignment` |
| `atomic-compare_exchange.rs` | `core\tests\atomic.rs` | `atomic_compare_exchange` |
| ~~`atomic-print.rs`~~ | ~~`std\tests\process.rs`~~ | ~~`atomic_print`~~ |
| `bool.rs` | `core\tests\bool.rs` | `test_bool` |
| `bool_not.rs` | `core\tests\bool.rs` | `test_bool_not` |
| `char_unicode.rs` | `core\tests\unicode.rs` | `version` |
| `cmp-default.rs` | `core\tests\cmp.rs` | `cmp_default` |
| `deref-mut-on-ref.rs` | `core\tests\ops.rs` | `deref_mut_on_ref` |
| `deref-on-ref.rs` | `core\tests\ops.rs` | `deref_on_ref` |
| `env-home-dir.rs` | `std\tests\env.rs` | `env_home_dir` |
| ~~`env-vars.rs`~~ | ~~`std\tests\env.rs`~~ | ~~`env_vars`~~ |
| `extend-for-unit.rs` | `core\tests\iter.rs` | `extend_for_unit` |
| `offset_from.rs` | `core\tests\ptr.rs` | `offset_from` |
| `option-ext.rs` | `core\tests\option.rs` | `option_ext` |
| `result-opt-conversions.rs` | `core\tests\result.rs` | `result_opt_conversions` |
| `sleep.rs` | `std\tests\thread.rs` | `sleep` |
| ~~`try-wait.rs`~~ | ~~`std\tests\process.rs`~~ | ~~`try_wait`~~ |
| `utf8.rs` | `alloc\tests\str.rs` | `utf8` |
| `utf8_chars.rs` | `alloc\tests\str.rs` | `utf8_chars` |
| `wrapping-int-api.rs` | `core\tests\num\wrapping.rs` | `wrapping_int_api` |
m-ou-se added a commit to m-ou-se/rust that referenced this issue Dec 1, 2020
…-core, r=jyn514

Remove const_fn_feature_flags test

## Overview

Helps with rust-lang#76268

I found `const_fn_feature_flags` is targeting feature-gate and remove it.

r? `@matklad`
m-ou-se added a commit to m-ou-se/rust that referenced this issue Dec 1, 2020
Move const ip in ui test to unit test

Helps with rust-lang#76268

r? `@matklad`
m-ou-se added a commit to m-ou-se/rust that referenced this issue Dec 1, 2020
Change ui test that are run-pass and that do not test the compiler to library tests

Part of rust-lang#76268, these are some of the relevant ui tests I found that can be replaced by library tests.

Note: this PR just moves the tests, I have not checked for any overlap between these tests and existing library tests. The only test I changed is `env_home_dir`, where I added code to restore the old home dir after testing.

All moved tests:

| ui test | library test file | test |
| --- | --- | --- |
| `const\ascii_ctype.rs` | `core\tests\ascii.rs` | `ascii_ctype_const` |
| `const\const-str-ptr.rs` | `alloc\tests\str.rs` | `const_str_ptr` |
| `assert-eq-trailing-comma.rs` | `core\tests\macros.rs` | `assert_eq_trailing_comma` |
| `assert-escape.rs` | `core\tests\macros.rs` | `assert_escape` |
| `assert-ne-trailing-comma.rs` | `core\tests\macros.rs` | `assert_ne_trailing_comma` |
| `atomic-access-bool.rs` | `core\tests\atomic.rs` | `atomic_access_bool` |
| `atomic-alignment.rs` | `core\tests\atomic.rs` | `atomic_alignment` |
| `atomic-compare_exchange.rs` | `core\tests\atomic.rs` | `atomic_compare_exchange` |
| ~~`atomic-print.rs`~~ | ~~`std\tests\process.rs`~~ | ~~`atomic_print`~~ |
| `bool.rs` | `core\tests\bool.rs` | `test_bool` |
| `bool_not.rs` | `core\tests\bool.rs` | `test_bool_not` |
| `char_unicode.rs` | `core\tests\unicode.rs` | `version` |
| `cmp-default.rs` | `core\tests\cmp.rs` | `cmp_default` |
| `deref-mut-on-ref.rs` | `core\tests\ops.rs` | `deref_mut_on_ref` |
| `deref-on-ref.rs` | `core\tests\ops.rs` | `deref_on_ref` |
| `env-home-dir.rs` | `std\tests\env.rs` | `env_home_dir` |
| ~~`env-vars.rs`~~ | ~~`std\tests\env.rs`~~ | ~~`env_vars`~~ |
| `extend-for-unit.rs` | `core\tests\iter.rs` | `extend_for_unit` |
| `offset_from.rs` | `core\tests\ptr.rs` | `offset_from` |
| `option-ext.rs` | `core\tests\option.rs` | `option_ext` |
| `result-opt-conversions.rs` | `core\tests\result.rs` | `result_opt_conversions` |
| `sleep.rs` | `std\tests\thread.rs` | `sleep` |
| ~~`try-wait.rs`~~ | ~~`std\tests\process.rs`~~ | ~~`try_wait`~~ |
| `utf8.rs` | `alloc\tests\str.rs` | `utf8` |
| `utf8_chars.rs` | `alloc\tests\str.rs` | `utf8_chars` |
| `wrapping-int-api.rs` | `core\tests\num\wrapping.rs` | `wrapping_int_api` |
m-ou-se added a commit to m-ou-se/rust that referenced this issue Dec 1, 2020
…-core, r=jyn514

Remove const_fn_feature_flags test

## Overview

Helps with rust-lang#76268

I found `const_fn_feature_flags` is targeting feature-gate and remove it.

r? ``@matklad``
m-ou-se added a commit to m-ou-se/rust that referenced this issue Dec 1, 2020
Move const ip in ui test to unit test

Helps with rust-lang#76268

r? ``@matklad``
@GroteGnoom
Copy link

@jyn514

#79163 (comment)

@matklad there are probably still some left, but I'm ok with closing the issue and moving the info to the dev-guide, maybe. I think #79038 should be either merged or closed before closing #76268 though.

Since #79038 is merged, should this issue be closed?

@jyn514
Copy link
Member Author

jyn514 commented Jan 7, 2021

Sounds good to me!

@jyn514 jyn514 closed this as completed Jan 7, 2021
@jyn514
Copy link
Member Author

jyn514 commented Jan 7, 2021

Thank you everyone who helped fix this!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-testsuite Area: The testsuite used to check the correctness of rustc C-cleanup Category: PRs that clean code up or issues documenting cleanup. C-tracking-issue Category: A tracking issue for an RFC or an unstable feature. E-easy Call for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue. E-mentor Call for participation: This issue has a mentor. Use #t-compiler/help on Zulip for discussion. Libs-Tracked Libs issues that are tracked on the team's project board. T-libs-api Relevant to the library API team, which will review and decide on the PR/issue.
Projects
None yet
Development

No branches or pull requests

7 participants