Skip to content
Merged
Show file tree
Hide file tree
Changes from all 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
2 changes: 2 additions & 0 deletions circleci.sh
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,8 @@ coverage()
make -j$N -C src -f posix.mak MODEL=$MODEL HOST_DMD=../_${build_path}/host_dmd clean
make -j$N -C src -f posix.mak MODEL=$MODEL HOST_DMD=../_${build_path}/host_dmd ENABLE_COVERAGE=1

cp $build_path/dmd _${build_path}/host_dmd_cov
Copy link
Member

Choose a reason for hiding this comment

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

Would a ln suffice here?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Well, the idea was too avoid any issues with rebuilding DMD with other configs. At the moment there aren't any anymore for this setup, but explicitly really helped a lot during debugging here.

make -j1 -C src -f posix.mak MODEL=$MODEL HOST_DMD=../_${build_path}/host_dmd_cov ENABLE_COVERAGE=1 unittest
make -j1 -C test MODEL=$MODEL ARGS="-O -inline -release" DMD_TEST_COVERAGE=1
}

Expand Down
3 changes: 2 additions & 1 deletion posix.mak
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ ECTAGS_FILES = src/*.[chd] src/backend/*.[chd] src/root/*.[chd] src/tk/*.[chd]
.PHONY: all clean test install auto-tester-build auto-tester-test toolchain-info

all:
$(QUIET)$(MAKE) -C src -f posix.mak
$(QUIET)$(MAKE) -C src -f posix.mak all
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This makes the default Makefile target explicit (all is the default target of src/posix.mak).

Copy link
Member

Choose a reason for hiding this comment

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

Is there a disadvantage to assume the default target builds all? After all, if it's not it means we wrote that makefile poorly.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Explicitly for the win - it was helpful during debugging this.


auto-tester-build: toolchain-info
$(QUIET)$(MAKE) -C src -f posix.mak auto-tester-build ENABLE_RELEASE=1
Expand All @@ -21,6 +21,7 @@ clean:
$(RM) tags

test:
$(QUIET)$(MAKE) -C src -f posix.mak unittest
Copy link
Member

@PetarKirov PetarKirov Dec 7, 2017

Choose a reason for hiding this comment

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

It looks like you don't have to modify src/posix.mak, if you simply replace here unittest with ENABLE_DEBUG=1. For reference, ENABLE_DEBUG does the following:

ifdef ENABLE_DEBUG
 CXXFLAGS += -g -g3 -DDEBUG=1 -DUNITTEST
 DFLAGS += -g -debug -unittest

I think going with this option, instead of introducing a new target there would be simpler/better. What do you think?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I prefer a separate target because then it's a lot easier to run the unittest target with the currently compiled dmd binary. Imho it's a common concept to use a different binary for the unittest executable and deviating from this might lead to confusion or annoyance down the road.

Copy link
Member

Choose a reason for hiding this comment

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

Alright, you make a good point.

$(QUIET)$(MAKE) -C test -f Makefile

html:
Expand Down
1 change: 1 addition & 0 deletions src/ddmd/mars.d
Original file line number Diff line number Diff line change
Expand Up @@ -1077,6 +1077,7 @@ Language changes listed by -transition=id:
* Returns:
* Return code of the application
*/
version(unittest) {} else
int main()
{
import core.memory;
Expand Down
5 changes: 5 additions & 0 deletions src/posix.mak
Original file line number Diff line number Diff line change
Expand Up @@ -459,6 +459,11 @@ $G/dmd: $(DMD_SRCS) $(ROOT_SRCS) $G/newdelete.o $G/backend.a $G/lexer.a $(STRING
CC="$(HOST_CXX)" $(HOST_DMD_RUN) -of$@ $(MODEL_FLAG) -vtls -J$G -J../res -L-lstdc++ $(DFLAGS) $(filter-out $(STRING_IMPORT_FILES) $(HOST_DMD_PATH) $(LEXER_ROOT),$^)
endif

$G/dmd-unittest: $(DMD_SRCS) $(ROOT_SRCS) $G/newdelete.o $G/lexer.a $(G_GLUE_OBJS) $(G_OBJS) $(STRING_IMPORT_FILES) $(HOST_DMD_PATH)
CC=$(HOST_CXX) $(HOST_DMD_RUN) -of$@ $(MODEL_FLAG) -vtls -J$G -J../res -L-lstdc++ $(DFLAGS) -g -unittest -main $(filter-out $(STRING_IMPORT_FILES) $(HOST_DMD_PATH),$^)

unittest: $G/dmd-unittest
$<

clean:
rm -R $(GENERATED)
Expand Down