Skip to content

Commit

Permalink
wip-devtool
Browse files Browse the repository at this point in the history
  • Loading branch information
deribaucourt committed Dec 14, 2023
1 parent c485cb4 commit ab38d2f
Show file tree
Hide file tree
Showing 8 changed files with 31 additions and 23 deletions.
2 changes: 1 addition & 1 deletion client/src/__tests__/unit-tests/driver/scanner.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ describe('BitBakeProjectScanner', () => {
DoneCallback()
})
void bitBakeProjectScanner.rescanProject()
}, 300000)
}, 120000)

it('can get a list of layers', async () => {
const layers = bitBakeProjectScanner.scanResult._layers
Expand Down
20 changes: 14 additions & 6 deletions client/src/ui/BitbakeCommands.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import path from 'path'
import { BitbakeRecipeTreeItem, DevtoolWorkspaceTreeItem } from './BitbakeRecipesView'
import { type BitBakeProjectScanner, bitBakeProjectScanner } from '../driver/BitBakeProjectScanner'
import { extractRecipeName } from '../lib/src/utils/files'
import { runBitbakeTerminal } from './BitbakeTerminal'
import { runBitbakeTerminal, runBitbakeTerminalCustomCommand } from './BitbakeTerminal'
import { type BitbakeDriver } from '../driver/BitbakeDriver'
import { sanitizeForShell } from '../lib/src/BitbakeSettings'
import { type BitbakeTaskDefinition, type BitbakeTaskProvider } from './BitbakeTaskProvider'
Expand Down Expand Up @@ -209,8 +209,12 @@ async function devtoolModifyCommand (bitbakeWorkspace: BitbakeWorkspace, bitbake
if (chosenRecipe !== undefined) {
logger.debug(`Command: devtool-modify: ${chosenRecipe}`)
const command = `devtool modify ${chosenRecipe}`
await runBitbakeTerminal(bitbakeDriver, command, false)
await bitBakeProjectScanner.rescanProject(true)
const process = await runBitbakeTerminalCustomCommand(bitbakeDriver, command, `Bitbake: Devtool Modify: ${chosenRecipe}`)
process.on('exit', (code) => {
if (code === 0) {
void bitBakeProjectScanner.rescanProject(true)
}
})
}
}

Expand Down Expand Up @@ -239,16 +243,20 @@ async function devtoolUpdateCommand (bitbakeWorkspace: BitbakeWorkspace, bitbake
}

logger.debug(`Command: devtool-update: ${chosenRecipe}`)
await runBitbakeTerminal(bitbakeDriver, command, false)
await runBitbakeTerminalCustomCommand(bitbakeDriver, command, `Bitbake: Devtool Update: ${chosenRecipe}`)
}

async function devtoolResetCommand (bitbakeWorkspace: BitbakeWorkspace, bitbakeDriver: BitbakeDriver, uri?: any): Promise<void> {
const chosenRecipe = await selectRecipe(bitbakeWorkspace, uri)
if (chosenRecipe !== undefined) {
logger.debug(`Command: devtool-reset: ${chosenRecipe}`)
const command = `devtool reset ${chosenRecipe}`
await runBitbakeTerminal(bitbakeDriver, command, false)
await bitBakeProjectScanner.rescanProject(true)
const process = await runBitbakeTerminalCustomCommand(bitbakeDriver, command, `Bitbake: Devtool Reset: ${chosenRecipe}`)
process.on('exit', (code) => {
if (code === 0) {
void bitBakeProjectScanner.rescanProject(true)
}
})
}
}

Expand Down
6 changes: 3 additions & 3 deletions integration-tests/src/tests/bitbake-commands.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,15 +38,15 @@ suite('Bitbake Commands Test Suite', () => {
const files = await vscode.workspace.findFiles('build/tmp/work/*/base-files/*/issue')
return files.length === 1
})
}).timeout(300000)
}).timeout(120000)

test('Bitbake can clean a recipe', async () => {
await vscode.commands.executeCommand('bitbake.clean-recipe', 'base-files')
await assertWillComeTrue(async () => {
const files = await vscode.workspace.findFiles('build/tmp/work/*/base-files')
return files.length === 0
})
}).timeout(300000)
}).timeout(120000)

test('Bitbake can run from task.json', async () => {
let taskExecuted = false
Expand All @@ -68,5 +68,5 @@ suite('Bitbake Commands Test Suite', () => {

const files = await vscode.workspace.findFiles('build/tmp/work/*/base-files/*/temp/log.do_fetch')
assert.strictEqual(files.length, 1)
}).timeout(300000)
}).timeout(120000)
})
4 changes: 2 additions & 2 deletions integration-tests/src/tests/bitbake-parse.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ suite('Bitbake Parsing Test Suite', () => {

const diagnostics = vscode.languages.getDiagnostics()
assert.strictEqual(diagnostics.length, 0)
}).timeout(300000)
}).timeout(120000)

test('Bitbake can detect parsing errors', async () => {
let taskExecuted = false
Expand All @@ -87,5 +87,5 @@ suite('Bitbake Parsing Test Suite', () => {

const diagnostics = vscode.languages.getDiagnostics()
assert.strictEqual(diagnostics.length, 1)
}).timeout(300000)
}).timeout(120000)
})
4 changes: 2 additions & 2 deletions integration-tests/src/tests/command-wrapper.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ suite('Bitbake Command Wrapper', () => {
})

suiteTeardown(async function (this: Mocha.Context) {
this.timeout(300000)
this.timeout(120000)
await vscode.workspace.fs.delete(buildFolder, { recursive: true })

const bitbakeConfiguration = vscode.workspace.getConfiguration('bitbake')
Expand All @@ -67,5 +67,5 @@ suite('Bitbake Command Wrapper', () => {
)
return definitions.length === 1
})
}).timeout(300000)
}).timeout(120000)
})
6 changes: 3 additions & 3 deletions integration-tests/src/tests/completion.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,17 +47,17 @@ suite('Bitbake Completion Test Suite', () => {
const position = new vscode.Position(0, 2)
const expected = 'DESCRIPTION'
await testCompletion(position, expected)
}).timeout(300000)
}).timeout(120000)

test('Completion appears properly on embedded python', async () => {
const position = new vscode.Position(3, 6)
const expected = 'print'
await testCompletion(position, expected)
}).timeout(300000)
}).timeout(120000)

test('Completion appears properly on embedded bash', async () => {
const position = new vscode.Position(7, 6)
const expected = 'echo'
await testCompletion(position, expected)
}).timeout(300000)
}).timeout(120000)
})
10 changes: 5 additions & 5 deletions integration-tests/src/tests/hover.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,29 +46,29 @@ suite('Bitbake Hover Test Suite', () => {
const position = new vscode.Position(0, 2)
const expected = 'The package description used by package managers'
await testHover(position, expected)
}).timeout(300000)
}).timeout(120000)

test('Hover appears properly on embedded python', async () => {
const position = new vscode.Position(3, 6)
const expected = 'def print'
await testHover(position, expected)
}).timeout(300000)
}).timeout(120000)

test('Hover appears properly on embedded bash', async () => {
const position = new vscode.Position(7, 6)
const expected = 'echo'
await testHover(position, expected)
}).timeout(300000)
}).timeout(120000)

test('Hover shows Yocto task description on python function declaration', async () => {
const position = new vscode.Position(10, 9)
const expected = 'The default task for all recipes. This task depends on all other normal'
await testHover(position, expected)
}).timeout(300000)
}).timeout(120000)

test('Hover shows Yocto task description on bash function declaration', async () => {
const position = new vscode.Position(13, 1)
const expected = 'The default task for all recipes. This task depends on all other normal'
await testHover(position, expected)
}).timeout(300000)
}).timeout(120000)
})
2 changes: 1 addition & 1 deletion integration-tests/src/utils/async.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ export async function delay (ms: number): Promise<void> {
/// Asserts that the given predicate will come true within the given timeout.
/// Since we often want to test events have happened but they depend on asynchronous
/// external VSCode and extension processes, we can't listen for them directly.
export async function assertWillComeTrue (predicate: () => Promise<boolean>, timeout: number = 300000): Promise<void> {
export async function assertWillComeTrue (predicate: () => Promise<boolean>, timeout: number = 120000): Promise<void> {
const startTime = Date.now()
while (!(await predicate()) && (Date.now() - startTime < timeout)) {
await delay(100)
Expand Down

0 comments on commit ab38d2f

Please sign in to comment.