Skip to content
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

upgrade arduino in CI #7716

Merged
merged 5 commits into from
Dec 31, 2020
Merged

upgrade arduino in CI #7716

merged 5 commits into from
Dec 31, 2020

Conversation

d-a-v
Copy link
Collaborator

@d-a-v d-a-v commented Nov 21, 2020

No description provided.

@earlephilhower
Copy link
Collaborator

Wow, looks like the go used in Arduino really doesn't like GH's CI system. Geez...

panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x0 pc=0x9122c5]

goroutine 1 [running]:

Maybe the Arduino-Tools or whatever has a CI on GH we can steal some bits from?

@earlephilhower
Copy link
Collaborator

FWIW, .13 crashes in the same way on my own Ubuntu 18.04 updated system. Arduino IDE at .13 run in interactive mode can build the same sketch this fails on. Very strange.

Judging by the error, might be related to the build cache system. I remember submitting an issue there a long time ago, something about pruning the paths or something...

 ------------ Building /tmp/ci/libraries/ArduinoOTA/examples/BasicOTA/BasicOTA.ino ------------ 

python3 tools/build.py -b generic -v -w all -s 4M1M -v -k --build_cache /tmp/tmp.TKTp7BB551 -p ./build.tmp -n lm2f -l /tmp/ci/Arduino/libraries  --waveform_phase /tmp/ci/libraries/ArduinoOTA/examples/BasicOTA/BasicOTA.ino

real	0m42.913s
user	2m13.362s
sys	0m9.936s

 ------------ Building /tmp/ci/libraries/ArduinoOTA/examples/OTALeds/OTALeds.ino ------------ 

python3 tools/build.py -b generic -v -w all -s 4M1M -v -k --build_cache /tmp/tmp.TKTp7BB551 -p ./build.tmp -n lm2f -l /tmp/ci/Arduino/libraries  --waveform_phase /tmp/ci/libraries/ArduinoOTA/examples/OTALeds/OTALeds.ino

real	0m0.159s
user	0m0.125s
sys	0m0.032s
Build failed (/tmp/ci/arduino_ide)
Build log:
Using board 'generic' from platform in folder: /tmp/ci/arduino_ide/hardware/esp8266com/esp8266
Using core 'esp8266' from platform in folder: /tmp/ci/arduino_ide/hardware/esp8266com/esp8266
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x0 pc=0xa8bc72]

goroutine 1 [running]:
github.com/arduino/go-properties-orderedmap.(*Map).Get(...)
	/home/jenkins/workspace/arduino-builder-all-cross-cli-inception/src/github.com/arduino/go-properties-orderedmap/properties.go:214
github.com/arduino/arduino-cli/legacy/builder.(*WipeoutBuildPathIfBuildOptionsChanged).Run(0x128adb8, 0xc0001f4800, 0x128adb8, 0x0)
	/home/jenkins/workspace/arduino-builder-all-cross-cli-inception/src/github.com/arduino/arduino-cli/legacy/builder/wipeout_build_path_if_build_options_changed.go:45 +0x1e2
github.com/arduino/arduino-cli/legacy/builder.(*ContainerBuildOptions).Run(0x128adb8, 0xc0001f4800, 0x128adb8, 0x0)
	/home/jenkins/workspace/arduino-builder-all-cross-cli-inception/src/github.com/arduino/arduino-cli/legacy/builder/container_build_options.go:35 +0x121
github.com/arduino/arduino-cli/legacy/builder.runCommands(0xc0001f4800, 0xc00008bbd8, 0x20, 0x20, 0x0, 0x0)
	/home/jenkins/workspace/arduino-builder-all-cross-cli-inception/src/github.com/arduino/arduino-cli/legacy/builder/builder.go:192 +0x174
github.com/arduino/arduino-cli/legacy/builder.(*Builder).Run(0xc000243e3e, 0xc0001f4800, 0x128ac78, 0xc00039c3d0)
	/home/jenkins/workspace/arduino-builder-all-cross-cli-inception/src/github.com/arduino/arduino-cli/legacy/builder/builder.go:102 +0x951
github.com/arduino/arduino-cli/legacy/builder.RunBuilder(...)
	/home/jenkins/workspace/arduino-builder-all-cross-cli-inception/src/github.com/arduino/arduino-cli/legacy/builder/builder.go:210
main.main()
	/home/jenkins/workspace/arduino-builder-all-cross-cli-inception/src/github.com/arduino/arduino-builder/main.go:400 +0x866
Sketch:  /tmp/ci/libraries/ArduinoOTA/examples/OTALeds/OTALeds.ino
Build dir:  ./build.tmp
Cache dir:  /tmp/tmp.TKTp7BB551
Output:  ./build.tmp/OTALeds.ino.bin
Building: /tmp/ci/arduino_ide/arduino-builder -compile -logger=human -build-path ./build.tmp -tools /tmp/ci/arduino_ide/tools-builder -build-cache /tmp/tmp.TKTp7BB551 -libraries /tmp/ci/Arduino/libraries -hardware /tmp/ci/arduino_ide/hardware -hardware /tmp/ci/tools/../cores -fqbn=esp8266com:esp8266:generic:xtal=80,FlashFreq=40,FlashMode=qio,baud=921600,eesz=4M1M,ip=lm2f,ResetMethod=nodemcu,waveform=phase -built-in-libraries /tmp/ci/arduino_ide/libraries -ide-version=10607 -warnings=all -verbose /tmp/ci/libraries/ArduinoOTA/examples/OTALeds/OTALeds.ino

@per1234
Copy link
Contributor

per1234 commented Dec 31, 2020

The cause of the panic is that the sed command in tests/common.sh assumes the sketchLocation key will not be last in the build.options.json object:

sed -i "s,^.*sketchLocation.*$, \"sketchLocation\": \"$sketch\"\,,g" $build_dir/build.options.json

With Arduino IDE 1.8.10, that assumption worked out due to the presence of the toolsFolders key, but that key was apparently removed between the versions of arduino-builder used by Arduino IDE 1.8.10 and 1.8.11, resulting in the sketchLocation key being last. The trailing comma added by the sed command results in invalid JSON:

build.options.json before the sed command:

{
  "additionalFiles": "",
  "builtInLibrariesFolders": "/home/runner/arduino_ide/libraries",
  "builtInToolsFolders": "/home/runner/arduino_ide/tools-builder",
  "compiler.optimization_flags": "",
  "customBuildProperties": "",
  "fqbn": "esp8266com:esp8266:generic:xtal=80,FlashFreq=40,FlashMode=qio,baud=921600,eesz=4M1M,ip=lm2f,ResetMethod=nodemcu,waveform=phase",
  "hardwareFolders": "/home/runner/arduino_ide/hardware,/home/runner/work/Arduino/Arduino/cores",
  "otherLibrariesFolders": "/home/runner/Arduino/libraries",
  "runtime.ide.version": "10607",
  "sketchLocation": "/home/runner/work/Arduino/Arduino/libraries/DNSServer/examples/DNSServer/DNSServer.ino"
}

build.options.json after the sed command:

{
  "additionalFiles": "",
  "builtInLibrariesFolders": "/home/runner/arduino_ide/libraries",
  "builtInToolsFolders": "/home/runner/arduino_ide/tools-builder",
  "compiler.optimization_flags": "",
  "customBuildProperties": "",
  "fqbn": "esp8266com:esp8266:generic:xtal=80,FlashFreq=40,FlashMode=qio,baud=921600,eesz=4M1M,ip=lm2f,ResetMethod=nodemcu,waveform=phase",
  "hardwareFolders": "/home/runner/arduino_ide/hardware,/home/runner/work/Arduino/Arduino/cores",
  "otherLibrariesFolders": "/home/runner/Arduino/libraries",
  "runtime.ide.version": "10607",
 "sketchLocation": "/home/runner/work/Arduino/Arduino/libraries/ESP8266HTTPClient/examples/DigestAuthorization/DigestAuthorization.ino",
}

I think Matthijs's suggestion from arduino/arduino-cli#1118 (comment) of using jq is the best approach to making the fix robust.

@earlephilhower
Copy link
Collaborator

@d-a-v, suggest (untested, but individual jq command worked in the CLI for me):

- sed -i "s,^.*sketchLocation.*$, \"sketchLocation\": \"$sketch\"\,,g" $build_dir/build.options.json 
+ jq '."sketchLocation" = "'$sketch'"' $build_dir/build.options.json > $build_dir/build.options.json.tmp
+ mv $build_dir/build.options.json.tmp $build_dir/build.options.json

@d-a-v
Copy link
Collaborator Author

d-a-v commented Dec 31, 2020

arduino-latest is now used again in CI, thanks to Arduino folks (@matthijskooijman, @per1234) and @earlephilhower !

@d-a-v d-a-v merged commit 5b42e73 into esp8266:master Dec 31, 2020
@d-a-v d-a-v deleted the arduinoVersionInCI branch December 31, 2020 22:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants