Parcourir la source

Single target testing (#6556)

Single target testing

Enable building and testing via a single target (check) - require chakracore
shared library to be built before the test run. Use that to run tests for debug
builds and only build in release mode.

Expand CI matrix to include OSX. Set timeout to 2 hours and make OSX debug
build static (to work around #5876).

For #6547
Petr Penzin il y a 5 ans
Parent
commit
dab7603414
3 fichiers modifiés avec 69 ajouts et 29 suppressions
  1. 20 19
      CMakeLists.txt
  2. 45 10
      azure-pipelines.yml
  3. 4 0
      test/CMakeLists.txt

+ 20 - 19
CMakeLists.txt

@@ -10,31 +10,32 @@ if(NOT CHAKRACORE_BUILD_SH)
     option(INTL_ICU "Enable Intl" ON)
     option(INTL_ICU "Enable Intl" ON)
     option(EMBED_ICU "Build ICU within ChakraCore build" OFF)
     option(EMBED_ICU "Build ICU within ChakraCore build" OFF)
     set(ICU_INCLUDE_PATH "" CACHE STRING "libicu iclude path")
     set(ICU_INCLUDE_PATH "" CACHE STRING "libicu iclude path")
-endif(NOT CHAKRACORE_BUILD_SH)
+else(NOT CHAKRACORE_BUILD_SH)
 
 
-# Keep CMake from caching static/shared library
-# option. Otherwise, CMake fails to update cached
-# references
+    # Keep CMake from caching static/shared library
+    # option. Otherwise, CMake fails to update cached
+    # references
 
 
-# todo: create a sub cmake file to take care of _SH uncaching...
-if(SHARED_LIBRARY_SH)
+    # todo: create a sub cmake file to take care of _SH uncaching...
+    if(SHARED_LIBRARY_SH)
     unset(SHARED_LIBRARY_SH CACHE)
     unset(SHARED_LIBRARY_SH CACHE)
     unset(STATIC_LIBRARY_SH CACHE)
     unset(STATIC_LIBRARY_SH CACHE)
-    unset(STATIC_LIBRARY CACHE)
-    set(SHARED_LIBRARY 1)
-endif()
+        unset(STATIC_LIBRARY CACHE)
+        set(SHARED_LIBRARY 1)
+    endif()
 
 
-if(STATIC_LIBRARY_SH)
-    unset(SHARED_LIBRARY_SH CACHE)
-    unset(STATIC_LIBRARY_SH CACHE)
-    unset(SHARED_LIBRARY CACHE)
-    set(STATIC_LIBRARY 1)
-endif()
+    if(STATIC_LIBRARY_SH)
+        unset(SHARED_LIBRARY_SH CACHE)
+        unset(STATIC_LIBRARY_SH CACHE)
+        unset(SHARED_LIBRARY CACHE)
+        set(STATIC_LIBRARY 1)
+    endif()
 
 
-if(LIBS_ONLY_BUILD_SH)
-    unset(LIBS_ONLY_BUILD_SH CACHE)
-    set(CC_LIBS_ONLY_BUILD 1)
-endif()
+    if(LIBS_ONLY_BUILD_SH)
+        unset(LIBS_ONLY_BUILD_SH CACHE)
+        set(CC_LIBS_ONLY_BUILD 1)
+    endif()
+endif(NOT CHAKRACORE_BUILD_SH)
 
 
 if(CC_USES_SYSTEM_ARCH_SH OR NOT CHAKRACORE_BUILD_SH)
 if(CC_USES_SYSTEM_ARCH_SH OR NOT CHAKRACORE_BUILD_SH)
     if(CMAKE_SYSTEM_PROCESSOR STREQUAL "x86_64")
     if(CMAKE_SYSTEM_PROCESSOR STREQUAL "x86_64")

+ 45 - 10
azure-pipelines.yml

@@ -3,19 +3,52 @@ trigger:
 - release/*
 - release/*
 
 
 jobs:
 jobs:
-  - job: Linux
-    timeoutInMinutes: 0
-    pool:
-      vmImage: 'ubuntu-latest'
+  - job: CMake
+    timeoutInMinutes: 120
     strategy:
     strategy:
       matrix:
       matrix:
-        debug:
+        Linux.Debug:
+          image_name: 'ubuntu-latest'
+          deps: 'sudo apt-get install -y ninja-build clang libicu-dev'
+          build_type: 'Debug'
+          test_target: 'check'
+          libtype_flag: ''
+        Linux.ReleaseWithDebug:
+          image_name: 'ubuntu-latest'
+          deps: 'sudo apt-get install -y ninja-build clang libicu-dev'
+          build_type: 'RelWithDebInfo'
+          test_target: 'check'
+          libtype_flag: ''
+        Linux.Release:
+          image_name: 'ubuntu-latest'
+          deps: 'sudo apt-get install -y ninja-build clang libicu-dev'
+          build_type: 'Release'
+          test_target: 'all'
+          libtype_flag: ''
+        OSX.Debug:
+          image_name: 'macOS-latest'
+          deps: 'brew install ninja icu4c'
           build_type: 'Debug'
           build_type: 'Debug'
-        release_with_debug:
+          test_target: 'check'
+          libtype_flag: '-DSTATIC_LIBRARY=ON'
+        OSX.ReleaseWithDebug:
+          image_name: 'macOS-latest'
+          deps: 'brew install ninja icu4c'
           build_type: 'RelWithDebInfo'
           build_type: 'RelWithDebInfo'
+          test_target: 'check'
+          libtype_flag: ''
+        OSX.Release:
+          image_name: 'macOS-latest'
+          deps: 'brew install ninja icu4c'
+          build_type: 'Release'
+          test_target: 'all'
+          libtype_flag: ''
 
 
+    pool:
+      vmImage: $(image_name)
+      
     steps:
     steps:
-    - script: sudo apt-get install -y ninja-build clang libicu-dev
+    - script: $(deps)
       displayName: 'Install dependencies'
       displayName: 'Install dependencies'
   
   
     - script: |
     - script: |
@@ -24,13 +57,15 @@ jobs:
 
 
     - script: |
     - script: |
         cd build
         cd build
-        cmake -GNinja -DCMAKE_BUILD_TYPE=$BUILD_TYPE -DCMAKE_CXX_COMPILER=clang++ -DCMAKE_C_COMPILER=clang ..
+        cmake -GNinja -DCMAKE_BUILD_TYPE=$BUILD_TYPE $LIBTYPE -DCMAKE_CXX_COMPILER=clang++ -DCMAKE_C_COMPILER=clang ..
       displayName: CMake
       displayName: CMake
       env:
       env:
         BUILD_TYPE: $(build_type)
         BUILD_TYPE: $(build_type)
+        LIBTYPE: $(libtype_flag)
 
 
     - script: |
     - script: |
         cd build
         cd build
-        ninja
-        ninja check
+        ninja $TARGET
       displayName: 'Build and test'
       displayName: 'Build and test'
+      env:
+        TARGET: $(test_target)

+ 4 - 0
test/CMakeLists.txt

@@ -15,3 +15,7 @@ add_custom_target(check
     DEPENDS ch
     DEPENDS ch
     )
     )
 
 
+if (NOT STATIC_LIBRARY)
+    add_dependencies(check ChakraCore)
+endif()
+