CMakeLists.txt 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. # Copyright (C) 2019 Intel Corporation. All rights reserved.
  2. # SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
  3. cmake_minimum_required(VERSION 3.14)
  4. project(unsupported_features_tests)
  5. include(CMakePrintHelpers)
  6. # fake target
  7. if(NOT DEFINED WAMR_BUILD_AOT)
  8. set(WAMR_BUILD_AOT 0)
  9. endif()
  10. set(WAMR_BUILD_INTERP 1)
  11. if(NOT DEFINED WAMR_BUILD_JIT)
  12. set(WAMR_BUILD_JIT 0)
  13. endif()
  14. if(NOT DEFINED WAMR_BUILD_FAST_JIT)
  15. set(WAMR_BUILD_FAST_JIT 0)
  16. endif()
  17. include(../unit_common.cmake)
  18. add_library(unsupported_features_tests ${WAMR_RUNTIME_LIB_SOURCE})
  19. enable_testing()
  20. # Define a function to add tests with unsupported features
  21. function(add_unsupported_feature_test test_name flags)
  22. add_test(
  23. NAME ${PROJECT_NAME}.verify_${test_name}
  24. COMMAND ${CMAKE_COMMAND} -S ${CMAKE_CURRENT_LIST_DIR} -B build_${test_name} ${flags} --fresh
  25. WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
  26. )
  27. set_tests_properties(${PROJECT_NAME}.verify_${test_name} PROPERTIES WILL_FAIL TRUE)
  28. endfunction()
  29. # List of unsupported feature tests
  30. set(UNSUPPORTED_FEATURE_TESTS
  31. "exce_handling_aot -DWAMR_BUILD_EXCE_HANDLING=1 -DWAMR_BUILD_AOT=1"
  32. "exce_handling_fast_interp -DWAMR_BUILD_EXCE_HANDLING=1 -DWAMR_BUILD_INTERP=1 -DWAMR_BUILD_FAST_INTERP=1"
  33. "exce_handling_fast_jit -DWAMR_BUILD_EXCE_HANDLING=1 -DWAMR_BUILD_FAST_JIT=1"
  34. "exce_handling_llvm_jit -DWAMR_BUILD_EXCE_HANDLING=1 -DWAMR_BUILD_JIT=1"
  35. "gc_fast_jit -DWAMR_BUILD_GC=1 -DWAMR_BUILD_FAST_JIT=1"
  36. "memory64_fast_interp -DWAMR_BUILD_MEMORY64=1 -DWAMR_BUILD_INTERP=1 -DWAMR_BUILD_FAST_INTERP=1"
  37. "memory64_fast_jit -DWAMR_BUILD_MEMORY64=1 -DWAMR_BUILD_FAST_JIT=1"
  38. "memory64_llvm_jit -DWAMR_BUILD_MEMORY64=1 -DWAMR_BUILD_JIT=1"
  39. "multi_memory_aot -DWAMR_BUILD_MULTI_MEMORY=1 -DWAMR_BUILD_AOT=1"
  40. "multi_memory_fast_interp -DWAMR_BUILD_MULTI_MEMORY=1 -DWAMR_BUILD_INTERP=1 -DWAMR_BUILD_FAST_INTERP=1"
  41. "multi_memory_fast_jit -DWAMR_BUILD_MULTI_MEMORY=1 -DWAMR_BUILD_FAST_JIT=1"
  42. "multi_memory_llvm_jit -DWAMR_BUILD_MULTI_MEMORY=1 -DWAMR_BUILD_JIT=1"
  43. "multi_module_fast_jit -DWAMR_BUILD_MULTI_MODULE=1 -DWAMR_BUILD_FAST_JIT=1"
  44. "multi_module_llvm_jit -DWAMR_BUILD_MULTI_MODULE=1 -DWAMR_BUILD_JIT=1"
  45. "simd_classic_interp -DWAMR_BUILD_SIMD=1 -DWAMR_BUILD_INTERP=1 -DWAMR_BUILD_FAST_INTERP=0"
  46. "simd_fast_jit -DWAMR_BUILD_SIMD=1 -DWAMR_BUILD_FAST_JIT=1"
  47. )
  48. # Add each test using the function
  49. foreach(test ${UNSUPPORTED_FEATURE_TESTS})
  50. # string -> list by replacing space with ;
  51. string(REPLACE " " ";" test_parts "${test}")
  52. # list[0]
  53. list(GET test_parts 0 test_name)
  54. # list[1:]
  55. list(REMOVE_AT test_parts 0)
  56. # pass list to cmake and let cmake split it
  57. set(flags ${test_parts})
  58. add_unsupported_feature_test(${test_name} "${flags}")
  59. endforeach()