Commit 50fd83c
committed
Make compiletest diffs more useful
- Outside of CI, don't show the full rustc command unless --verbose is passed.
- Outside of CI, only show one of the diff and the full stderr. The heuristic for whether to show the diff is:
- it takes up less than 10 lines, or
- it takes up less than a tenth of the total stderr output
- If we show the diff, also show the difference between the normalized output and the actual output for lines which didn't match.
before:
```
failures:
---- [ui] tests/ui/layout/enum.rs stdout ----
Saved the actual stderr to "/home/jyn/src/rust2/build/x86_64-unknown-linux-gnu/test/ui/layout/enum/enum.stderr"
diff of stderr:
- error: align: AbiAndPrefAlign { abi: Align(2 bytes), pref: $PREF_ALIGN }
+ error: align: AbiAndPrefAlign { abi: Align(2 bytes), pref: $PREF_ALIN }
2 --> $DIR/enum.rs:9:1
3 |
4 LL | enum UninhabitedVariantAlign {
The actual stderr differed from the expected stderr.
To update references, rerun the tests and pass the `--bless` flag
To only update this specific test, also pass `--test-args layout/enum.rs`
error: 1 errors occurred comparing output.
status: exit status: 1
command: env -u RUSTC_LOG_COLOR RUSTC_ICE="0" RUST_BACKTRACE="short" "/home/jyn/src/rust2/build/x86_64-unknown-linux-gnu/stage2/bin/rustc" "/home/jyn/src/rust2/tests/ui/layout/enum.rs" "-Zthreads=1" "-Zsimulate-remapped-rust-src-base=/rustc/FAKE_PREFIX" "-Ztranslate-remapped-path-to-local-path=no" "-Z" "ignore-directory-in-diagnostics-source-blocks=/home/jyn/.local/lib/cargo" "-Z" "ignore-directory-in-diagnostics-source-blocks=/home/jyn/src/rust2/vendor" "--sysroot" "/home/jyn/src/rust2/build/x86_64-unknown-linux-gnu/stage2" "--target=x86_64-unknown-linux-gnu" "--check-cfg" "cfg(FALSE)" "--error-format" "json" "--json" "future-incompat" "-Ccodegen-units=1" "-Zui-testing" "-Zdeduplicate-diagnostics=no" "-Zwrite-long-types-to-disk=no" "-Cstrip=debuginfo" "--emit" "metadata" "-C" "prefer-dynamic" "--out-dir" "/home/jyn/src/rust2/build/x86_64-unknown-linux-gnu/test/ui/layout/enum" "-A" "unused" "-A" "internal_features" "-Crpath" "-Cdebuginfo=0" "-Lnative=/home/jyn/src/rust2/build/x86_64-unknown-linux-gnu/native/rust-test-helpers"
stdout: none
--- stderr -------------------------------
error: align: AbiAndPrefAlign { abi: Align(2 bytes), pref: Align(8 bytes) }
--> /home/jyn/src/rust2/tests/ui/layout/enum.rs:9:1
|
LL | enum UninhabitedVariantAlign { //~ERROR: abi: Align(2 bytes)
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error: size: Size(16 bytes)
--> /home/jyn/src/rust2/tests/ui/layout/enum.rs:15:1
|
LL | enum UninhabitedVariantSpace { //~ERROR: size: Size(16 bytes)
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error: abi: ScalarPair(Initialized { value: Int(I8, false), valid_range: 0..=1 }, Initialized { value: Int(I8, false), valid_range: 0..=255 })
--> /home/jyn/src/rust2/tests/ui/layout/enum.rs:21:1
|
LL | enum ScalarPairDifferingSign { //~ERROR: abi: ScalarPair
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error: aborting due to 3 previous errors
------------------------------------------
failures:
[ui] tests/ui/layout/enum.rs
```
after:
```
failures:
---- [ui] tests/ui/layout/enum.rs stdout ----
Saved the actual stderr to "/home/jyn/src/rust2/build/x86_64-unknown-linux-gnu/test/ui/layout/enum/enum.stderr"
diff of stderr:
- error: align: AbiAndPrefAlign { abi: Align(2 bytes), pref: $PREF_ALIGN }
+ error: align: AbiAndPrefAlign { abi: Align(2 bytes), pref: $PREF_ALIN }
2 --> $DIR/enum.rs:9:1
3 |
4 LL | enum UninhabitedVariantAlign {
Note: some mismatched output was normalized before being compared
- error: align: AbiAndPrefAlign { abi: Align(2 bytes), pref: Align(8 bytes) }
- --> /home/jyn/src/rust2/tests/ui/layout/enum.rs:9:1
+ error: align: AbiAndPrefAlign { abi: Align(2 bytes), pref: $PREF_ALIN }
The actual stderr differed from the expected stderr.
To update references, rerun the tests and pass the `--bless` flag
To only update this specific test, also pass `--test-args layout/enum.rs`
error: 1 errors occurred comparing output.
failures:
[ui] tests/ui/layout/enum.rs
[ui] tests/ui/proc-macro/load-panic-backtrace.rs
```1 parent 5bbbc09 commit 50fd83c
File tree
3 files changed
+153
-54
lines changed- src/tools/compiletest/src
- runtest
3 files changed
+153
-54
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
11 | 11 | | |
12 | 12 | | |
13 | 13 | | |
| 14 | + | |
14 | 15 | | |
15 | 16 | | |
16 | 17 | | |
| |||
22 | 23 | | |
23 | 24 | | |
24 | 25 | | |
25 | | - | |
| 26 | + | |
26 | 27 | | |
27 | 28 | | |
28 | 29 | | |
| |||
2292 | 2293 | | |
2293 | 2294 | | |
2294 | 2295 | | |
2295 | | - | |
2296 | | - | |
| 2296 | + | |
| 2297 | + | |
| 2298 | + | |
| 2299 | + | |
| 2300 | + | |
| 2301 | + | |
2297 | 2302 | | |
2298 | 2303 | | |
2299 | | - | |
2300 | | - | |
| 2304 | + | |
| 2305 | + | |
| 2306 | + | |
| 2307 | + | |
| 2308 | + | |
| 2309 | + | |
2301 | 2310 | | |
2302 | 2311 | | |
2303 | 2312 | | |
2304 | | - | |
2305 | | - | |
| 2313 | + | |
| 2314 | + | |
| 2315 | + | |
| 2316 | + | |
| 2317 | + | |
| 2318 | + | |
| 2319 | + | |
| 2320 | + | |
2306 | 2321 | | |
2307 | 2322 | | |
2308 | 2323 | | |
| |||
2530 | 2545 | | |
2531 | 2546 | | |
2532 | 2547 | | |
2533 | | - | |
| 2548 | + | |
| 2549 | + | |
| 2550 | + | |
| 2551 | + | |
| 2552 | + | |
| 2553 | + | |
| 2554 | + | |
2534 | 2555 | | |
2535 | 2556 | | |
2536 | 2557 | | |
| |||
2590 | 2611 | | |
2591 | 2612 | | |
2592 | 2613 | | |
2593 | | - | |
2594 | | - | |
2595 | | - | |
2596 | | - | |
2597 | | - | |
2598 | | - | |
2599 | | - | |
2600 | | - | |
2601 | | - | |
2602 | | - | |
2603 | | - | |
2604 | | - | |
2605 | | - | |
2606 | | - | |
2607 | | - | |
2608 | | - | |
2609 | | - | |
2610 | | - | |
2611 | | - | |
2612 | | - | |
2613 | | - | |
| 2614 | + | |
| 2615 | + | |
| 2616 | + | |
| 2617 | + | |
| 2618 | + | |
| 2619 | + | |
| 2620 | + | |
| 2621 | + | |
| 2622 | + | |
| 2623 | + | |
2614 | 2624 | | |
2615 | 2625 | | |
2616 | 2626 | | |
| |||
2633 | 2643 | | |
2634 | 2644 | | |
2635 | 2645 | | |
| 2646 | + | |
| 2647 | + | |
| 2648 | + | |
| 2649 | + | |
| 2650 | + | |
| 2651 | + | |
| 2652 | + | |
| 2653 | + | |
| 2654 | + | |
| 2655 | + | |
| 2656 | + | |
| 2657 | + | |
| 2658 | + | |
| 2659 | + | |
| 2660 | + | |
| 2661 | + | |
| 2662 | + | |
| 2663 | + | |
| 2664 | + | |
| 2665 | + | |
| 2666 | + | |
| 2667 | + | |
| 2668 | + | |
| 2669 | + | |
| 2670 | + | |
| 2671 | + | |
| 2672 | + | |
| 2673 | + | |
| 2674 | + | |
| 2675 | + | |
| 2676 | + | |
| 2677 | + | |
| 2678 | + | |
| 2679 | + | |
| 2680 | + | |
| 2681 | + | |
| 2682 | + | |
| 2683 | + | |
| 2684 | + | |
| 2685 | + | |
| 2686 | + | |
| 2687 | + | |
| 2688 | + | |
| 2689 | + | |
| 2690 | + | |
| 2691 | + | |
| 2692 | + | |
| 2693 | + | |
| 2694 | + | |
| 2695 | + | |
| 2696 | + | |
| 2697 | + | |
| 2698 | + | |
| 2699 | + | |
| 2700 | + | |
| 2701 | + | |
| 2702 | + | |
| 2703 | + | |
| 2704 | + | |
| 2705 | + | |
| 2706 | + | |
| 2707 | + | |
| 2708 | + | |
| 2709 | + | |
| 2710 | + | |
| 2711 | + | |
| 2712 | + | |
| 2713 | + | |
| 2714 | + | |
| 2715 | + | |
| 2716 | + | |
| 2717 | + | |
| 2718 | + | |
| 2719 | + | |
| 2720 | + | |
| 2721 | + | |
| 2722 | + | |
| 2723 | + | |
| 2724 | + | |
2636 | 2725 | | |
2637 | 2726 | | |
2638 | 2727 | | |
| |||
2749 | 2838 | | |
2750 | 2839 | | |
2751 | 2840 | | |
2752 | | - | |
2753 | | - | |
2754 | | - | |
2755 | | - | |
2756 | | - | |
2757 | | - | |
2758 | | - | |
2759 | | - | |
2760 | | - | |
2761 | | - | |
2762 | | - | |
2763 | | - | |
2764 | | - | |
2765 | | - | |
| 2841 | + | |
| 2842 | + | |
| 2843 | + | |
| 2844 | + | |
| 2845 | + | |
| 2846 | + | |
| 2847 | + | |
| 2848 | + | |
| 2849 | + | |
| 2850 | + | |
| 2851 | + | |
| 2852 | + | |
2766 | 2853 | | |
| 2854 | + | |
2767 | 2855 | | |
| 2856 | + | |
2768 | 2857 | | |
2769 | 2858 | | |
2770 | 2859 | | |
2771 | 2860 | | |
2772 | | - | |
2773 | | - | |
| 2861 | + | |
| 2862 | + | |
2774 | 2863 | | |
2775 | 2864 | | |
2776 | 2865 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
39 | 39 | | |
40 | 40 | | |
41 | 41 | | |
42 | | - | |
43 | | - | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
44 | 48 | | |
45 | 49 | | |
46 | 50 | | |
| |||
135 | 139 | | |
136 | 140 | | |
137 | 141 | | |
138 | | - | |
139 | | - | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
140 | 148 | | |
141 | 149 | | |
142 | 150 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2 | 2 | | |
3 | 3 | | |
4 | 4 | | |
| 5 | + | |
5 | 6 | | |
6 | 7 | | |
7 | 8 | | |
| |||
100 | 101 | | |
101 | 102 | | |
102 | 103 | | |
103 | | - | |
| 104 | + | |
104 | 105 | | |
105 | 106 | | |
106 | 107 | | |
| |||
116 | 117 | | |
117 | 118 | | |
118 | 119 | | |
119 | | - | |
120 | | - | |
121 | | - | |
122 | | - | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
123 | 125 | | |
124 | 126 | | |
125 | 127 | | |
| |||
0 commit comments