Skip to content
This repository has been archived by the owner on Oct 12, 2022. It is now read-only.

Commit

Permalink
Add shared library exception line_trace test
Browse files Browse the repository at this point in the history
  • Loading branch information
wilzbach committed May 7, 2018
1 parent 7ccfb95 commit 5142b4d
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 0 deletions.
18 changes: 18 additions & 0 deletions test/exceptions/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@ TESTS:=stderr_msg unittest_assert invalid_memory_operation unknown_gc static_dto

ifeq ($(OS)-$(BUILD),linux-debug)
TESTS:=$(TESTS) line_trace rt_trap_exceptions
ifeq ($(MODEL), 64)
TESTS+=line_trace_shared
endif
LINE_TRACE_DFLAGS:=-L--export-dynamic
endif
ifeq ($(OS)-$(BUILD),freebsd-debug)
Expand Down Expand Up @@ -33,6 +36,14 @@ $(ROOT)/line_trace.done: $(ROOT)/line_trace
@rm -f $(ROOT)/line_trace.output
@touch $@

$(ROOT)/line_trace_shared.done: $(ROOT)/line_trace_shared
@echo Testing line_trace
! LD_LIBRARY_PATH="$(ROOT)" $(QUIET)$(TIMELIMIT)$(ROOT)/line_trace_shared $(RUN_ARGS) 2> $(ROOT)/line_trace_shared.output
# Use sed to canonicalize line_trace_shared.output and compare against expected output in line_trace_shared.exp
$(QUIET)$(SED) "s/\[0x[0-9a-f]*\]/\[ADDR\]/g; s/scope //g; s/Nl//g" $(ROOT)/line_trace_shared.output | $(DIFF) -p line_trace_shared.exp -
@rm -f $(ROOT)/line_trace_shared.output
@touch $@

$(ROOT)/chain.done: $(ROOT)/chain
@echo Testing chain
$(QUIET)$(TIMELIMIT)$(ROOT)/chain $(RUN_ARGS) > $(ROOT)/chain.output
Expand All @@ -55,6 +66,13 @@ $(ROOT)/%.done: $(ROOT)/%

$(ROOT)/unittest_assert: DFLAGS+=-unittest
$(ROOT)/line_trace: DFLAGS+=$(LINE_TRACE_DFLAGS)

$(ROOT)/line_trace_shared_lib.so: $(SRC)/line_trace_shared_lib.d
$(QUIET)$(DMD) $(DFLAGS) $(LINE_TRACE_DFLAGS) -shared -of$@ $<

$(ROOT)/line_trace_shared: $(SRC)/line_trace_shared.d $(ROOT)/line_trace_shared_lib.so
$(QUIET)$(DMD) $(LINE_TRACE_DFLAGS) -Isrc -L-L$(ROOT) -L-l:line_trace_shared_lib.so -of$@ $<

$(ROOT)/%: $(SRC)/%.d
$(QUIET)$(DMD) $(DFLAGS) -of$@ $<

Expand Down
2 changes: 2 additions & 0 deletions test/exceptions/line_trace_shared.exp
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
object.Exception@src/line_trace_shared_lib.d(3): exception
----------------
5 changes: 5 additions & 0 deletions test/exceptions/src/line_trace_shared.d
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
void main()
{
import line_trace_shared_lib;
exception();
}
4 changes: 4 additions & 0 deletions test/exceptions/src/line_trace_shared_lib.d
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
void exception()
{
throw new Exception("exception");
}

0 comments on commit 5142b4d

Please sign in to comment.