1#----------------------------------------------------------------------------
2# Project:  Horizon
3# File:     CTR.build.tests.om
4#
5# Copyright (C)2009-2011 Nintendo Co., Ltd.  All rights reserved.
6#
7# These coded instructions, statements, and computer programs contain
8# proprietary information of Nintendo of America Inc. and/or Nintendo
9# Company Ltd., and are protected by Federal copyright law. They may
10# not be disclosed to third parties or copied or duplicated in any form,
11# in whole or in part, without the prior written consent of Nintendo.
12#
13# $Rev:$
14#----------------------------------------------------------------------------
15
16TEST_TARGETS =
17
18CCFLAGS += --diag-suppress=2817
19
20CTR_NO_BANNER_ICON = true
21
22public.FilterTestAttributes(process) =
23
24    if $(not $(defined TEST_ATTRIBUTES))
25        TEST_ATTRIBUTES =
26        export
27
28    if $(not $(defined TEST_INCLUDE))
29        TEST_INCLUDE = BASIC
30        export
31    else
32        TEST_INCLUDE = $(split  $",",$(TEST_INCLUDE))
33        export
34
35    if $(not $(defined TEST_EXCLUDE))
36        TEST_EXCLUDE =
37        export
38    else
39        TEST_EXCLUDE = $(split  $",",$(TEST_EXCLUDE))
40        export
41
42    attributes = $(ParseProcessAttribute null, $(rootname $(process)), $(TEST_ATTRIBUTES))
43
44    if $(isEmpty $(attributes))
45        attributes = BASIC
46        export
47
48    has_includes = $(filter $(TEST_INCLUDE), $(attributes))
49    has_excludes = $(filter $(TEST_EXCLUDE), $(attributes))
50
51    if $(and $(isEmpty $(has_excludes)), $(not $(isEmpty $(has_includes))))
52        return $(process)
53
54    return $(EMPTY)
55
56public.FilterTest(sources) =
57
58    filtered_sources = $(sources)
59
60    if $(defined TEST_FILTER)
61        regex = $"^\("$(compileToRegex $(TEST_FILTER))$"\)"\$
62        filtered_sources =
63
64        foreach( source, $(sources) )
65            if $(isFilterMatch $(regex), $(rootname $(basename $(source))))
66                filtered_sources += $(source)
67                export filtered_sources
68            export filtered_sources
69        export filtered_sources
70
71    return $(filtered_sources)
72
73if $(not $(defined OBJECTS))
74    OBJECTS =
75    export
76
77if $(and $(defined DESCRIPTOR), $(defined DESC_PARAM))
78    if $(not $(defined DESC_BASE))
79        foreach(TARGET, $(BUILDER.getTargets $(SUPPORTED_TARGETS)))
80            DESC_BASE = $(TARGET.getDefaultDescriptorPath)
81            export
82        export
83    if $(defined DESC_BASE)
84        DESC($(DESCRIPTOR), $(DESC_PARAM), $(DESC_BASE))
85
86if $(defined SOURCES_TEST)
87    if $(filter test tests dotest dotests dotests-%, $(TARGETS))
88        LIBS += libnn_test librtport
89        BUILD_TESTS = true
90        if $(not $(defined TEST_ENVIRONMENT_PROCESSLIST))
91            TEST_ENVIRONMENT_PROCESSLIST = true
92            export TEST_ENVIRONMENT_PROCESSLIST
93        if $(not $(defined TEST_ENVIRONMENT_EMUMEM))
94            TEST_ENVIRONMENT_EMUMEM = true
95            export TEST_ENVIRONMENT_EMUMEM
96        if $(not $(defined TEST_ENVIRONMENT_IMPORT))
97            TEST_ENVIRONMENT_IMPORT = false
98        if $(not $(defined TEST_ENVIRONMENT_ARM9))
99            TEST_ENVIRONMENT_ARM9 = false
100            export TEST_ENVIRONMENT_ARM9
101        if $(not $(defined TEST_ENVIRONMENT_SPI))
102            TEST_ENVIRONMENT_SPI = true
103            export TEST_ENVIRONMENT_SPI
104        if $(not $(defined TEST_COMMON_SOURCES))
105            TEST_COMMON_SOURCES =
106            export TEST_COMMON_SOURCES
107
108        # cdi is not created for tests that are not executed with the process list
109        CTR_MAKE_DEVELOPMENT_IMAGE = $(TEST_ENVIRONMENT_PROCESSLIST)
110
111        foreach(SOURCE_TEST, $(FilterTest $(SOURCES_TEST)))
112            foreach(TARGET, $(BUILDER.getTargets $(SUPPORTED_TARGETS)))
113                EXEFILE = $(TestProgram $(TARGET), $(SOURCE_TEST) $(TEST_COMMON_SOURCES) $(OBJECTS))
114                TEST_TARGETS += $(EXEFILE)
115                export
116            export
117        export
118    export
119
120DefineDefaultRules()
121