Skip to content

Commit 58ddc20

Browse files
Merge branch 'topic/als#1637' into 'master'
Test tasks generation for aggregate projects See merge request eng/ide/ada_language_server!2033
2 parents 868c7f5 + 1abdee9 commit 58ddc20

File tree

10 files changed

+94
-2
lines changed

10 files changed

+94
-2
lines changed

integration/vscode/ada/.vscode-test.mjs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,13 @@ if (process.env['MOCHA_GREP']) {
3939
baseMochaOptions.grep = process.env['MOCHA_GREP'];
4040
}
4141

42-
const testsuites = ['general', 'workspace_missing_dirs', 'dot-als-json', 'status_bar'];
42+
const testsuites = [
43+
'general',
44+
'workspace_missing_dirs',
45+
'dot-als-json',
46+
'status_bar',
47+
'aggregate_projects',
48+
];
4349

4450
export default defineConfig(
4551
testsuites.map((suiteName) => {
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
/* eslint-disable max-len */
2+
import assert from 'assert';
3+
import path from 'path';
4+
import { exe, getProjectFile } from '../../src/helpers';
5+
import { createAdaTaskProvider } from '../../src/taskProviders';
6+
import { activate, getCommandLines, isCoreTask } from '../utils';
7+
8+
suite('Aggregate Projects Support', function () {
9+
// Set timeout to 15 seconds unless already configured to more
10+
this.timeout(Math.max(this.timeout(), 15000));
11+
12+
let projectPath: string;
13+
14+
this.beforeAll(async () => {
15+
await activate();
16+
projectPath = await getProjectFile();
17+
});
18+
19+
/**
20+
* Check that the list of offered Ada tasks is expected for
21+
* aggregate projects, in particular we should offer tasks to
22+
* build and run the mains of all aggregated projects.
23+
*/
24+
test('Ada tasks for aggregate projects', async () => {
25+
const expectedCmdLines = `
26+
ada: Clean current project - gprclean -P ${projectPath}
27+
ada: Build current project - gprbuild -P ${projectPath} '-cargs:ada' -gnatef
28+
ada: Check current file - gprbuild -q -f -c -u -gnatc -P ${projectPath} \${fileBasename} '-cargs:ada' -gnatef
29+
ada: Compile current file - gprbuild -q -f -c -u -P ${projectPath} \${fileBasename} '-cargs:ada' -gnatef
30+
ada: Generate documentation from the project - gnatdoc -P ${projectPath}
31+
ada: Build main - src/main_1.adb - gprbuild -P ${projectPath} src/main_1.adb '-cargs:ada' -gnatef
32+
ada: Run main - src/main_1.adb - .${path.sep}main1exec${exe}
33+
ada: Build main - src/main_2.adb - gprbuild -P ${projectPath} src/main_2.adb '-cargs:ada' -gnatef
34+
ada: Run main - src/main_2.adb - .${path.sep}main2exec${exe}
35+
ada: Build main - src/main_3.adb - gprbuild -P ${projectPath} src/main_3.adb '-cargs:ada' -gnatef
36+
ada: Run main - src/main_3.adb - .${path.sep}main3exec${exe}
37+
`.trim();
38+
39+
const prov = createAdaTaskProvider();
40+
/**
41+
* Exclude GNAT SAS tasks because they are tested in integration-testsuite.
42+
*/
43+
const actualCommandLines = await getCommandLines(prov, isCoreTask);
44+
assert.equal(actualCommandLines, expectedCmdLines);
45+
});
46+
});
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"projectFile": "aggr.gpr"
3+
}
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
aggregate project Aggr is
2+
for Project_Files use ("project_1.gpr", "project_2.gpr");
3+
end Aggr;
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
project Project_1 is
2+
for Source_Dirs use ("src");
3+
for Main use ("main_1.adb", "main_2.adb");
4+
5+
package Builder is
6+
for Executable ("main_1.adb") use "main1exec";
7+
for Executable ("main_2.adb") use "main2exec";
8+
end Builder;
9+
end Project_1;
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
project Project_2 is
2+
for Source_Dirs use ("src");
3+
for Main use ("main_3.adb");
4+
package Builder is
5+
for Executable ("main_3.adb") use "main3exec";
6+
end Builder;
7+
end Project_2;
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
procedure Main_1 is
2+
begin
3+
null;
4+
end Main_1;
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
procedure Main_2 is
2+
begin
3+
null;
4+
end Main_2;
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
procedure Main_3 is
2+
begin
3+
null;
4+
end Main_3;

integration/vscode/ada/test/runTest.ts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,13 @@ async function main() {
1010
// Passed to `--extensionDevelopmentPath`
1111
const extensionDevelopmentPath = path.resolve(__dirname, '../../');
1212

13-
const testsuites = ['general', 'gnattest', 'workspace_missing_dirs', 'status_bar'];
13+
const testsuites = [
14+
'general',
15+
'gnattest',
16+
'workspace_missing_dirs',
17+
'status_bar',
18+
'aggregate_projects',
19+
];
1420

1521
let someTestsuiteFailed = false;
1622

0 commit comments

Comments
 (0)