Skip to content

Commit

Permalink
Add test-revise-* Makefile targets (#33682)
Browse files Browse the repository at this point in the history
These targets use Revise to load any modifications to base into the
process before running tests. This is very handy when editing Base
and wanting to run the appropriate tests as a sanity check but
without waiting 3 minutes for a whole system image rebuild. Of course
it was previously possible to do this through the REPL by doing the
3-4 steps manually, but I was generally too lazy too do that, so
here's the automatic option.
  • Loading branch information
Keno authored Oct 29, 2019
1 parent 592748a commit ffdee15
Show file tree
Hide file tree
Showing 5 changed files with 32 additions and 2 deletions.
6 changes: 6 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -264,6 +264,12 @@ If you need to restart your Julia session, just start at step 2 above.
built and incorporate them automatically. You only need to rebuild
Julia if you made code-changes that Revise cannot handle.

For convenience, there are also `test-revise-*` targets for every `test-*`
target that use Revise to load any modifications to Base into the current
process before running the corresponding test. This can be useful as a shortcut
on the command line (since tests aren't always designed to be run outside the
runtest harness).

### Code Formatting Guidelines

#### General Formatting Guidelines for Julia code contributions
Expand Down
5 changes: 5 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -580,8 +580,13 @@ testall1: check-whitespace $(JULIA_BUILD_MODE)
@env JULIA_CPU_THREADS=1 $(MAKE) $(QUIET_MAKE) -C $(BUILDROOT)/test all JULIA_BUILD_MODE=$(JULIA_BUILD_MODE)

test-%: check-whitespace $(JULIA_BUILD_MODE)
@([ $$(( $$(date +%s) - $$(date +%s -r $(build_private_libdir)/sys.$(SHLIB_EXT)) )) -le 100 ] && \
printf '\033[93m HINT The system image was recently rebuilt. Are you aware of the test-revise-* targets? See CONTRIBUTING.md. \033[0m\n') || true
@$(MAKE) $(QUIET_MAKE) -C $(BUILDROOT)/test $* JULIA_BUILD_MODE=$(JULIA_BUILD_MODE)

test-revise-%:
@$(MAKE) $(QUIET_MAKE) -C $(BUILDROOT)/test revise-$* JULIA_BUILD_MODE=$(JULIA_BUILD_MODE)

# download target for some hardcoded windows dependencies
.PHONY: win-extras wine_path
win-extras:
Expand Down
4 changes: 4 additions & 0 deletions test/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,10 @@ $(TESTS):
@cd $(SRCDIR) && \
$(call PRINT_JULIA, $(call spawn,$(JULIA_EXECUTABLE)) --check-bounds=yes --startup-file=no ./runtests.jl $@)

$(addprefix revise-, $(TESTS)):
@cd $(SRCDIR) && \
$(call PRINT_JULIA, $(call spawn,$(JULIA_EXECUTABLE)) --check-bounds=yes --startup-file=no ./runtests.jl --revise $(subst revise-,,$@))

embedding:
@$(MAKE) -C $(SRCDIR)/$@ check $(EMBEDDING_ARGS)

Expand Down
5 changes: 4 additions & 1 deletion test/choosetests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ function choosetests(choices = [])
tests = []
skip_tests = []
exit_on_error = false
use_revise = false
seed = rand(RandomDevice(), UInt128)

for (i, t) in enumerate(choices)
Expand All @@ -68,6 +69,8 @@ function choosetests(choices = [])
break
elseif t == "--exit-on-error"
exit_on_error = true
elseif t == "--revise"
use_revise = true
elseif startswith(t, "--seed=")
seed = parse(UInt128, t[8:end])
else
Expand Down Expand Up @@ -183,5 +186,5 @@ function choosetests(choices = [])
# Filter out tests from the test groups in the stdlibs
filter!(!in(skip_tests), tests)

tests, net_on, exit_on_error, seed
tests, net_on, exit_on_error, use_revise, seed
end
14 changes: 13 additions & 1 deletion test/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,13 @@ using Printf: @sprintf
include("choosetests.jl")
include("testenv.jl")

tests, net_on, exit_on_error, seed = choosetests(ARGS)
tests, net_on, exit_on_error, use_revise, seed = choosetests(ARGS)
tests = unique(tests)

if use_revise
using Revise
end

const max_worker_rss = if haskey(ENV, "JULIA_TEST_MAXRSS_MB")
parse(Int, ENV["JULIA_TEST_MAXRSS_MB"]) * 2^20
else
Expand Down Expand Up @@ -71,6 +75,14 @@ cd(@__DIR__) do

@everywhere include("testdefs.jl")

if use_revise
@everywhere begin
Revise.track(Core.Compiler)
Revise.track(Base)
Revise.revise()
end
end

#pretty print the information about gc and mem usage
testgroupheader = "Test"
workerheader = "(Worker)"
Expand Down

2 comments on commit ffdee15

@nanosoldier
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Executing the daily benchmark build, I will reply here when finished:

@nanosoldier runbenchmarks(ALL, isdaily = true)

@nanosoldier
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Your benchmark job has completed - possible performance regressions were detected. A full report can be found here. cc @ararslan

Please sign in to comment.