[compiler-rt] Relax pthread_getaffinity test to account for cgroups/docker
Fixes #58283 When running in a docker container you can have fewer cores assigned to you than get_nrpoc would suggest. Since the test just wants to know that interception worked, allow any result > 0 and <= the global core count. Reviewed By: MaskRay, vitalybuka Differential Revision: https://reviews.llvm.org/D135677
This commit is contained in:
parent
a7cccb9cbb
commit
d231efe1ee
|
@ -16,7 +16,8 @@ int main() {
|
||||||
pthread_t tid = pthread_self();
|
pthread_t tid = pthread_self();
|
||||||
int res = pthread_getaffinity_np(tid, sizeof(set_x), set_x);
|
int res = pthread_getaffinity_np(tid, sizeof(set_x), set_x);
|
||||||
assert(res == 0);
|
assert(res == 0);
|
||||||
assert(CPU_COUNT_S(sizeof(set_x), set_x) == get_nprocs());
|
int cpus = CPU_COUNT_S(sizeof(set_x), set_x);
|
||||||
|
assert(cpus > 0 && cpus <= get_nprocs());
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue