🎁 Sync 2026-09-15 11:06:14

This commit is contained in:
github-actions[bot] committed 2026-09-15 11:06:14 +08:00
1 parent 74521c44f6
commit 417da5cfba
62 files changed
+6708 -2800

No files matched your search

+6
View File
@@ -31,3 +31,9 @@ Run `ucode client-names.uc` with the installed `luci.client_history`,
caching, retry timing, address reuse, DHCP priority, boot reset and malformed
NBSTAT responses. For a live check, compare `netbios_names([ip])` with a known
NetBIOS responder; an unanswered query is not evidence of an offline client.
Channel analysis scans each band tab on first activation, using iwinfo for
mtwifi/mt_dbdc/ralink radios. It does not start a repeating scan poll or stop
LuCI's global poller. The refresh button is enabled immediately on completion or failure;
requests are coalesced per radio and serialized across radios. Run
`node modules/luci-mod-status/tests/channel-analysis.js` from the LuCI root.
+45
View File
@@ -0,0 +1,45 @@
const assert = require('assert');
const fs = require('fs');
const path = require('path');
const source = fs.readFileSync(path.join(__dirname, '../htdocs/luci-static/resources/view/status/channel_analysis.js'), 'utf8');
const view = new Function('view', 'rpc', 'L', 'fs', source)(
{extend: o => o}, {declare: () => () => {}},
{resolveDefault: (p, fallback) => p.catch(() => fallback)}, {}
);
view.updateScanButton = () => {};
const dev = (name, type) => ({getName: () => name, get: () => type});
(async () => {
const mt = dev('ra', 'mt_dbdc');
mt.getScanList = async () => [{ssid:'mtwifi'}];
assert.deepEqual(await view.getScanResultsForRadio(mt), [{ssid:'mtwifi'}]);
const qca = dev('wifi0', 'qcawificfg80211');
qca.getWifiNetworks = async () => [{getMode:()=> 'ap',getIfname:()=> 'ath0'}];
assert.equal(await view.resolveScanDevice(qca), 'ath0');
let calls = [], release;
view.getScanResultsForRadio = d => {
calls.push(d.getName());
return new Promise(resolve => {release = resolve;});
};
const first = view.requestRadioScan(mt);
assert.strictEqual(view.requestRadioScan(mt), first, 'duplicate requests share the pending scan');
const second = view.requestRadioScan(qca);
await Promise.resolve();
assert.deepEqual(calls, ['ra'], 'radios scan serially');
release([{ssid:'one'}]);
await first;
await Promise.resolve();
assert.deepEqual(calls, ['ra','wifi0']);
release([]);
await second;
const third = view.requestRadioScan(mt);
await Promise.resolve();
assert.equal(calls.length,3);
release([]);
await third;
view.getScanResultsForRadio = () => Promise.reject(Error('busy'));
await assert.rejects(view.requestRadioScan(mt), /busy/);
assert.equal(view.scanStates.ra.pending,null,'failure releases lock');
view.getScanResultsForRadio = async () => [{ssid:'recovered'}];
assert.deepEqual(await view.requestRadioScan(mt), [{ssid:'recovered'}], 'retry immediately after failure');
console.log('channel analysis: mtwifi backend, QCA interface resolution, serialization, coalescing, immediate rescan and error recovery passed');
})().catch(e => {console.error(e);process.exit(1)});