1# @HEADER 2# ************************************************************************ 3# 4# TriBITS: Tribal Build, Integrate, and Test System 5# Copyright 2013 Sandia Corporation 6# 7# Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation, 8# the U.S. Government retains certain rights in this software. 9# 10# Redistribution and use in source and binary forms, with or without 11# modification, are permitted provided that the following conditions are 12# met: 13# 14# 1. Redistributions of source code must retain the above copyright 15# notice, this list of conditions and the following disclaimer. 16# 17# 2. Redistributions in binary form must reproduce the above copyright 18# notice, this list of conditions and the following disclaimer in the 19# documentation and/or other materials provided with the distribution. 20# 21# 3. Neither the name of the Corporation nor the names of the 22# contributors may be used to endorse or promote products derived from 23# this software without specific prior written permission. 24# 25# THIS SOFTWARE IS PROVIDED BY SANDIA CORPORATION "AS IS" AND ANY 26# EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 27# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 28# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL SANDIA CORPORATION OR THE 29# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 30# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 31# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 32# PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF 33# LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 34# NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 35# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 36# 37# ************************************************************************ 38# @HEADER 39 40INCLUDE(FindListElement) 41INCLUDE(MessageWrapper) 42INCLUDE(Join) 43 44 45# Define the valid categories that will be recognized in the CATEGORIES keyword 46SET(${PROJECT_NAME}_VALID_CATEGORIES BASIC CONTINUOUS NIGHTLY HEAVY WEEKLY PERFORMANCE) 47 48# TODO: ABove, We may want only the final project to define these categories 49# and not just be general categories for all projects based on ProjectArch. 50# Given the logic below, only the categories BASIC and NIGHTLY are specially 51# recognized. 52 53# This is a string used in help and error messages 54JOIN(${PROJECT_NAME}_VALID_CATEGORIES_STR ", " FALSE ${${PROJECT_NAME}_VALID_CATEGORIES}) 55 56# 57# Check for invalid categories called as: 58# 59# TRIBITS_GET_INVALID_CATEGORIES(INVLAID_CATEGORIES CATEGORIES_LIST) 60# 61# The list of categories to check comes in through the ARGN list. 62# 63FUNCTION(TRIBITS_GET_INVALID_CATEGORIES INVALID_CATEGORIES_OUT) 64 #MESSAGE("TRIBITS_GET_INVALID_CATEGORIES: ${INVALID_CATEGORIES_OUT} ${ARGN}") 65 SET(INVALID_CATEGORIES "") 66 FOREACH(CATEGORY_IN ${ARGN}) 67 #PRINT_VAR(CATEGORY_IN) 68 SET(FOUND_CATEGORY FALSE) 69 FIND_LIST_ELEMENT(${PROJECT_NAME}_VALID_CATEGORIES ${CATEGORY_IN} FOUND_CATEGORY) 70 IF (NOT FOUND_CATEGORY) 71 #MESSAGE(STATUS "Not found in list of valid categories!") 72 SET(INVALID_CATEGORIES ${INVALID_CATEGORIES} ${CATEGORY_IN}) 73 ENDIF() 74 #PRINT_VAR(INVALID_CATEGORIES) 75 ENDFOREACH() 76 SET(${INVALID_CATEGORIES_OUT} ${INVALID_CATEGORIES} PARENT_SCOPE) 77 #PRINT_VAR(${INVALID_CATEGORIES_OUT}) 78ENDFUNCTION() 79 80 81# 82# Assert there are no invalid categories called as: 83# 84# TRIBITS_ASSERT_VALID_CATEGORIES(CATEGORIES_LIST) 85# 86# The list of categories to check comes in through the ARGN list. 87# 88FUNCTION(TRIBITS_FILTER_AND_ASSERT_CATEGORIES CATEGORIES_VAR_INOUT) 89 #MESSAGE("TRIBITS_ASSERT_VALID_CATEGORIES: ${ARGN}") 90 SET(INVALID_CATEGORIES "DUMMYCAT") 91 TRIBITS_GET_INVALID_CATEGORIES(INVALID_CATEGORIES ${${CATEGORIES_VAR_INOUT}}) 92 #PRINT_VAR(INVALID_CATEGORIES) 93 IF (INVALID_CATEGORIES) 94 MESSAGE_WRAPPER(SEND_ERROR "Error: The categories '${INVALID_CATEGORIES}' are not" 95 " in the list of valid categories '${${PROJECT_NAME}_VALID_CATEGORIES_STR}'!") 96 ENDIF() 97 SET(CATEGORIES_OUT) 98 FOREACH(CATEGORY ${${CATEGORIES_VAR_INOUT}}) 99 IF (CATEGORY STREQUAL "WEEKLY") 100 MESSAGE_WRAPPER(WARNING "Warning: The test category 'WEEKLY' is deprecated" 101 " and is replaced with 'HEAVY'. Please change to use 'HEAVY' instead.") 102 LIST(APPEND CATEGORIES_OUT "HEAVY") 103 ELSE() 104 LIST(APPEND CATEGORIES_OUT ${CATEGORY}) 105 ENDIF() 106 ENDFOREACH() 107 SET(${CATEGORIES_VAR_INOUT} ${CATEGORIES_OUT} PARENT_SCOPE) 108ENDFUNCTION() 109