Skip to content

Commit

Permalink
[cbuild] Increase test coverage
Browse files Browse the repository at this point in the history
  • Loading branch information
brondani committed Jun 26, 2024
1 parent 52414f6 commit c3a618b
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 1 deletion.
15 changes: 15 additions & 0 deletions pkg/builder/cbuildidx/builder_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -342,3 +342,18 @@ func TestValidateNinjaVersion(t *testing.T) {
assert.False(output)
})
}

func TestHasExecutes(t *testing.T) {
assert := assert.New(t)

b := CbuildIdxBuilder{
builder.BuilderParams{
Runner: RunnerMock{},
InputFile: filepath.Join(testRoot, testDir, "Test.cbuild-idx.yml"),
},
}

t.Run("validate solution has executes nodes", func(t *testing.T) {
assert.True(b.HasExecutes())
})
}
8 changes: 7 additions & 1 deletion pkg/builder/csolution/builder_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -262,11 +262,17 @@ func TestBuild(t *testing.T) {
})

t.Run("test build csolution using cbuild2cmake", func(t *testing.T) {
b.Options.Contexts = []string{"test.Debug+CM0"}
b.Options.Contexts = []string{}
b.Options.UseCbuild2CMake = true
err := b.Build()
assert.Error(err)
})

t.Run("test build csolution with target option", func(t *testing.T) {
b.Options.Target = "CMakeTarget"
err := b.Build()
assert.Error(err)
})
}

func TestRebuild(t *testing.T) {
Expand Down
3 changes: 3 additions & 0 deletions test/data/Test.cbuild-idx.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,6 @@ build-idx:
- cbuild: cm4/HelloWorld_cm4.Release+FRDM-K32L3A6.cbuild.yml
project: HelloWorld_cm4
configuration: .Release+FRDM-K32L3A6
executes:
- execute: Test
run: ${CMAKE_COMMAND} -E echo "Test"

0 comments on commit c3a618b

Please sign in to comment.