|
| 1 | +// This file is part of arduino-cli. |
| 2 | +// |
| 3 | +// Copyright 2022 ARDUINO SA (http://www.arduino.cc/) |
| 4 | +// |
| 5 | +// This software is released under the GNU General Public License version 3, |
| 6 | +// which covers the main part of arduino-cli. |
| 7 | +// The terms of this license can be found at: |
| 8 | +// https://www.gnu.org/licenses/gpl-3.0.en.html |
| 9 | +// |
| 10 | +// You can be released from the requirements of the above licenses by purchasing |
| 11 | +// a commercial license. Buying such a license is mandatory if you want to |
| 12 | +// modify or otherwise use the software for commercial activities involving the |
| 13 | +// Arduino software without disclosing the source code of your own applications. |
| 14 | +// To purchase a commercial license, send an email to [email protected]. |
| 15 | + |
| 16 | +package debug_test |
| 17 | + |
| 18 | +import ( |
| 19 | + "testing" |
| 20 | + |
| 21 | + "github.com/arduino/arduino-cli/internal/integrationtest" |
| 22 | + "github.com/arduino/go-paths-helper" |
| 23 | + "github.com/stretchr/testify/require" |
| 24 | + "go.bug.st/testsuite" |
| 25 | +) |
| 26 | + |
| 27 | +func TestDebuggerStarts(t *testing.T) { |
| 28 | + env := testsuite.NewEnvironment(t) |
| 29 | + defer env.CleanUp() |
| 30 | + |
| 31 | + cli := integrationtest.NewArduinoCliWithinEnvironment(env, &integrationtest.ArduinoCLIConfig{ |
| 32 | + ArduinoCLIPath: paths.New("..", "..", "..", "arduino-cli"), |
| 33 | + UseSharedStagingFolder: true, |
| 34 | + }) |
| 35 | + |
| 36 | + // Init the environment explicitly |
| 37 | + _, _, err := cli.Run("core", "update-index") |
| 38 | + require.NoError(t, err) |
| 39 | + |
| 40 | + // Install cores |
| 41 | + _, _, err = cli.Run("core", "install", "arduino:samd") |
| 42 | + require.NoError(t, err) |
| 43 | + |
| 44 | + // Create sketch for testing |
| 45 | + sketchName := "DebuggerStartTest" |
| 46 | + sketchPath := cli.DataDir().Join(sketchName) |
| 47 | + fqbn := "arduino:samd:mkr1000" |
| 48 | + |
| 49 | + _, _, err = cli.Run("sketch", "new", sketchPath.String()) |
| 50 | + require.NoError(t, err) |
| 51 | + |
| 52 | + // Build sketch |
| 53 | + _, _, err = cli.Run("compile", "-b", fqbn, sketchPath.String()) |
| 54 | + require.NoError(t, err) |
| 55 | + |
| 56 | + programmer := "atmel_ice" |
| 57 | + // Starts debugger |
| 58 | + _, _, err = cli.Run("debug", "-b", fqbn, "-P", programmer, sketchPath.String(), "--info") |
| 59 | + require.NoError(t, err) |
| 60 | +} |
0 commit comments