按显式配置控制 Windows sccache
未配置 wrapper 时默认回退到直接 rustc 处理 sccache 探测失败与 wrapper 配置冲突 同步更新开发运维和排障文档
This commit is contained in:
+34
-3
@@ -657,6 +657,28 @@ describe('dev scheduler local worker cleanup', () => {
|
||||
});
|
||||
|
||||
describe('dev scheduler Rust build env', () => {
|
||||
test('Windows 下未显式配置 wrapper 时默认关闭 sccache', () => {
|
||||
const originalPlatform = Object.getOwnPropertyDescriptor(
|
||||
process,
|
||||
'platform',
|
||||
);
|
||||
Object.defineProperty(process, 'platform', {
|
||||
configurable: true,
|
||||
value: 'win32',
|
||||
});
|
||||
try {
|
||||
const env = buildLocalRustProcessEnv(
|
||||
{},
|
||||
{ log: false, sccacheAvailable: true },
|
||||
);
|
||||
expect(env.RUSTC_WRAPPER).toBe('');
|
||||
expect(env.CARGO_BUILD_RUSTC_WRAPPER).toBe('');
|
||||
} finally {
|
||||
if (originalPlatform)
|
||||
Object.defineProperty(process, 'platform', originalPlatform);
|
||||
}
|
||||
});
|
||||
|
||||
test('local dev Rust env enables available sccache wrapper', () => {
|
||||
const originalPlatform = Object.getOwnPropertyDescriptor(
|
||||
process,
|
||||
@@ -670,7 +692,7 @@ describe('dev scheduler Rust build env', () => {
|
||||
try {
|
||||
const env = buildLocalRustProcessEnv(
|
||||
{
|
||||
RUSTC_WRAPPER: '/usr/bin/sccache',
|
||||
RUSTC_WRAPPER: 'sccache',
|
||||
CARGO_BUILD_RUSTC_WRAPPER: 'sccache',
|
||||
},
|
||||
{ log: false, sccacheAvailable: true },
|
||||
@@ -685,11 +707,11 @@ describe('dev scheduler Rust build env', () => {
|
||||
}
|
||||
});
|
||||
|
||||
test('local dev Rust env keeps healthy custom wrapper untouched', () => {
|
||||
test('Rust wrapper 配置为同一个自定义 wrapper 时保持不变', () => {
|
||||
const env = buildLocalRustProcessEnv(
|
||||
{
|
||||
RUSTC_WRAPPER: 'custom-wrapper',
|
||||
CARGO_BUILD_RUSTC_WRAPPER: 'sccache',
|
||||
CARGO_BUILD_RUSTC_WRAPPER: 'custom-wrapper',
|
||||
},
|
||||
{ log: false },
|
||||
);
|
||||
@@ -725,6 +747,15 @@ describe('dev scheduler Rust build env', () => {
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
test('Rust wrapper 配置冲突时回退到空 wrapper', () => {
|
||||
const env = buildLocalRustProcessEnv(
|
||||
{ RUSTC_WRAPPER: 'sccache', CARGO_BUILD_RUSTC_WRAPPER: 'custom-wrapper' },
|
||||
{ log: false },
|
||||
);
|
||||
expect(env.RUSTC_WRAPPER).toBe('');
|
||||
expect(env.CARGO_BUILD_RUSTC_WRAPPER).toBe('');
|
||||
});
|
||||
});
|
||||
|
||||
describe('dev scheduler stack state file', () => {
|
||||
|
||||
Reference in New Issue
Block a user