Skip to content

Commit

Permalink
Use a random discriminator for test runs. (#12449)
Browse files Browse the repository at this point in the history
If we're getting cross-talk, maybe this will help.
  • Loading branch information
bzbarsky-apple authored and pull[bot] committed Feb 25, 2022
1 parent 59a0580 commit 1735700
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 7 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ jobs:
"./scripts/tests/run_test_suite.py \
--chip-tool ./out/debug/standalone/chip-tool \
run \
--iterations 2 \
--iterations 1 \
--all-clusters-app ./out/debug/standalone/chip-all-clusters-app \
--tv-app ./out/debug/standalone/chip-tv-app \
"
Expand Down Expand Up @@ -180,7 +180,7 @@ jobs:
--chip-tool ./out/debug/standalone/chip-tool \
--target-skip-glob 'TV_*' \
run \
--iterations 2 \
--iterations 1 \
--all-clusters-app ./out/debug/standalone/chip-all-clusters-app \
--tv-app ./out/debug/standalone/chip-tv-app \
"
Expand Down
15 changes: 13 additions & 2 deletions examples/platform/linux/Options.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -174,9 +174,20 @@ bool HandleOption(const char * aProgram, OptionSet * aOptions, int aIdentifier,
LinuxDeviceOptions::GetInstance().payload.rendezvousInformation.SetRaw(static_cast<uint8_t>(atoi(aValue)));
break;

case kDeviceOption_Discriminator:
LinuxDeviceOptions::GetInstance().payload.discriminator = static_cast<uint16_t>(atoi(aValue));
case kDeviceOption_Discriminator: {
uint16_t value = static_cast<uint16_t>(atoi(aValue));
if (value >= 4096)
{
PrintArgError("%s: invalid value specified for discriminator: %s\n", aProgram, aValue);
retval = false;
}
else
{
LinuxDeviceOptions::GetInstance().payload.discriminator = value;
DeviceLayer::ConfigurationMgr().StoreSetupDiscriminator(value);
}
break;
}

case kDeviceOption_Passcode:
LinuxDeviceOptions::GetInstance().payload.setUpPINCode = static_cast<uint32_t>(atoi(aValue));
Expand Down
9 changes: 6 additions & 3 deletions scripts/tests/chiptest/test_definition.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@

from enum import Enum, auto
from dataclasses import dataclass
from random import randrange

TEST_NODE_ID = '0x12344321'

Expand Down Expand Up @@ -101,9 +102,11 @@ def Run(self, runner, paths: ApplicationPaths):
if os.path.exists('/tmp/chip_tool_config.ini'):
os.unlink('/tmp/chip_tool_config.ini')

logging.debug('Executing application under test.')
discriminator = str(randrange(1, 4096))
logging.debug(
'Executing application under test with discriminator %s.' % discriminator)
app_process, outpipe, errpipe = runner.RunSubprocess(
app_cmd, name='APP ', wait=False)
app_cmd + ['--discriminator', discriminator], name='APP ', wait=False)

logging.debug('Waiting for server to listen.')
start_time = time.time()
Expand All @@ -117,7 +120,7 @@ def Run(self, runner, paths: ApplicationPaths):
"Server Listening")
logging.debug('Server is listening. Can proceed.')

runner.RunSubprocess(tool_cmd + ['pairing', 'qrcode', TEST_NODE_ID, 'MT:D8XA0CQM00KA0648G00'],
runner.RunSubprocess(tool_cmd + ['pairing', 'onnetwork-long', TEST_NODE_ID, '20202021', discriminator],
name='PAIR', dependencies=[app_process])

runner.RunSubprocess(tool_cmd + ['tests', self.run_name, TEST_NODE_ID],
Expand Down

0 comments on commit 1735700

Please sign in to comment.