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

WIP: snapshot test for #72550 #72665

Closed
wants to merge 7 commits into from
Closed
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 33 additions & 0 deletions src/test/run-make-fulldeps/issue-72550/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
-include ../tools.mk


ifeq ($(UNAME),Darwin)
SNAPSHOT_NAME := apple.stderr
else
ifdef IS_WINDOWS
# TODO: Actually get the line numbers for windows and linux
# TODO: Find a way to prevent the snapshot from changing every time the
# implementation files chage. Probably using `sed` or `cat-and-grep`?
SNAPSHOT_NAME := windows.stderr
else
# TODO: which other platforms use this branch?
SNAPSHOT_NAME := linux.stderr
endif
endif

ifdef BLESS
COMPARE_SNAPSHOTS := echo "updating snapshot $(SNAPSHOT_NAME)" && mv $(TMPDIR)/panic.stderr.actual $(SNAPSHOT_NAME)
else
COMPARE_SNAPSHOTS := diff -u $(TMPDIR)/panic.stderr.actual $(SNAPSHOT_NAME) \
|| ( \
echo "stderr does not match snapshot $(SNAPSHOT_NAME)." && \
echo "Re-run with BLESS=1 to update." && \
exit 1 \
)
endif


all:
$(RUSTC) $(COMPILE_FLAGS) test.rs
RUST_BACKTRACE=1 $(call RUN,test) 2> $(TMPDIR)/panic.stderr.actual && exit 1 || exit 0
$(COMPARE_SNAPSHOTS)
15 changes: 15 additions & 0 deletions src/test/run-make-fulldeps/issue-72550/apple.stderr
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
thread 'main' panicked at 'explicit panic', test.rs:2:5
stack backtrace:
0: <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt
1: core::fmt::write
2: std::io::Write::write_fmt
3: std::panicking::default_hook::{{closure}}
4: std::panicking::default_hook
5: std::panicking::rust_panic_with_hook
6: std::panicking::begin_panic
7: test::main
8: std::rt::lang_start::{{closure}}
9: std::rt::lang_start_internal
10: std::rt::lang_start
11: main
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
17 changes: 17 additions & 0 deletions src/test/run-make-fulldeps/issue-72550/linux.stderr
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
thread 'main' panicked at 'explicit panic', test.rs:2:5
stack backtrace:
0: <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt
1: core::fmt::write
2: std::io::Write::write_fmt
3: std::panicking::default_hook::{{closure}}
4: std::panicking::default_hook
5: std::panicking::rust_panic_with_hook
6: std::panicking::begin_panic
7: test::main
8: std::rt::lang_start::{{closure}}
9: std::rt::lang_start_internal
10: std::rt::lang_start
11: main

This comment was marked as outdated.

12: __libc_start_main
13: _start
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
3 changes: 3 additions & 0 deletions src/test/run-make-fulldeps/issue-72550/test.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
fn main() {
panic!();
}
15 changes: 15 additions & 0 deletions src/test/run-make-fulldeps/issue-72550/windows.stderr
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
thread 'main' panicked at 'explicit panic', test.rs:2:5
stack backtrace:
0: <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt
1: core::fmt::write
2: std::io::Write::write_fmt
3: std::panicking::default_hook::{{closure}}
4: std::panicking::default_hook
5: std::panicking::rust_panic_with_hook
6: std::panicking::begin_panic
7: test::main
8: std::rt::lang_start::{{closure}}
9: std::rt::lang_start_internal
10: std::rt::lang_start
11: main
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.