Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 0 additions & 6 deletions dist/platforms/ubuntu/steps/runsteps.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,6 @@
#
STEPS_DIR="${STEPS_DIR:-/steps}"

# TEMPORARY: tracing every command to stderr while diagnosing a real CI
# failure where a Docker test run produces zero visible stdout before
# failing near-instantly (game-ci/cli - see the PR this landed in for
# context). Remove once root-caused.
set -x

source "$STEPS_DIR/set_extra_git_configs.sh"
source "$STEPS_DIR/set_gitcredential.sh"

Expand Down
6 changes: 5 additions & 1 deletion src/command/test/unity-test-command.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,11 @@ describe('UnityTestCommand', () => {
expect(isAvailableMock).not.toHaveBeenCalled();
expect(dockerRunMock).toHaveBeenCalledTimes(1);
const [image, options] = dockerRunMock.mock.calls[0] as unknown as [string, any];
expect(image).toContain('base'); // NoTarget resolves to the 'base' editor image
// Defaults to this host's native Standalone target (StandaloneLinux64 on
// Linux), which resolves to the linux-il2cpp module for Unity 2020+ -
// NOT the 'base'/NoTarget image, which lacks what's needed to actually
// compile and run test assemblies (see defaultTestTargetPlatform).
expect(image).toContain('linux-il2cpp');
expect(options.runTests).toBe(true);
});

Expand Down
44 changes: 32 additions & 12 deletions src/command/test/unity-test-command.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,27 @@ import { HostRunner } from '../../model/host-runner.ts';
import { PlatformSetup } from '../../logic/unity/platform-setup/index.ts';
import type { YargsInstance, Options } from '../../dependencies.ts';

/**
* Real bug found via a live CI run: defaulting to NoTarget (RunnerImageTag's
* 'base' module) seemed like the obvious no-target-platform-being-built
* choice, but 'base' apparently lacks whatever's needed to actually compile
* and run test assemblies - `-runTests` exited instantly with no log output
* at all against it. unity-test-runner's own original ImageTag defaulted to
* this host's native Standalone target instead (see its
* getImagePlatformType) - StandaloneLinux64 resolves to the linux-il2cpp
* module for Unity 2020+, which does have what's needed. Matching that
* here, rather than NoTarget.
*/
function defaultTestTargetPlatform(hostPlatform: string = process.platform): string {
switch (hostPlatform) {
case 'win32':
return 'StandaloneWindows';
case 'linux':
default:
return 'StandaloneLinux64';
}
}

/**
* `game-ci test` — two independent ways to run Unity tests, chosen via
* --docker:
Expand Down Expand Up @@ -91,13 +112,10 @@ export class UnityTestCommand extends CommandBase implements CommandInterface {
);
}

// No target platform is being built - resolves to the 'base' editor
// image, same one activate/NoTarget already uses (see RunnerImageTag's
// targetPlatformSuffixes.noTarget). UnityOptions.configure() defaults
// targetPlatform to StandaloneWindows64 (build's default, not test's) -
// overridden back to NoTarget in configureOptions() below, so this
// should already be NoTarget unless a caller explicitly passed one.
const testOptions = { ...options, targetPlatform: options.targetPlatform || 'NoTarget' };
const testOptions = {
...options,
targetPlatform: options.targetPlatform || defaultTestTargetPlatform(hostPlatform),
};

const image = new RunnerImageTag(testOptions);
if (log.isVerbose) log.debug('Using image:', image);
Expand All @@ -114,11 +132,13 @@ export class UnityTestCommand extends CommandBase implements CommandInterface {
public async configureOptions(yargs: YargsInstance): Promise<void> {
await ProjectOptions.configure(yargs);
await UnityOptions.configure(yargs);
// UnityOptions defaults targetPlatform to StandaloneWindows64 (a build
// concern) - tests don't build anything, so default to NoTarget's
// 'base' editor image instead. A caller can still pass --targetPlatform
// explicitly (e.g. for --testPlatforms=standalone scenarios).
yargs.default('targetPlatform', 'NoTarget');
// UnityOptions defaults targetPlatform to StandaloneWindows64
// unconditionally (a build concern) - override to this host's own
// native target, matching unity-test-runner's original default (see
// defaultTestTargetPlatform's comment for why NoTarget doesn't work
// here). A caller can still pass --targetPlatform explicitly (e.g. for
// --testPlatforms=standalone scenarios targeting a different platform).
yargs.default('targetPlatform', defaultTestTargetPlatform());
await UnityTestOptions.configure(yargs);
await DockerTestOptions.configure(yargs);
}
Expand Down
Loading