Use normal USB deadlines for successful protocol fixtures
Device Core qualification / qualify (push) Successful in 8m24s
Device Core qualification / qualify (push) Successful in 8m24s
This commit is contained in:
@@ -23,17 +23,19 @@ function fixture({ model = 231, silence = false, change = false, incomplete = fa
|
|||||||
return { serial: { async requestPort(options) { assert.deepEqual(options.filters, [{ usbVendorId: 0x2e3c, usbProductId: 0x5740 }]); return port; } }, writes, closed: () => closed, stream: () => stream };
|
return { serial: { async requestPort(options) { assert.deepEqual(options.filters, [{ usbVendorId: 0x2e3c, usbProductId: 0x5740 }]); return port; } }, writes, closed: () => closed, stream: () => stream };
|
||||||
}
|
}
|
||||||
test('read-only USB protocol handles fragmented lines and releases port', async () => {
|
test('read-only USB protocol handles fragmented lines and releases port', async () => {
|
||||||
const f = fixture(); const result = await readB2Usb({ serial: f.serial, timeoutMs: 100 });
|
// Successful reads must not depend on CI scheduling within 50–100 ms.
|
||||||
|
// The dedicated timeout test below supplies its own short deadline.
|
||||||
|
const f = fixture(); const result = await readB2Usb({ serial: f.serial });
|
||||||
assert.equal(result.settings, 'synthetic-config'); assert.equal(result.before.MN, result.after.MN);
|
assert.equal(result.settings, 'synthetic-config'); assert.equal(result.before.MN, result.after.MN);
|
||||||
assert.deepEqual(f.writes, ['>I 7\r\n', '>D 15;0\r\n', '>I 7\r\n']); assert.ok(f.closed());
|
assert.deepEqual(f.writes, ['>I 7\r\n', '>D 15;0\r\n', '>I 7\r\n']); assert.ok(f.closed());
|
||||||
});
|
});
|
||||||
test('wrong model stops before requesting configuration', async () => {
|
test('wrong model stops before requesting configuration', async () => {
|
||||||
const f = fixture({ model: 999 });
|
const f = fixture({ model: 999 });
|
||||||
await assert.rejects(readB2Usb({ serial: f.serial, timeoutMs: 50 }), /не распознано/);
|
await assert.rejects(readB2Usb({ serial: f.serial }), /не распознано/);
|
||||||
assert.deepEqual(f.writes, ['>I 7\r\n']); assert.ok(f.closed());
|
assert.deepEqual(f.writes, ['>I 7\r\n']); assert.ok(f.closed());
|
||||||
});
|
});
|
||||||
test('identity change cannot produce a registration snapshot', async () => {
|
test('identity change cannot produce a registration snapshot', async () => {
|
||||||
const f = fixture({ change: true }); await assert.rejects(readB2Usb({ serial: f.serial, timeoutMs: 50 }), /изменилось устройство/); assert.ok(f.closed());
|
const f = fixture({ change: true }); await assert.rejects(readB2Usb({ serial: f.serial }), /изменилось устройство/); assert.ok(f.closed());
|
||||||
});
|
});
|
||||||
test('incomplete response and silence time out and close the port', async () => {
|
test('incomplete response and silence time out and close the port', async () => {
|
||||||
for (const options of [{ silence: true }, { incomplete: true }]) {
|
for (const options of [{ silence: true }, { incomplete: true }]) {
|
||||||
|
|||||||
Reference in New Issue
Block a user