leave none of an output a failure stopped writing

A failed -C -o left the file truncated, which make would take for done.
This commit is contained in:
2026-10-19 10:23:59 +03:00
parent bfc4521b89
commit d75c3eb4a2
2 changed files with 14 additions and 3 deletions

View File

@@ -3,7 +3,8 @@
;;; Each needs a process to show itself, so none fits the unit suite:
;;; sexc has to fail when cc fails -- exiting 0 after a failed compile
;;; makes every driver, sextest included, read it as success -- it has to
;;; clean up its temporary .c when its own emission throws, and it has to
;;; clean up its temporary .c, and any output it began, when its own
;;; emission throws, and it has to
;;; refuse `-o -' for an executable, which cc would write to a file named
;;; `-'.
;;;
@@ -61,6 +62,12 @@
(sexc-succeeds? "nested-pointer.sex" "-o" out)
(glob (make-pathname scratch "*.c"))))
;; and none of a file it was writing out, which make would take for done
(test "a failed emission leaves no part of its output" #f
(begin
(sexc-succeeds? "nested-pointer.sex" "-C" "-o" (make-pathname scratch "out.c"))
(file-exists? (make-pathname scratch "out.c"))))
(test "a failed cc fails sexc" #f
(sexc-succeeds? "hello.sex" "-o" out "--" "-no-such-cc-flag"))