Home | History | Annotate | Line # | Download | only in unit-tests
cmd-interrupt.mk revision 1.1
      1  1.1  rillig # $NetBSD: cmd-interrupt.mk,v 1.1 2020/08/28 15:40:53 rillig Exp $
      2  1.1  rillig #
      3  1.1  rillig # Tests for interrupting a command.
      4  1.1  rillig #
      5  1.1  rillig # If a command is interrupted (usually by the user, here by itself), the
      6  1.1  rillig # target is removed.  This is to avoid having an unfinished target that
      7  1.1  rillig # would be newer than all of its sources and would therefore not be
      8  1.1  rillig # tried again in the next run.
      9  1.1  rillig #
     10  1.1  rillig # For .PHONY targets, there is usually no corresponding file and therefore
     11  1.1  rillig # nothing that could be removed.  These .PHONY targets need to ensure for
     12  1.1  rillig # themselves that interrupting them does not leave an inconsistent state
     13  1.1  rillig # behind.
     14  1.1  rillig 
     15  1.1  rillig SELF:=	${.PARSEDIR}/${.PARSEFILE}
     16  1.1  rillig 
     17  1.1  rillig _!=	rm -f cmd-interrupt-ordinary cmd-interrupt-phony
     18  1.1  rillig 
     19  1.1  rillig all: interrupt-ordinary interrupt-phony
     20  1.1  rillig 
     21  1.1  rillig interrupt-ordinary:
     22  1.1  rillig 	${.MAKE} ${MAKEFLAGS} -f ${SELF} cmd-interrupt-ordinary || true
     23  1.1  rillig 	@echo ${exists(cmd-interrupt-ordinary) :? error : ok }
     24  1.1  rillig 
     25  1.1  rillig interrupt-phony:
     26  1.1  rillig 	${.MAKE} ${MAKEFLAGS} -f ${SELF} cmd-interrupt-phony || true
     27  1.1  rillig 	@echo ${exists(cmd-interrupt-phony) :? ok : error }
     28  1.1  rillig 
     29  1.1  rillig cmd-interrupt-ordinary:
     30  1.1  rillig 	> ${.TARGET}
     31  1.1  rillig 	kill -INT $$$$
     32  1.1  rillig 
     33  1.1  rillig cmd-interrupt-phony: .PHONY
     34  1.1  rillig 	> ${.TARGET}
     35  1.1  rillig 	kill -INT $$$$
     36