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 to subdirectories #73494

Open
1 of 2 tasks
pnkfelix opened this issue Jun 19, 2020 · 20 comments
Open
1 of 2 tasks

Tracking issue for moving ui tests to subdirectories #73494

pnkfelix opened this issue Jun 19, 2020 · 20 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. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Comments

@pnkfelix
Copy link
Member

pnkfelix commented Jun 19, 2020

NOTE: see #73494 (comment) for mentoring instructions.

Looking at https://github.com/rust-lang/rust/tree/master/src/test/ui, github truncates the list to just the first 1000 entries (of 1564 total entries).

This is especially frustrating since github also sorts by name, not by kind, and so its truncation is cutting off whole subdirectories from the view.

TODO:

@pnkfelix pnkfelix added A-testsuite Area: The testsuite used to check the correctness of rustc T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. C-cleanup Category: PRs that clean code up or issues documenting cleanup. labels Jun 19, 2020
@lcnr
Copy link
Contributor

lcnr commented Jun 19, 2020

The same problem exists for https://github.com/rust-lang/rust/tree/master/src/test/ui/issues with 1,839 omitted entries.

That could be solved by adding using a directory every 10000 issue ids, i.e. ui/issues/10000-19999, ui/issues/20000-29999 and so on

@workingjubilee
Copy link
Member

Also see #76268: many of these are run pass tests that do not particularly need to be UI tests.

@Havvy
Copy link
Contributor

Havvy commented Nov 22, 2020

Is the compiler team okay with PRs that move tests into subdirectories?

@Nadrieril
Copy link
Member

That could be solved by adding using a directory every 10000 issue ids, i.e. ui/issues/10000-19999, ui/issues/20000-29999 and so on

That would technically work, but I'd much rather see some kind of thematic folders. I've been doing that for the bit of the compiler I'm hacking on, and it's been tremendously helpful to have most relevant tests be caught by --test-args pattern. For that same reason I like having the corresponding run-pass/check-pass tests in the same folders too. I don't find the ui/non-ui distinction all that helpful when I'm trying to check if my latest changes broke anything.

@lcnr
Copy link
Contributor

lcnr commented Nov 25, 2020

yeah, i agree that it would be better to group tests by what they are testing, but that's a lot of work and probably won't be done in the near future so imo it would be great to start by grouping them by issue id which is fairly easy and then continue sorting them afterwards

bors added a commit to rust-lang-ci/rust that referenced this issue Dec 7, 2020
Move some tests to subdirectories

Mostly tests related to imports.
(A couple of very outdated tests is also deleted.)

Part of rust-lang#73494.
@petrochenkov
Copy link
Contributor

petrochenkov commented Dec 7, 2020

A simple machine learning model could assist this task well.
Putting a test into one of N subdirectories is a typical classification task.

My knowledge in this area is outdated by about 10 years, but here's one suggested solution

  • Each test (including stderr/stdout) is represented as a bag of tokens + their bigrams and trigrams.
  • A classifier is trained on existing subdirectories using e.g. https://www.csie.ntu.edu.tw/~cjlin/liblinear/ (or substitute some modern analogue).
  • Tests in src/test/ui root and src/test/ui/issues are classified, high confidence tests are moved, low confidence tests are left for manual classification.

(We just need someone who will be able to implement this quickly, that is probably any ML student.)

@petrochenkov
Copy link
Contributor

cc @Eh2406 on the previous comment.

@Eh2406
Copy link
Contributor

Eh2406 commented Dec 7, 2020

Not an ML student, nor familiar with the compiler. Was I who you meant to ping?
Code coverage results for each test would probably make for great features, if we can get it to work. (Did this test run this line of code.)
I'd guess that a simple pca decomposition of that can bring it to a workable number of dimensions, and a k-means can make some clusters. (Keep it low teck until we prove we need more.) But someone with NLP experience may know more about what the best tools are these days.

@petrochenkov
Copy link
Contributor

(@Eh2406 I just remember you've been talking about being familiar with statistics, not suggesting you to actually implement this.)

@matklad
Copy link
Member

matklad commented Dec 7, 2020

Seems like there's a bunch of discussion here and on #79718. I feel rather strongly about this topic, but I also don't have a large stake here, as I don't work with rust-lang/rust test suite on a daily basis.

So I've tried creating a summary document here:

https://hackmd.io/@matklad/Hypu-hosv/edit

Dylan-DPC-zz pushed a commit to Dylan-DPC-zz/rust that referenced this issue Dec 14, 2020
Check the number of entries in UI test on tidy

This helps rust-lang#73494 to be resolved.

r? `@petrochenkov`
bors added a commit to rust-lang-ci/rust that referenced this issue Dec 14, 2020
Check the number of entries in UI test on tidy

This helps rust-lang#73494 to be resolved.

r? `@petrochenkov`
bors added a commit to rust-lang-ci/rust that referenced this issue Jan 1, 2021
…rochenkov

Reduce the entry on `src/test/ui` (UI test root)

CC rust-lang#73494, similar to rust-lang#79776.

r? `@petrochenkov`
@petrochenkov
Copy link
Contributor

petrochenkov commented Jan 4, 2021

I've made a classifier tool as described in #73494 (comment) (https://github.com/petrochenkov/classifui), trained it on the existing subdirectories, and then run on tests in ui/issues and ui root.
The results can be found in https://gist.github.com/petrochenkov/3130672b9d5e6c4253a8fe2f34405703, each line is a test name + three most likely subdirectories with their "confidence scores" (the higher the better - 1.0 good, -1.0 bad).

I don't plan to work on this tool further, but it would be great if someone adopted it and made it conveniently usable by people for suggesting subdirectories for newly added tests.

Some further tasks for the tool:

  • Improve user interface to make the tool usable by other people than me, possibly online. Complexity: easy/medium.
  • Look with human eyes at features with maximum weights or non-zero weights, what are they? Look at the classification results too. Measure quality of the classification by splitting the training set into two parts. Think about better feature construction using this information. Complexity: unknown.
  • Try using coverage-based features instead of (or in addition to) "bag of tokens" features. Complexity: medium/hard.
  • Find out what NLP and related ML achieved in the last ten years and rewrite the classifier using modern simpler and better tools. Complexity: depends on your background.

bors added a commit to rust-lang-ci/rust that referenced this issue Jan 17, 2021
…enkov

Move some tests to more reasonable directories - 2

All tests with a score equal or greater than 1.0 were moved to their respective directories by issuing

```bash
cat FILE | tr -s " " | tr -d '():' | sort -k3 | awk '$3 >= 1' | cut -d " " -f1-2 | sed 's;\\;/;g' | xargs -n2 git mv
```
**Observation**: The first column values is the only column with results greater zero

To attest the confidentiality of the model, some manual revision of at least of tests is needed and this process will be tracked in the following list:

* `src/test/ui/abi/issue-28676.rs` OK rust-lang#28676
* `src/test/ui/array-slice-vec/issue-15730.rs` OK
* `src/test/ui/associated-types/issue-24338.rs` OK rust-lang#54823
* `src/test/ui/associated-types/issue-48551.rs` Looks OK rust-lang#48551
* `src/test/ui/associated-types/issue-50301.rs` Looks OK rust-lang#63577

...

cc rust-lang#73494
r? `@petrochenkov`
@petrochenkov
Copy link
Contributor

petrochenkov commented Jan 17, 2021

Some subdirectories besides issues that were found to be "special":

  • error-codes - very specialized, but can contain anything (not used during training).
  • bad, did_you_mean, rfcs, span, suggestions - meaningless, need to be dismantled (not used during training).
  • binding - has too many misclassified tests, needs an audit.

JohnTitor added a commit to JohnTitor/rust that referenced this issue Feb 1, 2021
…chenkov

Move some tests to more reasonable directories - 3

cc rust-lang#73494
r? `@petrochenkov`

https://github.com/rust-lang/rust/blob/master/src/test/ui/issues/issue-56202.rs <sup>https://github.com/rust-lang/rust/issues/56202</sup>: traits 1.008
https://github.com/rust-lang/rust/blob/master/src/test/ui/issues/issue-69841.rs <sup>https://github.com/rust-lang/rust/issues/69841</sup>: for-loop-while 1.014
https://github.com/rust-lang/rust/blob/master/src/test/ui/issues/issue-10763.rs <sup>https://github.com/rust-lang/rust/issues/10763</sup>: extern 1.016
https://github.com/rust-lang/rust/blob/master/src/test/ui/issues/issue-50599.rs <sup>https://github.com/rust-lang/rust/issues/50599</sup>: resolve 1.018
https://github.com/rust-lang/rust/blob/master/src/test/ui/issues/issue-6128.rs <sup>https://github.com/rust-lang/rust/issues/6128</sup>: traits 1.043
https://github.com/rust-lang/rust/blob/master/src/test/ui/issues/issue-20616-8.rs <sup>https://github.com/rust-lang/rust/issues/20616</sup>: parser 1.045
https://github.com/rust-lang/rust/blob/master/src/test/ui/issues/issue-46553.rs <sup>https://github.com/rust-lang/rust/issues/46553</sup>: consts 1.081
https://github.com/rust-lang/rust/blob/master/src/test/ui/issues/issue-33140-hack-boundaries.rs <sup>https://github.com/rust-lang/rust/issues/33140</sup>: traits 1.101
https://github.com/rust-lang/rust/blob/master/src/test/ui/issues/issue-25826.rs <sup>https://github.com/rust-lang/rust/issues/25826</sup>: consts 1.108
https://github.com/rust-lang/rust/blob/master/src/test/ui/issues/issue-56488.rs <sup>https://github.com/rust-lang/rust/issues/56488</sup>: traits 1.110
https://github.com/rust-lang/rust/blob/master/src/test/ui/issues/issue-58856-1.rs <sup>https://github.com/rust-lang/rust/issues/58856</sup>: parser 1.133
https://github.com/rust-lang/rust/blob/master/src/test/ui/issues/issue-57819.rs <sup>https://github.com/rust-lang/rust/issues/57819</sup>: parser 1.138
https://github.com/rust-lang/rust/blob/master/src/test/ui/issues/issue-54348.rs <sup>https://github.com/rust-lang/rust/issues/54348</sup>: consts 1.155
https://github.com/rust-lang/rust/blob/master/src/test/ui/issues/issue-14309.rs <sup>https://github.com/rust-lang/rust/issues/14309</sup>: lint 1.160
https://github.com/rust-lang/rust/blob/master/src/test/ui/issues/issue-4446.rs <sup>https://github.com/rust-lang/rust/issues/4446</sup>: threads-sendsync 1.203
https://github.com/rust-lang/rust/blob/master/src/test/ui/issues/issue-53675-a-test-called-panic.rs <sup>https://github.com/rust-lang/rust/issues/53675</sup>: test-attrs 1.211
https://github.com/rust-lang/rust/blob/master/src/test/ui/issues/issue-40231-2.rs <sup>https://github.com/rust-lang/rust/issues/40231</sup>: consts 1.213
https://github.com/rust-lang/rust/blob/master/src/test/ui/issues/issue-22037.rs <sup>https://github.com/rust-lang/rust/issues/22037</sup>: associated-types 1.214
https://github.com/rust-lang/rust/blob/master/src/test/ui/issues/issue-59029-2.rs <sup>https://github.com/rust-lang/rust/issues/59029</sup>: traits 1.219
https://github.com/rust-lang/rust/blob/master/src/test/ui/issues/issue-18425.rs <sup>https://github.com/rust-lang/rust/issues/18425</sup>: consts 1.237
https://github.com/rust-lang/rust/blob/master/src/test/ui/issues/issue-6157.rs <sup>https://github.com/rust-lang/rust/issues/6157</sup>: regions 1.238
https://github.com/rust-lang/rust/blob/master/src/test/ui/issues/issue-33819.rs <sup>https://github.com/rust-lang/rust/issues/33819</sup>: borrowck 1.280
https://github.com/rust-lang/rust/blob/master/src/test/ui/issues/issue-3683.rs <sup>https://github.com/rust-lang/rust/issues/3683</sup>: traits 1.283
https://github.com/rust-lang/rust/blob/master/src/test/ui/issues/issue-8709.rs <sup>https://github.com/rust-lang/rust/issues/8709</sup>: macros 1.291
https://github.com/rust-lang/rust/blob/master/src/test/ui/issues/issue-20616-9.rs <sup>https://github.com/rust-lang/rust/issues/20616</sup>: parser 1.293
https://github.com/rust-lang/rust/blob/master/src/test/ui/issues/issue-64732.rs <sup>https://github.com/rust-lang/rust/issues/64732</sup>: parser 1.296
https://github.com/rust-lang/rust/blob/master/src/test/ui/issues/issue-18655.rs <sup>https://github.com/rust-lang/rust/issues/18655</sup>: associated-types 1.305
https://github.com/rust-lang/rust/blob/master/src/test/ui/issues/issue-32947.rs <sup>https://github.com/rust-lang/rust/issues/32947</sup>: simd 1.322
https://github.com/rust-lang/rust/blob/master/src/test/ui/issues/issue-57198.rs <sup>https://github.com/rust-lang/rust/issues/57198</sup>: parser 1.342
https://github.com/rust-lang/rust/blob/master/src/test/ui/issues/issue-10764-rpass.rs <sup>https://github.com/rust-lang/rust/issues/10764</sup>: extern 1.392
https://github.com/rust-lang/rust/blob/master/src/test/ui/issues/issue-73541-2.rs <sup>https://github.com/rust-lang/rust/issues/73541</sup>: async-await 1.422
https://github.com/rust-lang/rust/blob/master/src/test/ui/issues/issue-7970b.rs <sup>https://github.com/rust-lang/rust/issues/7970</sup>: parser 1.439
https://github.com/rust-lang/rust/blob/master/src/test/ui/issues/issue-57684.rs <sup>https://github.com/rust-lang/rust/issues/57684</sup>: parser 1.512
https://github.com/rust-lang/rust/blob/master/src/test/ui/issues/issue-33264.rs <sup>https://github.com/rust-lang/rust/issues/33264</sup>: llvm-asm 1.523
https://github.com/rust-lang/rust/blob/master/src/test/ui/issues/issue-65284-suggest-generic-trait-bound.rs <sup>https://github.com/rust-lang/rust/issues/65284</sup>: suggestions 1.647
https://github.com/rust-lang/rust/blob/master/src/test/ui/issues/issue-17458.rs <sup>https://github.com/rust-lang/rust/issues/17458</sup>: consts 1.711
https://github.com/rust-lang/rust/blob/master/src/test/ui/issues/issue-56762.rs <sup>https://github.com/rust-lang/rust/issues/56762</sup>: consts 1.787
https://github.com/rust-lang/rust/blob/master/src/test/ui/issues/issue-2216.rs <sup>https://github.com/rust-lang/rust/issues/2216</sup>: for-loop-while 1.856
https://github.com/rust-lang/rust/blob/master/src/test/ui/issues/issue-45696-scribble-on-boxed-borrow.rs <sup>https://github.com/rust-lang/rust/issues/45696</sup>: nll 2.009
https://github.com/rust-lang/rust/blob/master/src/test/ui/issues/issue-46036.rs <sup>https://github.com/rust-lang/rust/issues/46036</sup>: nll 2.059

`@petrochenkov` Can you put a place holder (like `N/A`) for tests without GitHub issues? It is a lot easier to parse fixed sized rows.
henryboisdequin pushed a commit to henryboisdequin/rust that referenced this issue Feb 1, 2021
…chenkov

Move some tests to more reasonable directories - 3

cc rust-lang#73494
r? ``@petrochenkov``

https://github.com/rust-lang/rust/blob/master/src/test/ui/issues/issue-56202.rs <sup>https://github.com/rust-lang/rust/issues/56202</sup>: traits 1.008
https://github.com/rust-lang/rust/blob/master/src/test/ui/issues/issue-69841.rs <sup>https://github.com/rust-lang/rust/issues/69841</sup>: for-loop-while 1.014
https://github.com/rust-lang/rust/blob/master/src/test/ui/issues/issue-10763.rs <sup>https://github.com/rust-lang/rust/issues/10763</sup>: extern 1.016
https://github.com/rust-lang/rust/blob/master/src/test/ui/issues/issue-50599.rs <sup>https://github.com/rust-lang/rust/issues/50599</sup>: resolve 1.018
https://github.com/rust-lang/rust/blob/master/src/test/ui/issues/issue-6128.rs <sup>https://github.com/rust-lang/rust/issues/6128</sup>: traits 1.043
https://github.com/rust-lang/rust/blob/master/src/test/ui/issues/issue-20616-8.rs <sup>https://github.com/rust-lang/rust/issues/20616</sup>: parser 1.045
https://github.com/rust-lang/rust/blob/master/src/test/ui/issues/issue-46553.rs <sup>https://github.com/rust-lang/rust/issues/46553</sup>: consts 1.081
https://github.com/rust-lang/rust/blob/master/src/test/ui/issues/issue-33140-hack-boundaries.rs <sup>https://github.com/rust-lang/rust/issues/33140</sup>: traits 1.101
https://github.com/rust-lang/rust/blob/master/src/test/ui/issues/issue-25826.rs <sup>https://github.com/rust-lang/rust/issues/25826</sup>: consts 1.108
https://github.com/rust-lang/rust/blob/master/src/test/ui/issues/issue-56488.rs <sup>https://github.com/rust-lang/rust/issues/56488</sup>: traits 1.110
https://github.com/rust-lang/rust/blob/master/src/test/ui/issues/issue-58856-1.rs <sup>https://github.com/rust-lang/rust/issues/58856</sup>: parser 1.133
https://github.com/rust-lang/rust/blob/master/src/test/ui/issues/issue-57819.rs <sup>https://github.com/rust-lang/rust/issues/57819</sup>: parser 1.138
https://github.com/rust-lang/rust/blob/master/src/test/ui/issues/issue-54348.rs <sup>https://github.com/rust-lang/rust/issues/54348</sup>: consts 1.155
https://github.com/rust-lang/rust/blob/master/src/test/ui/issues/issue-14309.rs <sup>https://github.com/rust-lang/rust/issues/14309</sup>: lint 1.160
https://github.com/rust-lang/rust/blob/master/src/test/ui/issues/issue-4446.rs <sup>https://github.com/rust-lang/rust/issues/4446</sup>: threads-sendsync 1.203
https://github.com/rust-lang/rust/blob/master/src/test/ui/issues/issue-53675-a-test-called-panic.rs <sup>https://github.com/rust-lang/rust/issues/53675</sup>: test-attrs 1.211
https://github.com/rust-lang/rust/blob/master/src/test/ui/issues/issue-40231-2.rs <sup>https://github.com/rust-lang/rust/issues/40231</sup>: consts 1.213
https://github.com/rust-lang/rust/blob/master/src/test/ui/issues/issue-22037.rs <sup>https://github.com/rust-lang/rust/issues/22037</sup>: associated-types 1.214
https://github.com/rust-lang/rust/blob/master/src/test/ui/issues/issue-59029-2.rs <sup>https://github.com/rust-lang/rust/issues/59029</sup>: traits 1.219
https://github.com/rust-lang/rust/blob/master/src/test/ui/issues/issue-18425.rs <sup>https://github.com/rust-lang/rust/issues/18425</sup>: consts 1.237
https://github.com/rust-lang/rust/blob/master/src/test/ui/issues/issue-6157.rs <sup>https://github.com/rust-lang/rust/issues/6157</sup>: regions 1.238
https://github.com/rust-lang/rust/blob/master/src/test/ui/issues/issue-33819.rs <sup>https://github.com/rust-lang/rust/issues/33819</sup>: borrowck 1.280
https://github.com/rust-lang/rust/blob/master/src/test/ui/issues/issue-3683.rs <sup>https://github.com/rust-lang/rust/issues/3683</sup>: traits 1.283
https://github.com/rust-lang/rust/blob/master/src/test/ui/issues/issue-8709.rs <sup>https://github.com/rust-lang/rust/issues/8709</sup>: macros 1.291
https://github.com/rust-lang/rust/blob/master/src/test/ui/issues/issue-20616-9.rs <sup>https://github.com/rust-lang/rust/issues/20616</sup>: parser 1.293
https://github.com/rust-lang/rust/blob/master/src/test/ui/issues/issue-64732.rs <sup>https://github.com/rust-lang/rust/issues/64732</sup>: parser 1.296
https://github.com/rust-lang/rust/blob/master/src/test/ui/issues/issue-18655.rs <sup>https://github.com/rust-lang/rust/issues/18655</sup>: associated-types 1.305
https://github.com/rust-lang/rust/blob/master/src/test/ui/issues/issue-32947.rs <sup>https://github.com/rust-lang/rust/issues/32947</sup>: simd 1.322
https://github.com/rust-lang/rust/blob/master/src/test/ui/issues/issue-57198.rs <sup>https://github.com/rust-lang/rust/issues/57198</sup>: parser 1.342
https://github.com/rust-lang/rust/blob/master/src/test/ui/issues/issue-10764-rpass.rs <sup>https://github.com/rust-lang/rust/issues/10764</sup>: extern 1.392
https://github.com/rust-lang/rust/blob/master/src/test/ui/issues/issue-73541-2.rs <sup>https://github.com/rust-lang/rust/issues/73541</sup>: async-await 1.422
https://github.com/rust-lang/rust/blob/master/src/test/ui/issues/issue-7970b.rs <sup>https://github.com/rust-lang/rust/issues/7970</sup>: parser 1.439
https://github.com/rust-lang/rust/blob/master/src/test/ui/issues/issue-57684.rs <sup>https://github.com/rust-lang/rust/issues/57684</sup>: parser 1.512
https://github.com/rust-lang/rust/blob/master/src/test/ui/issues/issue-33264.rs <sup>https://github.com/rust-lang/rust/issues/33264</sup>: llvm-asm 1.523
https://github.com/rust-lang/rust/blob/master/src/test/ui/issues/issue-65284-suggest-generic-trait-bound.rs <sup>https://github.com/rust-lang/rust/issues/65284</sup>: suggestions 1.647
https://github.com/rust-lang/rust/blob/master/src/test/ui/issues/issue-17458.rs <sup>https://github.com/rust-lang/rust/issues/17458</sup>: consts 1.711
https://github.com/rust-lang/rust/blob/master/src/test/ui/issues/issue-56762.rs <sup>https://github.com/rust-lang/rust/issues/56762</sup>: consts 1.787
https://github.com/rust-lang/rust/blob/master/src/test/ui/issues/issue-2216.rs <sup>https://github.com/rust-lang/rust/issues/2216</sup>: for-loop-while 1.856
https://github.com/rust-lang/rust/blob/master/src/test/ui/issues/issue-45696-scribble-on-boxed-borrow.rs <sup>https://github.com/rust-lang/rust/issues/45696</sup>: nll 2.009
https://github.com/rust-lang/rust/blob/master/src/test/ui/issues/issue-46036.rs <sup>https://github.com/rust-lang/rust/issues/46036</sup>: nll 2.059

``@petrochenkov`` Can you put a place holder (like `N/A`) for tests without GitHub issues? It is a lot easier to parse fixed sized rows.
bors added a commit to rust-lang-ci/rust that referenced this issue Apr 27, 2022
Move some tests to more reasonable places

cc rust-lang#73494
r? `@petrochenkov`
bors added a commit to rust-lang-ci/rust that referenced this issue May 2, 2022
Move some tests to more reasonable places

cc rust-lang#73494
r? `@petrochenkov`

16602 -> `codegen` because of rust-lang#16602 (comment)
JohnTitor added a commit to JohnTitor/rust that referenced this issue May 10, 2022
Move some tests to more reasonable places

cc rust-lang#73494
r? `@petrochenkov`
@jyn514
Copy link
Member

jyn514 commented Apr 8, 2023

This work seems to have stalled a bit. Here is my understanding of the current status:

const ENTRY_LIMIT: usize = 1000;
// FIXME: The following limits should be reduced eventually.
const ROOT_ENTRY_LIMIT: usize = 881;
const ISSUES_ENTRY_LIMIT: usize = 1978;

  • The tests/ui subdirectory is small enough. 881 entries is still large, but small enough it doesn't break github.
  • All other directories are small enough except for the ui/issues subdirectory, which still needs organizing.

Mentoring instructions: For each test in tests/ui/issues you want to move,

  • Find a reasonable directory to move it to. You can either "eyeball" the contents of the test file, look at the name of the issue it's referring to, or try to use Petrochenkov's ML tool: Tracking issue for moving ui tests to subdirectories #73494 (comment)
  • Run git mv tests/ui/issues/issue-NNNN.rs tests/ui/new-subdirectory. Preferably also give the test a more helpful name, but just moving it is ok too.
  • Run x test tests/ui/new-subdirectory/issue-NNNN.rs to make sure it passes after your change. I suggest enabling download-rustc = true in config.toml so you don't have to build the compiler from source.

@jyn514 jyn514 changed the title There are too many entries in the test suite directories Tracking issue for moving ui tests to subdirectories Apr 8, 2023
@jyn514 jyn514 added 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. C-tracking-issue Category: A tracking issue for an RFC or an unstable feature. labels Apr 8, 2023
@c410-f3r
Copy link
Contributor

c410-f3r commented Apr 8, 2023

I will get back to this issue in the next few days.

IIUC, the thing about keeping tests/ui small is to help in a future organization where each test is in an more appropriated and descriptive directory.

matthiaskrgr added a commit to matthiaskrgr/rust that referenced this issue Apr 12, 2023
…ertlarsan68

tidy: Issue an error when UI test limits are too high

cc rust-lang#73494
Ensuring the limits are as low as they need to be will make it harder to accidentally add new tests to any large directories
bors added a commit to rust-lang-ci/rust that referenced this issue Aug 5, 2023
Rename tests/ui/issues/issue-100605.rs to ../type/option-ref-advice.rs

The test is a regression test for a [bug ](rust-lang#100605) where the compiler gave bad advice for an `Option<&String>`. Rename the file appropriately.

Part of rust-lang#73494
weihanglo added a commit to weihanglo/rust that referenced this issue Aug 24, 2023
…=compiler-errors

Move some ui tests to subdirectories

cc rust-lang#73494
issue-2804 -> `macros/` (there's already the minified `issue-2804-2` there)
issue-17431 -> `structs-enums/struct-rec` and new `structs-enums/enum-rec` (original issue pertains to detection of recursive enums and structs)
issue-29181 and issue-66768 - moved according to the classifier tool
@petrochenkov
Copy link
Contributor

petrochenkov commented Oct 4, 2023

Find out what NLP and related ML achieved in the last ten years and rewrite the classifier using modern simpler and better tools.

@cinemere did some research on Rust code classification (https://github.com/cinemere/code-classification), and applied the results to this task.
The improvements from using modern CodeParrot models are about 71% -> 74% in the accuracy of classification, at cost of larger required training and classification time/resources.

So from practical point of view (e.g. running on CI) classifui (based on sparse linear SVM) may be a good enough tradeoff.

@seqre
Copy link
Contributor

seqre commented Jan 30, 2024

I understand the need to categorize the issues into more descriptive directories for better organization in the long run and to reduce the number of files in the directory. But this is something to be done on an issue level and seems to be a more difficult project.

If we wanted to reduce the number of files significantly on a file level, we could group all test files for a single issue into a single directory. This would quickly reduce the number of files in the issues/ directory from 1854 to 1227. The categorization at an issue level would still have to happen, but at least the effort required to reduce the number of files in the directory would be significantly reduced.

For quick&dirty POC, here's the snippet that shows the idea:

for i in $(ls issue*.* | cut -d'-' -f2 | cut -d'.' -f 1 | grep -v "[^0-9]" | sort -n | uniq -c |grep -v "      1" | cut -d ' ' -f 8); do mkdir issue-$i; git mv issue-$i*.* issue-$i; done

If there's a consensus to implement that, I could submit a PR.

GuillaumeGomez added a commit to GuillaumeGomez/rust that referenced this issue Jan 30, 2024
…nethercote

Move UI issue tests to subdirectories

I've moved issue tests numbered 1920, 3668, 5997, 23302, 32122, 40510, 57741, 71676, and 76077 to relevant better-named subdirectories (tracking issue rust-lang#73494). The issues were chosen by having the highest number of files per issue.

I adjusted the `ISSUES_ENTRY_LIMIT` because `tidy` was shouting at me.
@petrochenkov
Copy link
Contributor

and to reduce the number of files in the directory

I don't think simply reducing this number is a goal.

The classifui tool is working pretty well, and @c410-f3r has already moved hundreds of tests to "semantically appropriate" subdirectories using it.
This is just some work that needs to happen in the background, not even intensively, just consistently.

rust-timer added a commit to rust-lang-ci/rust that referenced this issue Jan 30, 2024
Rollup merge of rust-lang#120439 - seqre-contrib:moving-ui-tests, r=nnethercote

Move UI issue tests to subdirectories

I've moved issue tests numbered 1920, 3668, 5997, 23302, 32122, 40510, 57741, 71676, and 76077 to relevant better-named subdirectories (tracking issue rust-lang#73494). The issues were chosen by having the highest number of files per issue.

I adjusted the `ISSUES_ENTRY_LIMIT` because `tidy` was shouting at me.
@c410-f3r
Copy link
Contributor

Time to get back to this topic. Hope it ends this year 🤞

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. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

No branches or pull requests