Skip to content

fix: Sketch preprocessing errors were displayed on stdout instead of stderr #2806

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
Jan 9, 2025
Merged
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
Next Next commit
Slightly refactored integration test
  • Loading branch information
cmaglie committed Jan 9, 2025
commit e22ff66a81c5d07b8d155d8e540f7a081e17295f
35 changes: 19 additions & 16 deletions internal/integrationtest/compile_3/compile_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ func TestCompilerErrOutput(t *testing.T) {
_, _, err := cli.Run("core", "install", "arduino:avr@1.8.5")
require.NoError(t, err)

{
t.Run("Diagnostics", func(t *testing.T) {
// prepare sketch
sketch, err := paths.New("testdata", "blink_with_wrong_cpp").Abs()
require.NoError(t, err)
Expand All @@ -126,10 +126,11 @@ func TestCompilerErrOutput(t *testing.T) {
"context": [ { "message": "In function 'void wrong()':" } ]
}
]`)
}
})

t.Run("PreprocessorDiagnostics", func(t *testing.T) {
// Test the preprocessor errors are present in the diagnostics

// Test the preprocessor errors are present in the diagnostics
{
// prepare sketch
sketch, err := paths.New("testdata", "blink_with_wrong_include").Abs()
require.NoError(t, err)
Expand All @@ -148,14 +149,15 @@ func TestCompilerErrOutput(t *testing.T) {
"message": "invalid preprocessing directive #wrong\n #wrong\n ^~~~~",
}
]`)
}
})

t.Run("PreprocessorDiagnosticsWithLibErrors", func(t *testing.T) {
// Test the preprocessor errors are present in the diagnostics.
// In case we have 2 libraries:
// 1. one is missing
// 2. the other one is missing only from the first GCC run
// The diagnostics should report only 1 missing library.

// Test the preprocessor errors are present in the diagnostics.
// In case we have 2 libraries:
// 1. one is missing
// 2. the other one is missing only from the first GCC run
// The diagnostics should report only 1 missing library.
{
// prepare sketch
sketch, err := paths.New("testdata", "using_Wire_with_missing_lib").Abs()
require.NoError(t, err)
Expand All @@ -175,11 +177,12 @@ func TestCompilerErrOutput(t *testing.T) {
"column": 10,
}
]`)
}
})

t.Run("LibraryDiscoverFalseErrors", func(t *testing.T) {
// Check that library discover do not generate false errors
// https://github.com/arduino/arduino-cli/issues/2263

// Check that library discover do not generate false errors
// https://github.com/arduino/arduino-cli/issues/2263
{
// prepare sketch
sketch, err := paths.New("testdata", "using_Wire").Abs()
require.NoError(t, err)
Expand All @@ -191,7 +194,7 @@ func TestCompilerErrOutput(t *testing.T) {
jsonOut.Query(".compiler_out").MustNotContain(`"fatal error"`)
jsonOut.Query(".compiler_err").MustNotContain(`"fatal error"`)
jsonOut.MustNotContain(`{ "diagnostics" : [] }`)
}
})
}

func TestCompileRelativeLibraryPath(t *testing.T) {
Expand Down
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy