Просмотр исходного кода

External build system generator release 8

Update tools: yexport
robot-ya-builder 2 лет назад
Родитель
Сommit
58a117b001

+ 1 - 1
CMakeLists.darwin.txt

@@ -1,5 +1,5 @@
 
 
-# This file was gererated by the build system used internally in the Yandex monorepo.
+# This file was generated by the build system used internally in the Yandex monorepo.
 # Only simple modifications are allowed (adding source-files to targets, adding simple properties
 # Only simple modifications are allowed (adding source-files to targets, adding simple properties
 # like target_include_directories). These modifications will be ported to original
 # like target_include_directories). These modifications will be ported to original
 # ya.make files by maintainers. Any complex modifications which can't be ported back to the
 # ya.make files by maintainers. Any complex modifications which can't be ported back to the

+ 1 - 1
CMakeLists.linux-aarch64.txt

@@ -1,5 +1,5 @@
 
 
-# This file was gererated by the build system used internally in the Yandex monorepo.
+# This file was generated by the build system used internally in the Yandex monorepo.
 # Only simple modifications are allowed (adding source-files to targets, adding simple properties
 # Only simple modifications are allowed (adding source-files to targets, adding simple properties
 # like target_include_directories). These modifications will be ported to original
 # like target_include_directories). These modifications will be ported to original
 # ya.make files by maintainers. Any complex modifications which can't be ported back to the
 # ya.make files by maintainers. Any complex modifications which can't be ported back to the

+ 1 - 1
CMakeLists.linux.txt

@@ -1,5 +1,5 @@
 
 
-# This file was gererated by the build system used internally in the Yandex monorepo.
+# This file was generated by the build system used internally in the Yandex monorepo.
 # Only simple modifications are allowed (adding source-files to targets, adding simple properties
 # Only simple modifications are allowed (adding source-files to targets, adding simple properties
 # like target_include_directories). These modifications will be ported to original
 # like target_include_directories). These modifications will be ported to original
 # ya.make files by maintainers. Any complex modifications which can't be ported back to the
 # ya.make files by maintainers. Any complex modifications which can't be ported back to the

+ 1 - 1
CMakeLists.txt

@@ -1,5 +1,5 @@
 
 
-# This file was gererated by the build system used internally in the Yandex monorepo.
+# This file was generated by the build system used internally in the Yandex monorepo.
 # Only simple modifications are allowed (adding source-files to targets, adding simple properties
 # Only simple modifications are allowed (adding source-files to targets, adding simple properties
 # like target_include_directories). These modifications will be ported to original
 # like target_include_directories). These modifications will be ported to original
 # ya.make files by maintainers. Any complex modifications which can't be ported back to the
 # ya.make files by maintainers. Any complex modifications which can't be ported back to the

+ 62 - 0
build/scripts/split_unittest.py

@@ -0,0 +1,62 @@
+import argparse
+import tempfile
+import shlex
+import subprocess
+
+
+def parse_args():
+    parser = argparse.ArgumentParser()
+    parser.add_argument("--split-factor", type=int, default=0)
+    parser.add_argument("--shard", type=int, default=0)
+    parser.add_argument("command", nargs=argparse.REMAINDER)
+    return parser.parse_args()
+
+
+def list_tests(binary):
+    with tempfile.NamedTemporaryFile() as tmpfile:
+        cmd = [binary, "--list-verbose", "--list-path", tmpfile.name]
+        subprocess.check_call(cmd)
+
+        with open(tmpfile.name) as afile:
+            lines = afile.read().strip().split("\n")
+            lines = [x.strip() for x in lines]
+            return [x for x in lines if x]
+
+
+def get_shard_tests(args):
+    test_names = list_tests(args.command[0])
+    test_names = sorted(test_names)
+
+    chunk_size = len(test_names) // args.split_factor
+    not_used = len(test_names) % args.split_factor
+    shift = chunk_size + (args.shard < not_used)
+    start = chunk_size * args.shard + min(args.shard, not_used)
+    end = start + shift
+    return [] if end > len(test_names) else test_names[start:end]
+
+
+def get_shard_cmd_args(args):
+    return ["+{}".format(x) for x in get_shard_tests(args)]
+
+
+def main():
+    args = parse_args()
+
+    if args.split_factor:
+        shard_cmd = get_shard_cmd_args(args)
+        if shard_cmd:
+            cmd = args.command + shard_cmd
+        else:
+            print("No tests for {} shard".format(args.shard))
+            return 0
+    else:
+        cmd = args.command
+
+    rc = subprocess.call(cmd)
+    if rc:
+        print("Some tests failed. To reproduce run: {}".format(shlex.join(cmd)))
+    return rc
+
+
+if __name__ == "__main__":
+    exit(main())

+ 1 - 1
certs/CMakeLists.darwin.txt

@@ -1,5 +1,5 @@
 
 
-# This file was gererated by the build system used internally in the Yandex monorepo.
+# This file was generated by the build system used internally in the Yandex monorepo.
 # Only simple modifications are allowed (adding source-files to targets, adding simple properties
 # Only simple modifications are allowed (adding source-files to targets, adding simple properties
 # like target_include_directories). These modifications will be ported to original
 # like target_include_directories). These modifications will be ported to original
 # ya.make files by maintainers. Any complex modifications which can't be ported back to the
 # ya.make files by maintainers. Any complex modifications which can't be ported back to the

+ 1 - 1
certs/CMakeLists.linux-aarch64.txt

@@ -1,5 +1,5 @@
 
 
-# This file was gererated by the build system used internally in the Yandex monorepo.
+# This file was generated by the build system used internally in the Yandex monorepo.
 # Only simple modifications are allowed (adding source-files to targets, adding simple properties
 # Only simple modifications are allowed (adding source-files to targets, adding simple properties
 # like target_include_directories). These modifications will be ported to original
 # like target_include_directories). These modifications will be ported to original
 # ya.make files by maintainers. Any complex modifications which can't be ported back to the
 # ya.make files by maintainers. Any complex modifications which can't be ported back to the

+ 1 - 1
certs/CMakeLists.linux.txt

@@ -1,5 +1,5 @@
 
 
-# This file was gererated by the build system used internally in the Yandex monorepo.
+# This file was generated by the build system used internally in the Yandex monorepo.
 # Only simple modifications are allowed (adding source-files to targets, adding simple properties
 # Only simple modifications are allowed (adding source-files to targets, adding simple properties
 # like target_include_directories). These modifications will be ported to original
 # like target_include_directories). These modifications will be ported to original
 # ya.make files by maintainers. Any complex modifications which can't be ported back to the
 # ya.make files by maintainers. Any complex modifications which can't be ported back to the

+ 1 - 1
certs/CMakeLists.txt

@@ -1,5 +1,5 @@
 
 
-# This file was gererated by the build system used internally in the Yandex monorepo.
+# This file was generated by the build system used internally in the Yandex monorepo.
 # Only simple modifications are allowed (adding source-files to targets, adding simple properties
 # Only simple modifications are allowed (adding source-files to targets, adding simple properties
 # like target_include_directories). These modifications will be ported to original
 # like target_include_directories). These modifications will be ported to original
 # ya.make files by maintainers. Any complex modifications which can't be ported back to the
 # ya.make files by maintainers. Any complex modifications which can't be ported back to the

+ 45 - 0
cmake/common.cmake

@@ -210,3 +210,48 @@ function(use_export_script Target ExportFile)
     LINK_DEPENDS ${OutPath}
     LINK_DEPENDS ${OutPath}
   )
   )
 endfunction()
 endfunction()
+
+function(add_yunittest)
+  set(opts "")
+  set(oneval_args NAME TEST_TARGET)
+  set(multival_args TEST_ARG)
+  cmake_parse_arguments(YUNITTEST_ARGS
+    "${opts}"
+    "${oneval_args}"
+    "${multival_args}"
+    ${ARGN}
+  )
+  get_property(SPLIT_FACTOR TARGET ${YUNITTEST_ARGS_TEST_TARGET} PROPERTY SPLIT_FACTOR)
+  if (${SPLIT_FACTOR} EQUAL 1)
+  	add_test(NAME ${YUNITTEST_ARGS_NAME} COMMAND ${YUNITTEST_ARGS_TARGET} ${YUNITTEST_ARGS_TEST_ARG})
+  	return()
+  endif()
+
+  foreach(Idx RANGE ${SPLIT_FACTOR})
+    add_test(NAME ${YUNITTEST_ARGS_NAME}_${Idx}
+      COMMAND Python3::Interpreter ${CMAKE_SOURCE_DIR}/build/scripts/split_unittest.py --split-factor ${SPLIT_FACTOR} --shard ${Idx}
+       $<TARGET_FILE:${YUNITTEST_ARGS_TEST_TARGET}> ${YUNITTEST_ARGS_TEST_ARG})
+  endforeach()
+endfunction()
+
+function(set_yunittest_property)
+  set(opts "")
+  set(oneval_args TEST PROPERTY)
+  set(multival_args )
+  cmake_parse_arguments(YUNITTEST_ARGS
+    "${opts}"
+    "${oneval_args}"
+    "${multival_args}"
+    ${ARGN}
+  )
+  get_property(SPLIT_FACTOR TARGET ${YUNITTEST_ARGS_TEST} PROPERTY SPLIT_FACTOR)
+  
+  if (${SPLIT_FACTOR} EQUAL 1)
+    set_property(TEST ${YUNITTEST_ARGS_TEST} PROPERTY ${YUNITTEST_ARGS_PROPERTY} ${YUNITTEST_ARGS_UNPARSED_ARGUMENTS})
+  	return()
+  endif()
+
+  foreach(Idx RANGE ${SPLIT_FACTOR})
+    set_property(TEST ${YUNITTEST_ARGS_TEST}_${Idx} PROPERTY ${YUNITTEST_ARGS_PROPERTY} ${YUNITTEST_ARGS_UNPARSED_ARGUMENTS})
+  endforeach()
+endfunction()

Некоторые файлы не были показаны из-за большого количества измененных файлов