Skip to content

bugfix: compile ... --dump-profile now produces a clean output #2852

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Feb 28, 2025
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
Prev Previous commit
Added integration test
  • Loading branch information
cmaglie committed Feb 27, 2025
commit 0c79a9825abddc779a797d17e5f9024debeaf201
71 changes: 71 additions & 0 deletions internal/integrationtest/compile_4/dump_profile_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
// This file is part of arduino-cli.
//
// Copyright 2023 ARDUINO SA (http://www.arduino.cc/)
//
// This software is released under the GNU General Public License version 3,
// which covers the main part of arduino-cli.
// The terms of this license can be found at:
// https://www.gnu.org/licenses/gpl-3.0.en.html
//
// You can be released from the requirements of the above licenses by purchasing
// a commercial license. Buying such a license is mandatory if you want to
// modify or otherwise use the software for commercial activities involving the
// Arduino software without disclosing the source code of your own applications.
// To purchase a commercial license, send an email to license@arduino.cc.

package compile_test

import (
"strings"
"testing"

"github.com/arduino/arduino-cli/internal/integrationtest"
"github.com/arduino/go-paths-helper"
"github.com/stretchr/testify/require"
)

func TestDumpProfileClean(t *testing.T) {
env, cli := integrationtest.CreateArduinoCLIWithEnvironment(t)
t.Cleanup(env.CleanUp)

// Install Arduino AVR Boards
_, _, err := cli.Run("core", "install", "arduino:avr@1.8.6")
require.NoError(t, err)

validSketchPath, err := paths.New("testdata", "ValidSketch").Abs()
require.NoError(t, err)
invalidSketchPath, err := paths.New("testdata", "InvalidSketch").Abs()
require.NoError(t, err)

validProfile := `profiles:
uno:
fqbn: arduino:avr:uno
platforms:
- platform: arduino:avr (1.8.6)`
t.Run("NoVerbose", func(t *testing.T) {
stdout, stderr, err := cli.Run("compile", "-b", "arduino:avr:uno", validSketchPath.String(), "--dump-profile")
require.NoError(t, err)
require.Empty(t, stderr)
profile := strings.TrimSpace(string(stdout))
require.Equal(t, validProfile, profile)
})
t.Run("Verbose", func(t *testing.T) {
stdout, stderr, err := cli.Run("compile", "-b", "arduino:avr:uno", validSketchPath.String(), "--dump-profile", "--verbose")
require.NoError(t, err)
require.Empty(t, stderr)
profile := strings.TrimSpace(string(stdout))
require.Equal(t, validProfile, profile)
})
t.Run("ErrorNoVerbose", func(t *testing.T) {
stdout, stderr, err := cli.Run("compile", "-b", "arduino:avr:uno", invalidSketchPath.String(), "--dump-profile")
require.Error(t, err)
require.NotEmpty(t, stderr)
require.NotContains(t, string(stdout), validProfile)
})
t.Run("ErrorVerbose", func(t *testing.T) {
stdout, stderr, err := cli.Run("compile", "-b", "arduino:avr:uno", invalidSketchPath.String(), "--dump-profile", "--verbose")
require.Error(t, err)
require.NotEmpty(t, stderr)
require.NotContains(t, string(stdout), validProfile)
})
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
void setup() {}
void loop() {}
aaaaaa
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
void setup() {}
void loop() {}