Skip to content

Commit

Permalink
Fix output-complete-obj for MSVC:
Browse files Browse the repository at this point in the history
- bug in ccomp.ml
- bug in test Makefile
- disable testing bytecode on MSVC: AFAICT this never worked.
  • Loading branch information
damiendoligez committed Sep 17, 2017
1 parent 712505d commit 535390f
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 12 deletions.
32 changes: 21 additions & 11 deletions testsuite/tests/output_obj/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -19,23 +19,33 @@ SHOULD_FAIL=
compile:
@for file in *.ml; do \
printf " ... testing native '$$file'"; \
if $(BYTECODE_ONLY); then \
echo " => skipped"; \
else \
if $(BYTECODE_ONLY); then \
echo " => skipped"; \
else \
rm -f log $${file}.exe.$(O) $${file}_stub$(EXE); \
( $(OCAMLOPT) -w a -output-complete-obj -o $${file}.exe.$(O) $${file} >> log 2>&1 && \
$(MKEXE) -I$(CTOPDIR)/byterun $(OUTPUTEXE)$${file}_stub$(EXE) $${file}.exe.$(O) $(NATIVECCLIBS) $${file}_stub.c >> log 2>&1 && \
( $(OCAMLOPT) -w a -output-complete-obj -o $${file}.exe.$(O) \
$${file} >> log 2>&1 && \
$(MKEXE) -I$(CTOPDIR)/byterun -o $${file}_stub$(EXE) \
$${file}.exe.$(O) $(NATIVECCLIBS) $${file}_stub.c \
>> log 2>&1 && \
./$${file}_stub$(EXE) >> log 2>&1 && \
echo " => passed") || (echo " => failed" && cat log) ; \
fi \
fi \
done
@for file in *.ml; do \
printf " ... testing byte '$$file'"; \
rm -f log $${file}.bc.$(O) $${file}_bc_stub$(EXE); \
( $(OCAMLC) -ccopt "-I$(CTOPDIR)/byterun" -w a -output-complete-obj -o $${file}.bc.$(O) $${file} >> log 2>&1 && \
$(MKEXE) -I$(CTOPDIR)/byterun $(OUTPUTEXE)$${file}_bc_stub$(EXE) $${file}.bc.$(O) $(BYTECCLIBS) $${file}_stub.c >> log 2>&1 && \
./$${file}_bc_stub$(EXE) >> log 2>&1 && \
echo " => passed") || (echo " => failed" && cat log); \
if [ $(TOOLCHAIN) = msvc ]; then \
echo " => skipped"; \
else \
rm -f log $${file}.bc.$(O) $${file}_bc_stub$(EXE); \
( $(OCAMLC) -ccopt "-I$(CTOPDIR)/byterun" -w a -output-complete-obj\
-o $${file}.bc.$(O) $${file} >> log 2>&1 && \
$(MKEXE) -I$(CTOPDIR)/byterun -o $${file}_bc_stub$(EXE) \
$${file}.bc.$(O) $(BYTECCLIBS) $${file}_stub.c \
>> log 2>&1 && \
./$${file}_bc_stub$(EXE) >> log 2>&1 && \
echo " => passed") || (echo " => failed" && cat log); \
fi; \
done
@rm -f log

Expand Down
4 changes: 3 additions & 1 deletion utils/ccomp.ml
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,9 @@ let compile_file ?output ?(opt="") name =
then (Config.ocamlopt_cflags, Config.ocamlopt_cppflags)
else (Config.ocamlc_cflags, Config.ocamlc_cppflags) in
(String.concat " " [Config.c_compiler; cflags; cppflags]))
(match output with | None -> "" | Some o -> Printf.sprintf "%s %s" Config.c_output_obj o)
(match output with
| None -> ""
| Some o -> Printf.sprintf "%s%s" Config.c_output_obj o)
opt
(if !Clflags.debug && Config.ccomp_type <> "msvc" then "-g" else "")
(String.concat " " (List.rev !Clflags.all_ccopts))
Expand Down

0 comments on commit 535390f

Please sign in to comment.