@@ -57,7 +57,6 @@ def test_compile_with_simple_sketch(run_command, data_dir):
57
57
58
58
@pytest .mark .skipif (running_on_ci (), reason = "VMs have no serial ports" )
59
59
def test_compile_and_compile_combo (run_command , data_dir ):
60
-
61
60
# Init the environment explicitly
62
61
result = run_command ("core update-index" )
63
62
assert result .ok
@@ -68,7 +67,8 @@ def test_compile_and_compile_combo(run_command, data_dir):
68
67
assert result .ok
69
68
70
69
# Create a test sketch
71
- sketch_path = os .path .join (data_dir , "CompileAndUploadIntegrationTest" )
70
+ sketch_name = "CompileAndUploadIntegrationTest"
71
+ sketch_path = os .path .join (data_dir , sketch_name )
72
72
result = run_command ("sketch new CompileAndUploadIntegrationTest" )
73
73
assert result .ok
74
74
assert "Sketch created in: {}" .format (sketch_path ) in result .stdout
@@ -96,7 +96,7 @@ def test_compile_and_compile_combo(run_command, data_dir):
96
96
# }
97
97
# ]
98
98
99
- detected_boards = []
99
+ detected_boards = []
100
100
101
101
ports = json .loads (result .stdout )
102
102
assert isinstance (ports , list )
@@ -109,12 +109,21 @@ def test_compile_and_compile_combo(run_command, data_dir):
109
109
assert len (detected_boards ) >= 1 , "There are no boards available for testing"
110
110
111
111
# Build sketch for each detected board
112
- for board in detected_boards :
112
+ for board in detected_boards :
113
+ log_file = "compile.log"
113
114
result = run_command (
114
- "compile -b {fqbn} --upload -p {address} {sketch_path}" .format (
115
+ "compile -b {fqbn} --upload -p {address} {sketch_path} --log-format json --log-file {log_file} --log-level trace " .format (
115
116
fqbn = board .get ('fqbn' ),
116
117
address = board .get ('address' ),
117
- sketch_path = sketch_path )
118
+ sketch_path = sketch_path ,
119
+ log_file = log_file
120
+ )
118
121
)
122
+ log_json = open (log_file ,'r' )
123
+ log_json_lines = log_json .readlines ()
124
+ assert is_value_in_any_json_log_message ("copying sketch build output" ,log_json_lines )
125
+ assert is_value_in_any_json_log_message ("Executing `arduino upload`" ,log_json_lines )
119
126
assert result .ok
120
- assert "Verify successful" in result .stdout
127
+
128
+ def is_value_in_any_json_log_message (value ,log_json_lines ):
129
+ return bool ([index for index , line in enumerate (log_json_lines ) if json .loads (line ).get ("msg" ) == value ])
0 commit comments