verifier.parts 5.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120
  1. ############################################################################
  2. # Copyright 2016-2017 Intel Corporation
  3. #
  4. # Licensed under the Apache License, Version 2.0 (the "License");
  5. # you may not use this file except in compliance with the License.
  6. # You may obtain a copy of the License at
  7. #
  8. # http://www.apache.org/licenses/LICENSE-2.0
  9. #
  10. # Unless required by applicable law or agreed to in writing, software
  11. # distributed under the License is distributed on an "AS IS" BASIS,
  12. # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  13. # See the License for the specific language governing permissions and
  14. # limitations under the License.
  15. ############################################################################
  16. Import('*')
  17. env.PartName('verifier')
  18. api_headers = Pattern(src_dir='.',
  19. includes=['*.h'],
  20. recursive=False).files()
  21. src_files = Pattern(src_dir='src',
  22. includes=['*.c'],
  23. recursive=False).files()
  24. internal_headers = Pattern(src_dir='src',
  25. includes=['*.h', '*.inc'],
  26. recursive=False).files()
  27. utest_files = Pattern(src_dir='unittests',
  28. includes=['*-test.cc', '*-testhelper.cc'],
  29. recursive=False).files()
  30. utest_headers = Pattern(src_dir='unittests',
  31. includes=['*-testhelper.h',],
  32. recursive=False).files()
  33. utest_data_files = Pattern(src_dir='unittests/testdata/sigrl',
  34. includes=['*.inc'],
  35. excludes=[],
  36. recursive=False).files()
  37. epid11_headers = Pattern(src_dir='1.1',
  38. includes=['*.h'],
  39. recursive=False).files()
  40. epid11_src_files = Pattern(src_dir='1.1/src',
  41. includes=['*.c'],
  42. recursive=False).files()
  43. epid11_internal_headers = Pattern(src_dir='1.1/src',
  44. includes=['*.h', '*.inc'],
  45. recursive=False).files()
  46. epid11_utest_files = Pattern(src_dir='1.1/unittests',
  47. includes=['*-test.cc', '*-testhelper.cc'],
  48. recursive=False).files()
  49. epid11_utest_headers = Pattern(src_dir='1.1/unittests',
  50. includes=['*-testhelper.h',],
  51. recursive=False).files()
  52. epid11_utest_data_files = Pattern(src_dir='1.1/unittests/testdata',
  53. includes=['*.inc'],
  54. recursive=False).files()
  55. build_files = Pattern(src_dir='.',
  56. includes=['*.parts', 'Makefile'],
  57. recursive=False).files()
  58. if 'install_package' in env['MODE']:
  59. env.InstallTopLevel(api_headers,
  60. sub_dir='epid/${PART_SHORT_NAME}')
  61. env.InstallTopLevel(src_files + internal_headers,
  62. sub_dir='epid/${PART_SHORT_NAME}/src')
  63. env.InstallTopLevel(utest_files + utest_headers,
  64. sub_dir='epid/${PART_SHORT_NAME}/unittests')
  65. env.InstallTopLevel(
  66. utest_data_files,
  67. sub_dir='epid/${PART_SHORT_NAME}/unittests/testdata/sigrl')
  68. env.InstallTopLevel(epid11_headers,
  69. sub_dir='epid/${PART_SHORT_NAME}/1.1')
  70. env.InstallTopLevel(epid11_src_files + epid11_internal_headers,
  71. sub_dir='epid/${PART_SHORT_NAME}/1.1/src')
  72. env.InstallTopLevel(epid11_utest_files + epid11_utest_headers,
  73. sub_dir='epid/${PART_SHORT_NAME}/1.1/unittests')
  74. env.InstallTopLevel(
  75. epid11_utest_data_files,
  76. sub_dir='epid/${PART_SHORT_NAME}/1.1/unittests/testdata')
  77. env.InstallTopLevel(build_files, sub_dir='epid/${PART_SHORT_NAME}')
  78. else:
  79. env.DependsOn([
  80. Component('common'),
  81. ])
  82. env.Append(CPPPATH='#')
  83. if 'use_tss' in env['MODE']:
  84. env.Append(CPPDEFINES=['TPM_TSS'])
  85. testenv = env.Clone()
  86. outputs = env.Library('${PART_NAME}', src_files + epid11_src_files)
  87. env.Sdk(outputs)
  88. env.SdkInclude(api_headers, sub_dir='epid/${PART_SHORT_NAME}')
  89. env.SdkInclude(epid11_headers, sub_dir='epid/${PART_SHORT_NAME}/1.1')
  90. if 'install_lib' in env['MODE']:
  91. env.InstallLib(outputs)
  92. env.InstallInclude(api_headers, sub_dir='${PART_SHORT_NAME}')
  93. env.InstallInclude(epid11_headers, sub_dir='${PART_SHORT_NAME}/1.1')
  94. testenv['UNIT_TEST_TARGET_NAME'] = "${PART_NAME}-${UNIT_TEST_TARGET}"
  95. testenv.UnitTest("utest",
  96. utest_files + epid11_utest_files,
  97. command_args=[
  98. '--gtest_color=yes',
  99. '--gtest_print_time=1',
  100. '--gtest_output=xml',
  101. '--gtest_filter=**',
  102. ],
  103. make_pdb=(env.isConfigBasedOn('debug') or
  104. env.isConfigBasedOn('static_crt_debug')),
  105. depends=[Component('gtest'),
  106. Component('common-testhelper'),
  107. Component('verifier')],
  108. INSTALL_BIN='${INSTALL_TEST_BIN}')