# # Copyright (c) 2014, 2019, Oracle and/or its affiliates. All rights reserved. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # # This code is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License version 2 only, as # published by the Free Software Foundation. Oracle designates this # particular file as subject to the "Classpath" exception as provided # by Oracle in the LICENSE file that accompanied this code. # # This code is distributed in the hope that it will be useful, but WITHOUT # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or # FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License # version 2 for more details (a copy is included in the LICENSE file that # accompanied this code). # # You should have received a copy of the GNU General Public License version # 2 along with this work; if not, write to the Free Software Foundation, # Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. # # Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA # or visit www.oracle.com if you need additional information or have any # questions. #
default: all
include $(SPEC) include MakeBase.gmk include UtilsForTests.gmk
# We cannot catch $(error) while testing, but you can enable this manually # by uncommenting and watch make fails. #$(eval $(call assert-equals, $(call And, non-boolean ), $(error ...))) #$(eval $(call assert-equals, $(call Or, non-boolean ), $(error ...)))
################################################################################ # Test remove-prefixes
test-vardep:
$(RM) $(VARDEP_SRC_FILE) $(VARDEP_TARGET_FILE) $(VARDEP_FLAG_FILE) # # Simply create the target file and verify that it has the correct value #
$(MAKE) -f $(THIS_FILE) VARDEP_TEST_VAR=value1 $(VARDEP_TARGET_FILE)
$(PRINTF) "Expecting value1: %s\n""`$(CAT) $(VARDEP_DIR)/target-file`"
test "some string value1" = "`$(CAT) $(VARDEP_DIR)/target-file`"
test -e $(VARDEP_FLAG_FILE) # # Make the target file again and verify that the value is updated with # the new value #
$(SLEEP_ON_MAC)
$(MAKE) -f $(THIS_FILE) VARDEP_TEST_VAR=value2 $(VARDEP_TARGET_FILE)
$(PRINTF) "Expecting value2: %s\n""`$(CAT) $(VARDEP_DIR)/target-file`"
test "some string value2" = "`$(CAT) $(VARDEP_DIR)/target-file`"
test -e $(VARDEP_FLAG_FILE) # # Make the target again with the same value and verify that the recipe # was never run by checking that the flag file was not recreated #
$(SLEEP_ON_MAC)
$(RM) $(VARDEP_FLAG_FILE)
$(MAKE) -f $(THIS_FILE) VARDEP_TEST_VAR=value2 $(VARDEP_TARGET_FILE)
$(PRINTF) "Expecting value2: %s\n""`$(CAT) $(VARDEP_DIR)/target-file`"
test "some string value2" = "`$(CAT) $(VARDEP_DIR)/target-file`"
test ! -e $(VARDEP_FLAG_FILE) # # Test running with spaces at the end and the middle of the value # and verify that the file isn't rewritten the second time #
$(MAKE) -f $(THIS_FILE) VARDEP_TEST_VAR="value3 foo " $(VARDEP_TARGET_FILE)
$(RM) $(VARDEP_FLAG_FILE)
$(MAKE) -f $(THIS_FILE) VARDEP_TEST_VAR="value3 foo" $(VARDEP_TARGET_FILE)
test ! -e $(VARDEP_FLAG_FILE)
$(MAKE) -f $(THIS_FILE) VARDEP_TEST_VAR=" value3 foo" $(VARDEP_TARGET_FILE)
test ! -e $(VARDEP_FLAG_FILE) # # Test including some problematic characters
$(MAKE) -f $(THIS_FILE) VARDEP_TEST_VAR='value4 \$$ORIGIN' $(VARDEP_TARGET_FILE)
$(RM) $(VARDEP_FLAG_FILE)
$(MAKE) -f $(THIS_FILE) VARDEP_TEST_VAR='value4 \$$ORIGIN' $(VARDEP_TARGET_FILE)
test ! -e $(VARDEP_FLAG_FILE) # # Test having the variable be empty, first from scratch, with even # the vardep file deleted.
$(SLEEP_ON_MAC)
$(RM) $(VARDEP_FLAG_FILE) $(VARDEP_TARGET_FILE) \
$(call DependOnVariableFileName,VARDEP_TEST_VAR)
$(MAKE) -f $(THIS_FILE) VARDEP_TEST_VAR="" $(VARDEP_TARGET_FILE)
$(PRINTF) "Expecting '': %s\n""`$(CAT) $(VARDEP_DIR)/target-file`"
test "some string " = "`$(CAT) $(VARDEP_DIR)/target-file`"
test -e $(VARDEP_FLAG_FILE) # # Then rebuild with same empty value, nothing should happen
$(SLEEP_ON_MAC)
$(RM) $(VARDEP_FLAG_FILE)
$(MAKE) -f $(THIS_FILE) VARDEP_TEST_VAR="" $(VARDEP_TARGET_FILE)
$(PRINTF) "Expecting '': %s\n""`$(CAT) $(VARDEP_DIR)/target-file`"
test "some string " = "`$(CAT) $(VARDEP_DIR)/target-file`"
test ! -e $(VARDEP_FLAG_FILE) # # Try setting a value again and verify that the target gets rebuilt
$(SLEEP_ON_MAC)
$(MAKE) -f $(THIS_FILE) VARDEP_TEST_VAR=value2 $(VARDEP_TARGET_FILE)
$(PRINTF) "Expecting value2: %s\n""`$(CAT) $(VARDEP_DIR)/target-file`"
test "some string value2" = "`$(CAT) $(VARDEP_DIR)/target-file`"
test -e $(VARDEP_FLAG_FILE)
# Test specifying a specific value file to store variable in
VARDEP_VALUE_FILE := $(VARDEP_DIR)/value-file
VARDEP_TEST_VAR2 := value3
$(call AssertEquals, \
$(KWBASE_MANY_WORDS), \
I have the best words., \
ParseKeywordVariable failed to parse MANY_WORDS, \
)
# Simulate variable set from command line by using "override"
override KWBASE_WEIRD_GURKA := paprika
KWBASE_WEIRD := ;;APA=banan;;;GURKA=apelsin;APA=skansen;;
¤ Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.0.18Bemerkung:
(vorverarbeitet)
¤
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.