CodeQL / Analyze (actions) (push) Canceled after 0s
CodeQL / Analyze (python) (push) Canceled after 0s
pre-commit / pre-commit (push) Canceled after 0s
Multi-Arch CI / setup (push) Canceled after 0s
Publish build_manylinux_x86_64 images / publish_build_manylinux_x86_64 (push) Canceled after 0s
Setup (Multi-Arch) / setup (push) Canceled after 0s
Multi-Arch CI / Linux::${{ fromJSON(needs.setup.outputs.linux_build_config || '{}').build_variant_label || 'skip' }} (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish no_rocm_image_ubi10 image / publish_no_rocm_image_ubi10 (push) Canceled after 0s
Multi-Arch CI / Windows::${{ fromJSON(needs.setup.outputs.windows_build_config || '{}').build_variant_label || 'skip' }} (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Multi-Arch CI / Manifest Diff (push) Canceled after 0s
TheRock Manifest Diff Report / Generate Manifest Diff Report (push) Canceled after 0s
Multi-Arch CI / CI Summary (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04 (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04_ocl_rt images / publish_no_rocm_image_ubuntu24_04_ocl_rt (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_rocgdb (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04_rocgdb images / publish_no_rocm_image_ubuntu24_04_rocgdb (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_ocl_rt (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Unit Tests / Unit Tests :: ubuntu-24.04 (push) Canceled after 0s
Unit Tests / Unit Tests :: windows-2022 (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_media (push) Canceled after 0s
Unit Tests / Unit Tests Summary (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_openmpi (push) Canceled after 0s
123 lines
4.6 KiB
C
123 lines
4.6 KiB
C
// Test build session validation with parallel compilation for incremental builds.
|
|
|
|
// RUN: rm -rf %t
|
|
// RUN: split-file %s %t
|
|
// Use the same command line arguments to ensure .pcm files are in the same location.
|
|
// RUN: echo "-fsyntax-only -I %/t/include" > %t/ctx.rsp
|
|
// RUN: echo "-fmodules -fmodules-cache-path=%/t/module-cache" >> %t/ctx.rsp
|
|
// RUN: echo "-fbuild-session-file=%/t/session.timestamp" >> %t/ctx.rsp
|
|
// RUN: echo "-fmodules-validate-once-per-build-session" >> %t/ctx.rsp
|
|
//
|
|
// Add a build session file to avoid errors that it's missing. Doesn't do anything as we start with a clean build.
|
|
// RUN: touch %t/session.timestamp
|
|
// Generate headers that take noticeable time to parse. The purpose is to tweak the timing, so can reproduce the error.
|
|
// RUN: %python %t/generate-expensive-header.py A 2000000 > %t/include/expensive-header.h
|
|
// RUN: %python %t/generate-expensive-header.py B 500000 > %t/include/less-expensive-header.h
|
|
//
|
|
// Create SignatureExpectation.pcm with a specific Target signature.
|
|
// RUN: cp %t/version1.h %t/include/target.h
|
|
// RUN: sed "s|DIR|%/t|g" %t/prepare-expected-signature.json.template > %t/prepare-expected-signature.json
|
|
// RUN: clang-scan-deps -compilation-database %t/prepare-expected-signature.json > /dev/null
|
|
//
|
|
// Built a different Target.pcm with a different signature.
|
|
// RUN: cp %t/version2.h %t/include/target.h
|
|
// Update the build session to rebuild Target.
|
|
// RUN: touch %t/session.timestamp
|
|
// RUN: sed "s|DIR|%/t|g" %t/create-outdated-module.json.template > %t/create-outdated-module.json
|
|
// RUN: clang-scan-deps -compilation-database %t/create-outdated-module.json > /dev/null
|
|
//
|
|
// Simulate the incremental build.
|
|
// RUN: cp %t/version3.h %t/include/target.h
|
|
// RUN: touch %t/session.timestamp
|
|
// Scan 2 files in parallel.
|
|
// RUN: sed "s|DIR|%/t|g" %t/incremental.json.template > %t/incremental.json
|
|
// RUN: clang-scan-deps -compilation-database %t/incremental.json > /dev/null
|
|
|
|
//--- include/module.modulemap
|
|
module Target {
|
|
header "target.h"
|
|
export *
|
|
}
|
|
|
|
module SignatureExpectation {
|
|
header "signature-expectation.h"
|
|
textual header "expensive-header.h"
|
|
export *
|
|
}
|
|
|
|
//--- version1.h
|
|
// empty
|
|
|
|
//--- version2.h
|
|
void some_func(void);
|
|
|
|
//--- version3.h
|
|
void some_func(void);
|
|
#define TARGET_MACRO 1
|
|
|
|
//--- generate-expensive-header.py
|
|
import sys
|
|
|
|
num_items = int(sys.argv[2])
|
|
suffix = sys.argv[1]
|
|
for i in range(num_items):
|
|
if i == 0:
|
|
print(f"#define MACRO_{suffix}_{i} 0")
|
|
else:
|
|
print(f"#define MACRO_{suffix}_{i} MACRO_{suffix}_{i-1} + 1")
|
|
|
|
//--- include/signature-expectation.h
|
|
// Expensive header is used to slow down the build of SignatureExpectation module.
|
|
// Without the slow down we are able to validate and rebuild Target before another thread can do it.
|
|
#include <expensive-header.h>
|
|
#include <target.h>
|
|
|
|
//--- prepare-expected-signature.c
|
|
#include <signature-expectation.h>
|
|
//--- prepare-expected-signature.json.template
|
|
[{
|
|
"file": "DIR/prepare-expected-signature.c",
|
|
"directory": "DIR",
|
|
"command": "clang @DIR/ctx.rsp DIR/prepare-expected-signature.c"
|
|
}]
|
|
|
|
//--- create-outdated-module.c
|
|
#include <target.h>
|
|
//--- create-outdated-module.json.template
|
|
[{
|
|
"file": "DIR/create-outdated-module.c",
|
|
"directory": "DIR",
|
|
"command": "clang @DIR/ctx.rsp DIR/create-outdated-module.c"
|
|
}]
|
|
|
|
//--- use-outdated-module.c
|
|
// At first load SignatureExpectation module, so it would load Target but
|
|
// reject it due to a signature mismatch.
|
|
// After this we rebuild SignatureExpectation and try to use already loaded
|
|
// Target buffer when encounter corresponding include in the source code.
|
|
// The problem is that it corresponds to version2.h and not version3.h.
|
|
#include <signature-expectation.h>
|
|
|
|
#ifndef TARGET_MACRO
|
|
# error Macro is missing, probably using outdated Target module
|
|
# include <missing macro>
|
|
#endif
|
|
|
|
//--- rebuild-outdated-module.c
|
|
// We aim for another thread to load the outdated module Target with
|
|
// the wrong signature before we rebuild it.
|
|
#include <less-expensive-header.h>
|
|
#include <target.h>
|
|
|
|
//--- incremental.json.template
|
|
[{
|
|
"file": "DIR/use-outdated-module.c",
|
|
"directory": "DIR",
|
|
"command": "clang @DIR/ctx.rsp DIR/use-outdated-module.c"
|
|
},
|
|
{
|
|
"file": "DIR/rebuild-outdated-module.c",
|
|
"directory": "DIR",
|
|
"command": "clang @DIR/ctx.rsp DIR/rebuild-outdated-module.c"
|
|
}]
|