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

CI: test running the built avrdude executable #1888

Merged
merged 6 commits into from
Aug 24, 2024

Conversation

ndim
Copy link
Contributor

@ndim ndim commented Aug 14, 2024

This PR tries to fix #1884.

As described in #1884 (comment), the goal is to make sure that all builds run the tools/test-avrdude script, and that the tools/test-avrdude script fails if running avrdude fails.

Then the problems with the macos automake builds might become visible, which in turn would allow fixing them.

Starting as a draft PR until it is ready to be merged.

@mcuee mcuee added the enhancement New feature or request label Aug 14, 2024
@ndim ndim force-pushed the ci-test-running-built-avrdude branch 3 times, most recently from 26f9f29 to 988642e Compare August 14, 2024 14:59
@ndim
Copy link
Contributor Author

ndim commented Aug 14, 2024

A few things which turned up:

  • Apparently, some problems go away by not building the shared library and using static linking.
  • Apparently, "make distcheck" will not work until some work is done on the doc building (will be a separate PR).
  • Apparently, cmake/msvc installs on Windows fail due to some swig_XYZ.vcxproj file requiring and not finding a python312_d.lib file.
  • Apparently, the powershell command to pipe two newline characters into tools/test-avrdude is non-trivial and therefore does not work yet

@ndim ndim force-pushed the ci-test-running-built-avrdude branch from d4da86f to 4331743 Compare August 14, 2024 21:21
@ndim ndim force-pushed the ci-test-running-built-avrdude branch 2 times, most recently from 70b1024 to ada1c9d Compare August 15, 2024 17:34
@ndim ndim force-pushed the ci-test-running-built-avrdude branch 5 times, most recently from 7c56a70 to c3f387a Compare August 19, 2024 00:38
@ndim
Copy link
Contributor Author

ndim commented Aug 19, 2024

So I tried to reproduce MacOS build problems here.

As it turns out, the macos builds (both cmake and automake) succeed and test-avrdude runs for both builds, both before and after installing. A few env vars need to be set, and that should be documented somewhere, or incorporated directly into the respective logic as a macos default.

The actual problems turn out to be msvc+cmake (fails to install due to missing python dependency) and mingw (test-avrdude cannot write files to temp directory).

@stefanrueger
Copy link
Collaborator

Great finds. Will this PR, as a byproduct, run test-avrdude on most/all systems the CI builds avrdude for. Would be great!

test-avrdude cannot write files to temp directory

Try adding -t . to set the temporary directory to current dir (where hopefully you can write)

@ndim
Copy link
Contributor Author

ndim commented Aug 19, 2024

Great finds. Will this PR, as a byproduct, run test-avrdude on most/all systems the CI builds avrdude for. Would be great!

This PR runs test-avrdude with the newly built but not yet installed avrdude on all possible systems (native Linux, Macos, Windows, i.e. not on the cross-compiles). That is successful everywhere but on msys2/mingw (see temp dir issue below).

This PR also installs avrdude and runs test-avrdude with that installed avrdude. That only works on Linux and Macos, though. Installing msvc builds fails because installing needs a python312_d.lib file it does not find. Did not try testing the installed avrdude with mingw because temp dir issue running the not yet installed avrdude below cannot even run the uninstalled avrdude.

test-avrdude cannot write files to temp directory

Try adding -t . to set the temporary directory to current dir (where hopefully you can write)

That is the weird part, which got me stuck.

I use -t to work around the default tmp value /dev/shm/ being absolutely useless on any non Linux system. On msys2 with the mingw builds, the avrdude process launched by test-avrdude reproducibly cannot write/read its temp file at certain places inside test-avrdude. I have tried both the default $TEMP and a newly created directory $PWD/tmp123 where I can always successfully test write and read a file.

@mcuee
Copy link
Collaborator

mcuee commented Aug 19, 2024

The actual problems turn out to be msvc+cmake (fails to install due to missing python dependency) and mingw (test-avrdude cannot write files to temp directory).

I think we can skip this one (MSVC +CMake).

@mcuee
Copy link
Collaborator

mcuee commented Aug 19, 2024

With regard to Python and SWIG dependancy, we may want to install them explicitly in CI, at least for Linux and macOS.

PR #1714 only installed them on Msys2-mingw64.
https://github.com/avrdudes/avrdude/pull/1714/files#diff-5c3fa597431eda03ac3339ae6bf7f05e1a50d6fc7333679ec38e21b337cb6721

Somehow last time when @dl8dtl and I tested the PR #1714, only Windows on ARM64 does not have Python installed. That is why PR #1714 actually disables Windows on ARM64 build (with MSVC + CMake).

@ndim ndim force-pushed the ci-test-running-built-avrdude branch from b2409ed to 6c3a55d Compare August 19, 2024 13:04
@mcuee
Copy link
Collaborator

mcuee commented Aug 19, 2024

@ndim

You can not use the following method to install avrdude for homebrew under macOS. The following may actually break the system.

      - name: Install
        run: sudo make -C _ambuild install
      - name: "Dryrun test (installed)"
        run: >-
          export DYLD_LIBRARY_PATH=/usr/local/lib

I am not so sure how homebrew does it though.
https://github.com/Homebrew/homebrew-core/blob/01583fcafcb4b47f0301e37f6901e33391788a1d/Formula/a/avrdude.rb
https://github.com/avrdudes/avrdude/wiki/Building-AVRDUDE-for-macOS#installation-of-git-main-for-homebrew

@ndim
Copy link
Contributor Author

ndim commented Aug 19, 2024

@ndim

You can not use the following method to install avrdude for homebrew under macOS. The following may actually break the system.

      - name: Install
        run: sudo make -C _ambuild install
      - name: "Dryrun test (installed)"
        run: >-
          export DYLD_LIBRARY_PATH=/usr/local/lib

For testing that the installed avrdude runs, it is not important where it is installed, just that it is installed. And whether the system may break later does not matter in a GitHub worker VM image which is thrown away seconds later.

I can use configure --prefix=$HOME/.local and set DYLD_LIBRARY_PATH=$HOME/.local/lib if that helps, or use a well-known MacOS specific location if such a thing exists and someone points me to that.

I am not so sure how homebrew does it though. https://github.com/Homebrew/homebrew-core/blob/01583fcafcb4b47f0301e37f6901e33391788a1d/Formula/a/avrdude.rb https://github.com/avrdudes/avrdude/wiki/Building-AVRDUDE-for-macOS#installation-of-git-main-for-homebrew

homebrew uses whatever std_cmake_args contains.

@mcuee
Copy link
Collaborator

mcuee commented Aug 19, 2024

For testing that the installed avrdude runs, it is not important where it is installed, just that it is installed. And whether the system may break later does not matter in a GitHub worker VM image which is thrown away seconds later.

I can use configure --prefix=$HOME/.local and set DYLD_LIBRARY_PATH=$HOME/.local/lib if that helps, or use a well-known MacOS specific location if such a thing exists and someone points me to that.

I understand.

Still probably you can use $(brew --prefix) which is a bit better, even though it is still not really correct.

@ndim ndim force-pushed the ci-test-running-built-avrdude branch 4 times, most recently from 4a183e8 to fbe0201 Compare August 19, 2024 14:00
@mcuee
Copy link
Collaborator

mcuee commented Aug 19, 2024

Example how I test under Windows.

Build log with MinGW with Python/Swig for reference as well.

MINGW64 /c/work/avr/avrdude_test/avrdude_main
$ ./build.sh
-- Building for: Ninja
-- The C compiler identification is GNU 13.2.0
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: C:/msys64/mingw64/bin/cc.exe - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Found Git: C:/msys64/usr/bin/git.exe (found version "2.43.0")
-- Found FLEX: C:/msys64/usr/bin/flex.exe (found version "2.6.4")
-- Found BISON: C:/msys64/usr/bin/bison.exe (found version "3.8.2")
-- Looking for libelf.h
-- Looking for libelf.h - found
-- Looking for libelf/libelf.h
-- Looking for libelf/libelf.h - found
-- Looking for usb.h
-- Looking for usb.h - not found
-- Looking for lusb0_usb.h
-- Looking for lusb0_usb.h - found
-- Looking for libusb.h
-- Looking for libusb.h - not found
-- Looking for libusb-1.0/libusb.h
-- Looking for libusb-1.0/libusb.h - found
-- Looking for hidapi/hidapi.h
-- Looking for hidapi/hidapi.h - found
-- Looking for ftdi_tcioflush
-- Looking for ftdi_tcioflush - found
-- Found SWIG: C:/msys64/mingw64/bin/swig.exe (found suitable version "4.1.1", minimum required is "4.0") found components: python
-- Found Python3: C:/Users/xiaof/AppData/Local/Programs/Python/Python312/python.exe (found version "3.12.2") found components: Interpreter Development Development.Module Development.Embed
-- Configuration summary:
-- ----------------------
-- DO HAVE    libelf
-- DO HAVE    libusb
-- DO HAVE    libusb_1_0
-- DO HAVE    libhidapi
-- DON'T HAVE libftdi
-- DO HAVE    libftdi1
-- DO HAVE    libreadline
-- DO HAVE    libserialport
-- DISABLED   doc
-- DISABLED   parport
-- DISABLED   linuxgpio
-- DISABLED   linuxspi
-- DO HAVE    swig+Python3
-- ----------------------
-- Configuring done (10.5s)
-- Generating done (0.0s)
-- Build files have been written to: C:/work/avr/avrdude_test/avrdude_main/build_mingw64_nt-10.0-22631
[117/158] Building C object src/CMakeFiles/swig_avrdude.dir/CMakeFiles/swig_avrdude.dir/libavrdudePYTHON_wrap.c.obj
C:/work/avr/avrdude_test/avrdude_main/build_mingw64_nt-10.0-22631/src/CMakeFiles/swig_avrdude.dir/libavrdudePYTHON_wrap.c: In function 'swig_varlink_type':
C:/work/avr/avrdude_test/avrdude_main/build_mingw64_nt-10.0-22631/src/CMakeFiles/swig_avrdude.dir/libavrdudePYTHON_wrap.c:1454:5: warning: missing initializer for field 'tp_watched' of 'PyTypeObject' {aka 'const struct _typeobject'} [-Wmissing-field-initializers]
 1454 |     };
      |     ^
In file included from C:/Users/xiaof/AppData/Local/Programs/Python/Python312/include/object.h:954,
                 from C:/Users/xiaof/AppData/Local/Programs/Python/Python312/include/Python.h:44,
                 from C:/work/avr/avrdude_test/avrdude_main/build_mingw64_nt-10.0-22631/src/CMakeFiles/swig_avrdude.dir/libavrdudePYTHON_wrap.c:168:
C:/Users/xiaof/AppData/Local/Programs/Python/Python312/include/cpython/object.h:230:19: note: 'tp_watched' declared here
  230 |     unsigned char tp_watched;
      |                   ^~~~~~~~~~
C:/work/avr/avrdude_test/avrdude_main/build_mingw64_nt-10.0-22631/src/CMakeFiles/swig_avrdude.dir/libavrdudePYTHON_wrap.c: In function 'SwigPyObject_TypeOnce':
C:/work/avr/avrdude_test/avrdude_main/build_mingw64_nt-10.0-22631/src/CMakeFiles/swig_avrdude.dir/libavrdudePYTHON_wrap.c:2048:5: warning: missing initializer for field 'tp_watched' of 'PyTypeObject' {aka 'const struct _typeobject'} [-Wmissing-field-initializers]
 2048 |     };
      |     ^
C:/Users/xiaof/AppData/Local/Programs/Python/Python312/include/cpython/object.h:230:19: note: 'tp_watched' declared here
  230 |     unsigned char tp_watched;
      |                   ^~~~~~~~~~
C:/work/avr/avrdude_test/avrdude_main/build_mingw64_nt-10.0-22631/src/CMakeFiles/swig_avrdude.dir/libavrdudePYTHON_wrap.c: In function 'SwigPyPacked_TypeOnce':
C:/work/avr/avrdude_test/avrdude_main/build_mingw64_nt-10.0-22631/src/CMakeFiles/swig_avrdude.dir/libavrdudePYTHON_wrap.c:2228:5: warning: missing initializer for field 'tp_watched' of 'PyTypeObject' {aka 'const struct _typeobject'} [-Wmissing-field-initializers]
 2228 |     };
      |     ^
C:/Users/xiaof/AppData/Local/Programs/Python/Python312/include/cpython/object.h:230:19: note: 'tp_watched' declared here
  230 |     unsigned char tp_watched;
      |                   ^~~~~~~~~~
[158/158] Linking C shared module src\_swig_avrdude.pyd

Build succeeded.

Run

sudo cmake --build build_mingw64_nt-10.0-22631 --target install

to install.

Using test-avrdude scrpt.

$ cd tools/
$ ./test-avrdude -e ../build_mingw64_nt-10.0-22631/src/avrdude.exe -t . -d 0 -p "-c usbasp -p m328pb"
Testing ../build_mingw64_nt-10.0-22631/src/avrdude.exe 7.3-20240819 (1fe0857e)
Prepare "-c usbasp -p m328pb" and press 'enter' or 'space' to continue. Press any other key to skip
✅   0.293 s: fuse access: clear, set and read eesave fuse bit
✅   0.285 s: fuse access: set eesave fusebit to delete EEPROM on chip erase
✅   0.503 s: chip erase
✅   2.461 s: flash -U write/verify holes_rjmp_loops_32768B.hex
✅   1.184 s: flash -T write/verify holes_rjmp_loops_32768B.hex
✅   0.377 s: eeprom check whether programmer can flip 0s to 1s
✅   3.155 s: eeprom -U write/verify holes_pack_my_box_1024B.hex
✅   6.168 s: eeprom -T write/verify holes_{the_five_boxing_wizards,pack_my_box}_1024B.hex
✅   1.410 s: chip erase and spot check flash is actually erased
✅   0.378 s: spot check eeprom is erased, too

@mcuee
Copy link
Collaborator

mcuee commented Aug 22, 2024

Build log for macOS auto-tools with SWIG and Python.

@mcuee
Copy link
Collaborator

mcuee commented Aug 22, 2024

Build log with CMake, VS2022, Python and Swig under Windows 11.

There is a bit of issue that the produced avrdude.exe and avrdude.conf are located in two different directory.

Build log
PS C:\work\avr\avrdude_test\avrdude_main> cat .\build_msvc.cmd
cmake -D DEBUG_CMAKE=1 -D CMAKE_SYSTEM_VERSION=11  -D USE_EXTERNAL_LIBS=1 -B build_msvc

cmake --build build_msvc --config RelWithDebInfo
PS C:\work\avr\avrdude_test\avrdude_main> .\build_msvc.cmd

C:\work\avr\avrdude_test\avrdude_main>cmake -D DEBUG_CMAKE=1 -D CMAKE_SYSTEM_VERSION=11  -D USE_EXTERNAL_LIBS=1 -B build_msvc
-- Building for: Visual Studio 17 2022
-- Selecting Windows SDK version 10.0.22621.0 to target Windows 11.
-- The C compiler identification is MSVC 19.38.33135.0
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: C:/Program Files/Microsoft Visual Studio/2022/Community/VC/Tools/MSVC/14.38.33130/bin/Hostx64/x64/cl.exe - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Found Git: C:/Program Files/Git/cmd/git.exe (found version "2.39.1.windows.1")
-- Found FLEX: C:/ProgramData/chocolatey/bin/win_flex.exe (found version "2.6.3")
-- Found BISON: C:/ProgramData/chocolatey/bin/win_bison.exe (found version "2.7")
-- Found SWIG: C:/work/python/swigwin-4.2.1/swig.exe (found suitable version "4.2.1", minimum required is "4.0") found components: python
-- Found Python3: C:/Users/xiaof/AppData/Local/Programs/Python/Python312/python.exe (found version "3.12.2") found components: Interpreter Development Development.Module Development.Embed
-- Fetching external libraries, please wait...
-- The CXX compiler identification is MSVC 19.38.33135.0
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: C:/Program Files/Microsoft Visual Studio/2022/Community/VC/Tools/MSVC/14.38.33130/bin/Hostx64/x64/cl.exe - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Using external library 'libelf'
-- Using external library 'libusb'
-- Using external library 'libhidapi'
-- Using external library 'libftdi'
-- Configuration summary:
-- ----------------------
-- CMAKE_HOST_SYSTEM: Windows-10.0.22631
-- CMAKE_SYSTEM: Windows-11
-- CMAKE_FIND_ROOT_PATH:
-- CMAKE_C_COMPILER: C:/Program Files/Microsoft Visual Studio/2022/Community/VC/Tools/MSVC/14.38.33130/bin/Hostx64/x64/cl.exe
-- CONFIG_DIR: C:/Program Files (x86)/avrdude/etc
-- AVRDUDE_FULL_VERSION: 7.3-20240822 (a9594622)
-- USE_EXTERNAL_LIBS: 1
-- USE_LIBUSBWIN32: OFF
-- HAVE_LIBELF: 1
-- HAVE_LIBUSB: 1
-- HAVE_LIBUSB_1_0: HAVE_LIBUSB_1_0-NOTFOUND
-- HAVE_LIBUSB_WIN32: HAVE_LIBUSB_WIN32-NOTFOUND
-- HAVE_LIBHIDAPI: 1
-- HAVE_LIBFTDI: 1
-- HAVE_LIBFTDI1: HAVE_LIBFTDI1-NOTFOUND
-- HAVE_LIBREADLINE: 1
-- HAVE_LIBSERIALPORT: HAVE_LIBSERIALPORT-NOTFOUND
-- HAVE_LIBELF_H: 1
-- HAVE_LIBELF_LIBELF_H:
-- HAVE_USB_H:
-- HAVE_LUSB0_USB_H: 1
-- HAVE_LIBUSB_H:
-- HAVE_LIBUSB_1_0_LIBUSB_H:
-- HAVE_HIDAPI_HIDAPI_H: 1
-- LIBUSB_COMPAT_DIR:
-- LIBGPIODV2_FOUND:
-- LIBGPIODV1_6_FOUND:
-- LIBGPIOD_FOUND:
-- ----------------------
-- DO HAVE    libelf
-- DO HAVE    libusb
-- DON'T HAVE libusb_1_0
-- DO HAVE    libhidapi
-- DO HAVE    libftdi
-- DON'T HAVE libftdi1
-- DO HAVE    libreadline
-- DON'T HAVE libserialport
-- DISABLED   doc
-- DISABLED   parport
-- DISABLED   linuxgpio
-- DISABLED   linuxspi
-- DO HAVE    swig+Python3
-- ----------------------
-- Configuring done (22.6s)
-- Generating done (0.1s)
-- Build files have been written to: C:/work/avr/avrdude_test/avrdude_main/build_msvc

C:\work\avr\avrdude_test\avrdude_main>cmake --build build_msvc --config RelWithDebInfo
MSBuild version 17.8.5+b5265ef37 for .NET Framework

  1>Checking Build System
  Generating avrdude.conf
  Building Custom Rule C:/work/avr/avrdude_test/avrdude_main/src/CMakeLists.txt
  Building Custom Rule C:/work/avr/avrdude_test/avrdude_main/build_msvc/_deps/libelf-src/CMakeLists.txt
  32.fsize.c
  32.getehdr.c
  32.getphdr.c
  32.getshdr.c
  32.newehdr.c
  32.newphdr.c
  32.xlatetof.c
  64.xlatetof.c
  assert.c
  begin.c
  checksum.c
  cntl.c
  cook.c
  data.c
  end.c
  errmsg.c
  errno.c
  fill.c
  flag.c
  gelfehdr.c
  Generating Code...
  Compiling...
  gelfphdr.c
  gelfshdr.c
  gelftrans.c
  getarhdr.c
  getaroff.c
  getarsym.c
  getbase.c
  getdata.c
  getident.c
  getscn.c
  hash.c
  input.c
  kind.c
  memset.c
  ndxscn.c
  newdata.c
  newscn.c
  next.c
  nextscn.c
  nlist.c
  Generating Code...
  Compiling...
  opt.delscn.c
  rand.c
  rawdata.c
  rawfile.c
  strptr.c
  swap64.c
  update.c
  verdef_32_tof.c
  verdef_32_tom.c
  verdef_64_tof.c
  verdef_64_tom.c
  version.c
  x.elfext.c
  x.movscn.c
  x.remscn.c
  Generating Code...
  libelf.vcxproj -> C:\work\avr\avrdude_test\avrdude_main\build_msvc\_deps\libelf-build\RelWithDebInfo\libelf.lib
  Building Custom Rule C:/work/avr/avrdude_test/avrdude_main/build_msvc/_deps/libftdi-src/CMakeLists.txt
  ftdi.cpp
  libftdi.vcxproj -> C:\work\avr\avrdude_test\avrdude_main\build_msvc\_deps\libftdi-build\RelWithDebInfo\libftdi.lib
  Building Custom Rule C:/work/avr/avrdude_test/avrdude_main/build_msvc/_deps/libhidapi-src/CMakeLists.txt
  hid.c
  libhidapi.vcxproj -> C:\work\avr\avrdude_test\avrdude_main\build_msvc\_deps\libhidapi-build\RelWithDebInfo\libhidapi.
  lib
  Building Custom Rule C:/work/avr/avrdude_test/avrdude_main/build_msvc/_deps/libusb-src/CMakeLists.txt
  descriptors.c
  error.c
  registry.c
  usb.c
  Generating Code...
  windows.cpp
  libusb.vcxproj -> C:\work\avr\avrdude_test\avrdude_main\build_msvc\_deps\libusb-build\RelWithDebInfo\libusb.lib
  Swig compile libavrdude.i for python
  [FLEX][Parser] Building scanner with win_flex 2.6.3
  [BISON][Parser] Building parser with bison 2.7
  Building Custom Rule C:/work/avr/avrdude_test/avrdude_main/src/CMakeLists.txt
  libavrdudePYTHON_wrap.c
  arduino.c
  avr.c
  avr910.c
  avrcache.c
  avrftdi.c
  avrftdi_tpi.c
  avrintel.c
  avr_opcodes.c
  avrpart.c
  bitbang.c
  buspirate.c
  butterfly.c
  ch341a.c
  config.c
  confwin.c
  crc16.c
  disasm.c
  dfu.c
  dryrun.c
  Generating Code...
  Compiling...
  fileio.c
  flip1.c
  flip2.c
  ft245r.c
  jtagmkI.c
  jtagmkII.c
  jtag3.c
  leds.c
  linuxgpio.c
  linuxspi.c
  lists.c
  micronucleus.c
  par.c
  pgm.c
  pgm_type.c
  pickit2.c
  pickit5_updi_lut.c
  pickit5.c
  pindefs.c
  ppi.c
  Generating Code...
  Compiling...
  ppiwin.c
  serbb_posix.c
  serbb_win32.c
  ser_avrdoper.c
  ser_posix.c
  ser_win32.c
  serialadapter.c
  serialupdi.c
  serprog.c
  stk500.c
  stk500v2.c
  stk500generic.c
  strutil.c
  teensy.c
  term.c
  updi_link.c
  updi_nvm.c
  updi_nvm_v0.c
  updi_nvm_v2.c
  updi_nvm_v3.c
  Generating Code...
  Compiling...
  updi_nvm_v4.c
  updi_nvm_v5.c
  updi_readwrite.c
  updi_state.c
  urclock.c
  usbasp.c
  usb_hidapi.c
  usb_libusb.c
  usbtiny.c
  update.c
  wiring.c
  xbee.c
  lexer.c
  config_gram.c
  getopt.c
  gettimeofday.c
  Generating Code...
  usleep.cpp
  readline.cpp
  Generating Code...
     Creating library C:/work/avr/avrdude_test/avrdude_main/build_msvc/src/RelWithDebInfo/swig_avrdude.lib and object C
  :/work/avr/avrdude_test/avrdude_main/build_msvc/src/RelWithDebInfo/swig_avrdude.exp
  swig_avrdude.vcxproj -> C:\work\avr\avrdude_test\avrdude_main\build_msvc\src\RelWithDebInfo\_swig_avrdude.pyd
  [FLEX][Parser] Building scanner with win_flex 2.6.3
  [BISON][Parser] Building parser with bison 2.7
  Building Custom Rule C:/work/avr/avrdude_test/avrdude_main/src/CMakeLists.txt
  arduino.c
  avr.c
  avr910.c
  avrcache.c
  avrftdi.c
  avrftdi_tpi.c
  avrintel.c
  avr_opcodes.c
  avrpart.c
  bitbang.c
  buspirate.c
  butterfly.c
  ch341a.c
  config.c
  confwin.c
  crc16.c
  disasm.c
  dfu.c
  dryrun.c
  fileio.c
  Generating Code...
  Compiling...
  flip1.c
  flip2.c
  ft245r.c
  jtagmkI.c
  jtagmkII.c
  jtag3.c
  leds.c
  linuxgpio.c
  linuxspi.c
  lists.c
  micronucleus.c
  par.c
  pgm.c
  pgm_type.c
  pickit2.c
  pickit5_updi_lut.c
  pickit5.c
  pindefs.c
  ppi.c
  ppiwin.c
  Generating Code...
  Compiling...
  serbb_posix.c
  serbb_win32.c
  ser_avrdoper.c
  ser_posix.c
  ser_win32.c
  serialadapter.c
  serialupdi.c
  serprog.c
  stk500.c
  stk500v2.c
  stk500generic.c
  strutil.c
  teensy.c
  term.c
  updi_link.c
  updi_nvm.c
  updi_nvm_v0.c
  updi_nvm_v2.c
  updi_nvm_v3.c
  updi_nvm_v4.c
  Generating Code...
  Compiling...
  updi_nvm_v5.c
  updi_readwrite.c
  updi_state.c
  urclock.c
  usbasp.c
  usb_hidapi.c
  usb_libusb.c
  usbtiny.c
  update.c
  wiring.c
  xbee.c
  lexer.c
  config_gram.c
  getopt.c
  gettimeofday.c
  Generating Code...
  usleep.cpp
  readline.cpp
  Generating Code...
  libavrdude.vcxproj -> C:\work\avr\avrdude_test\avrdude_main\build_msvc\src\RelWithDebInfo\libavrdude.lib
  Building Custom Rule C:/work/avr/avrdude_test/avrdude_main/src/CMakeLists.txt
  main.c
  developer_opts.c
  whereami.c
  Generating Code...
     Creating library C:/work/avr/avrdude_test/avrdude_main/build_msvc/src/RelWithDebInfo/avrdude.lib and object C:/wor
  k/avr/avrdude_test/avrdude_main/build_msvc/src/RelWithDebInfo/avrdude.exp
  avrdude.vcxproj -> C:\work\avr\avrdude_test\avrdude_main\build_msvc\src\RelWithDebInfo\avrdude.exe
  Building Custom Rule C:/work/avr/avrdude_test/avrdude_main/CMakeLists.txt

Location of the build results.

PS C:\work\avr\avrdude_test\avrdude_main> ls .\build_msvc\src\RelWithDebInfo\


    Directory: C:\work\avr\avrdude_test\avrdude_main\build_msvc\src\RelWithDebInfo


Mode                 LastWriteTime         Length Name
----                 -------------         ------ ----
-a----         8/22/2024   8:41 PM        3676160 avrdude.exe
-a----         8/22/2024   8:41 PM           3523 avrdude.exp
-a----         8/22/2024   8:41 PM           6302 avrdude.lib
-a----         8/22/2024   8:41 PM        5705728 avrdude.pdb
-a----         8/22/2024   8:41 PM       10637550 libavrdude.lib
-a----         8/22/2024   8:41 PM         700416 libavrdude.pdb
-a----         8/22/2024   8:40 PM           3670 swig_avrdude.exp
-a----         8/22/2024   8:40 PM           6816 swig_avrdude.lib
-a----         8/22/2024   8:40 PM        5804032 _swig_avrdude.pdb
-a----         8/22/2024   8:40 PM        3684864 _swig_avrdude.pyd


PS C:\work\avr\avrdude_test\avrdude_main> ls .\build_msvc\src\


    Directory: C:\work\avr\avrdude_test\avrdude_main\build_msvc\src


Mode                 LastWriteTime         Length Name
----                 -------------         ------ ----
d-----         8/22/2024   8:41 PM                avrdude.dir
d-----         8/22/2024   8:41 PM                CMakeFiles
d-----         8/22/2024   8:40 PM                libavrdude.dir
d-----         8/22/2024   8:41 PM                RelWithDebInfo
d-----         8/22/2024   8:40 PM                swig_avrdude.dir
d-----         8/22/2024   8:40 PM                x64
-a----         8/22/2024   8:40 PM           3391 ac_cfg.h
-a----         8/22/2024   8:40 PM            252 avrdude-gui.bat
-a----         8/22/2024   8:40 PM         869988 avrdude.conf
-a----         8/22/2024   8:40 PM         870050 avrdude.conf.in
-a----         8/22/2024   8:40 PM           2731 avrdude.spec
-a----         8/22/2024   8:40 PM          36297 avrdude.vcxproj
-a----         8/22/2024   8:40 PM           1793 avrdude.vcxproj.filters
-a----         8/22/2024   8:40 PM          10977 cmake_install.cmake
-a----         8/22/2024   8:40 PM          24045 conf.vcxproj
-a----         8/22/2024   8:40 PM            938 conf.vcxproj.filters
-a----         8/22/2024   8:40 PM          10693 INSTALL.vcxproj
-a----         8/22/2024   8:40 PM            539 INSTALL.vcxproj.filters
-a----         8/22/2024   8:40 PM          51885 libavrdude.vcxproj
-a----         8/22/2024   8:40 PM          20692 libavrdude.vcxproj.filters
-a----         8/22/2024   8:40 PM          21117 swig_avrdude.py
-a----         8/22/2024   8:40 PM          65108 swig_avrdude.vcxproj
-a----         8/22/2024   8:40 PM          21089 swig_avrdude.vcxproj.filters
-a----         8/22/2024   8:40 PM           3888 windows.rc

Use the same suffix string "-autotools" for "macos-x86_64-autotools"
which the linux-x86_64-autotools build already uses.
@ndim ndim force-pushed the ci-test-running-built-avrdude branch 7 times, most recently from be7441e to ba1547d Compare August 24, 2024 16:34
Use printf(1) to avoid possible echo(1) incompatibilities like
special escape sequences and the like.

Also, "\n\n" means two linefeeds, without any implicit linefeeds
being added.

Thought for the future: Perhaps test-avrdude should run isatty()
and, if it is not a TTY, not wait for linefeeds at all in the non-
interactive case?
The doc builds are a bit brittle at this time, and therefore
do not work reliably with "make distcheck".

Therefore this comments out "make distcheck" until the am doc
builds have been fixed.
@ndim ndim force-pushed the ci-test-running-built-avrdude branch from ba1547d to d1aea9f Compare August 24, 2024 16:37
@ndim ndim marked this pull request as ready for review August 24, 2024 16:41
This tries running the uninstalled avrdude executable, both
with -? and for test-avrdude.

Tests on installed avrdude are kept where they exist,
but not added for all possible platforms.

Quick table showing

  * -? testing of built avrdude (print the usage)
  * dryrun testing of built avrdude before installation
  * installation of avrdude
  * dryrun testing of installed avrdude

and whether that happens/succeeds/fails:

                              run    test              test
                               -?    built   install   installed
    linux-x86_64-autotools  | yes  | succ  | yes     | succ
    linux-x86_64            | yes  | succ  | yes     | succ
    linux (cross-compile)   | yes# | n/a   | no      | <--
    macos-x86_64            | yes  | succ  | no      | <--
    macos-x86_64-autotools  | yes  | succ  | no      | <--
    msvc                    | yes* | succ  | broken  | <--
    mingw                   | yes  | fail  | no      | <--

 # Only on i386, as the armhf and arm64 executables are not runnable
   on the ubuntu-latest x86_64 worker.

 * Works on x86 and x64. Skipped on arm64 at this time.

   The arm64 executable is not runnable, possibly due to the
   old problem of an exe being built for the wrong architecture
   (which @mcuee mentioned somewhere).

In summary, this should run as much as is possible at this time
without introducing failures.

In the future, after these failures are fixed, more tests can be
added for a more complete coverage.
@ndim ndim force-pushed the ci-test-running-built-avrdude branch from d1aea9f to c677974 Compare August 24, 2024 16:46
@ndim
Copy link
Contributor Author

ndim commented Aug 24, 2024

This could be merged IMHO. It did not help with the MacOS problem, but discovered some Windows problems, but at least this PR now runs what tests can be run at this time. Three types of simple tests are run:

  • avrdude -?
  • test-avrdude dryrun using the built avrdude executable from the build directory without installing it
  • test-avrdude dryrun using the built and installed avrdude executable

The remaining problems (installing and testing installed avrdude everywhere, general msys2 mingw test-avrdude failure to write to temp files, msvc arm64 executable cannot be run) can be fixed later in seperate PRs.

Quoting the main commit's message:

ci: Where possible, dryrun tests on uninstalled avrdude

This tries running the uninstalled avrdude executable, both
with -? and for test-avrdude.

Tests on installed avrdude are kept where they exist,
but not added for all possible platforms.

Quick table showing

  * -? testing of built avrdude (print the usage)
  * dryrun testing of built avrdude before installation
  * installation of avrdude
  * dryrun testing of installed avrdude

and whether that happens/succeeds/fails:

                              run    test              test
                               -?    built   install   installed
    linux-x86_64-autotools  | yes  | succ  | yes     | succ
    linux-x86_64            | yes  | succ  | yes     | succ
    linux (cross-compile)   | yes# | n/a   | no      | <--
    macos-x86_64            | yes  | succ  | no      | <--
    macos-x86_64-autotools  | yes  | succ  | no      | <--
    msvc                    | yes* | succ  | broken  | <--
    mingw                   | yes  | fail  | no      | <--

 # Only on i386, as the armhf and arm64 executables are not runnable
   on the ubuntu-latest x86_64 worker.

 * Works on x86 and x64. Skipped on arm64 at this time.

   The arm64 executable is not runnable, possibly due to the
   old problem of an exe being built for the wrong architecture
   (which @mcuee mentioned somewhere).

In summary, this should run as much as is possible at this time
without introducing failures.

In the future, after these failures are fixed, more tests can be
added for a more complete coverage.

@stefanrueger
Copy link
Collaborator

@ndim Cool work! Thanks for this

@stefanrueger stefanrueger merged commit 706336c into avrdudes:main Aug 24, 2024
13 checks passed
@ndim ndim deleted the ci-test-running-built-avrdude branch August 24, 2024 21:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[MacOS] Avrdude built using autotools doesn't work
3 participants