jdk

Форк
0
/
test.m4 
105 строк · 3.5 Кб
1
#
2
# Copyright (c) 2020, Oracle and/or its affiliates. All rights reserved.
3
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4
#
5
# This code is free software; you can redistribute it and/or modify it
6
# under the terms of the GNU General Public License version 2 only, as
7
# published by the Free Software Foundation.
8
#
9
# This code is distributed in the hope that it will be useful, but WITHOUT
10
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11
# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
12
# version 2 for more details (a copy is included in the LICENSE file that
13
# accompanied this code).
14
#
15
# You should have received a copy of the GNU General Public License version
16
# 2 along with this work; if not, write to the Free Software Foundation,
17
# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18
#
19
# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20
# or visit www.oracle.com if you need additional information or have any
21
# questions.
22
#
23

24

25
###############################################################################
26
#
27
# Unit tests for the configure script
28
#
29
###############################################################################
30

31
AC_DEFUN([TEST_STRING_OPS],
32
[
33
  FEW="ninja banan pepparkaka"
34
  MANY="banan antarktis pepparkaka ninjamask bana"
35

36
  EXPECTED_NON_MATCHING="antarktis ninjamask bana"
37
  UTIL_GET_NON_MATCHING_VALUES(ACTUAL, $MANY, $FEW)
38
  UTIL_ASSERT_STRING_EQUALS($ACTUAL, $EXPECTED_NON_MATCHING, \
39
      [UTIL_GET_NON_MATCHING_VALUES failed])
40

41
  EXPECTED_MATCHING="banan pepparkaka"
42
  UTIL_GET_MATCHING_VALUES(ACTUAL, $FEW, $MANY)
43
  UTIL_ASSERT_STRING_EQUALS($ACTUAL, $EXPECTED_MATCHING, \
44
      [UTIL_GET_MATCHING_VALUES failed])
45
])
46

47
AC_DEFUN([TEST_ARG_ENABLE],
48
[
49
  # fake '--enable-default-false=yes' on the command line
50
  enable_default_false=yes
51
  UTIL_ARG_ENABLE(NAME: default-false, DEFAULT: false, RESULT: TEST_RESULT)
52
  UTIL_ASSERT_TRUE($TEST_RESULT)
53

54
  # assume '--enable-default-true-but-unavailable=yes' not set
55
  UTIL_ARG_ENABLE(NAME: default-true-but-unavailable, DEFAULT: auto, RESULT: TEST_RESULT, AVAILABLE: false)
56
  UTIL_ASSERT_NOT_TRUE($TEST_RESULT)
57

58
  enable_test_given_yes=yes
59
  given=false
60
  enabled=false
61
  disabled=false
62
  UTIL_ARG_ENABLE(NAME: test-given-yes, DEFAULT: false,
63
      IF_GIVEN: [ given=true ], IF_ENABLED: [ enabled=true ],
64
      IF_DISABLED: [ disabled=true ])
65
  UTIL_ASSERT_TRUE($given)
66
  UTIL_ASSERT_TRUE($enabled)
67
  UTIL_ASSERT_NOT_TRUE($disabled)
68

69
  enable_test_given_default=no
70
  given=false
71
  enabled=false
72
  disabled=false
73
  UTIL_ARG_ENABLE(NAME: test-given-default, DEFAULT: true,
74
      IF_GIVEN: [ given=true ], IF_ENABLED: [ enabled=true ],
75
      IF_DISABLED: [ disabled=true ])
76
  UTIL_ASSERT_TRUE($given)
77
  UTIL_ASSERT_NOT_TRUE($enabled)
78
  UTIL_ASSERT_TRUE($disabled)
79

80
  # assume '--enable-test-given-no' not set
81
  given=false
82
  enabled=false
83
  disabled=false
84
  UTIL_ARG_ENABLE(NAME: test-given-no, DEFAULT: true,
85
      IF_GIVEN: [ given=true ], IF_ENABLED: [ enabled=true ],
86
      IF_DISABLED: [ disabled=true ])
87
  UTIL_ASSERT_NOT_TRUE($given)
88
  UTIL_ASSERT_TRUE($enabled)
89
  UTIL_ASSERT_NOT_TRUE($disabled)
90
])
91

92
# Use the CUSTOM_EARLY_HOOK to inject our test after basic init is done.
93
AC_DEFUN_ONCE([CUSTOM_EARLY_HOOK],
94
[
95
  $PRINTF "\nStarting configure tests\n"
96
  $PRINTF "==============================\n"
97

98
  TEST_STRING_OPS
99
  TEST_ARG_ENABLE
100

101
  # If no assertions failed, report success
102
  $PRINTF "==============================\n"
103
  $PRINTF "Configure tests finished successfully\n\n"
104
  exit 0
105
])
106

Использование cookies

Мы используем файлы cookie в соответствии с Политикой конфиденциальности и Политикой использования cookies.

Нажимая кнопку «Принимаю», Вы даете АО «СберТех» согласие на обработку Ваших персональных данных в целях совершенствования нашего веб-сайта и Сервиса GitVerse, а также повышения удобства их использования.

Запретить использование cookies Вы можете самостоятельно в настройках Вашего браузера.