apjanke / octave-testify

New BIST (Built-In Self Test) functions for GNU Octave
GNU General Public License v3.0
4 stars 2 forks source link

forgepkgtester: capture package build logs #18

Closed apjanke closed 5 years ago

apjanke commented 5 years ago

The full output of pkg install's configure and make steps is not captured by diary. For example, all the compiler warnings for pkg install -forge control are not captured; neither are the compiler errors for struct.

It'd be nice if we could capture these logs somehow. Ideally, as separate files for each package.

Doing this will require writing a replacement for pkg install, since it does not expose log file captures.

apjanke commented 5 years ago

Bleh. pkg's install function is 800 lines long. That's a lot to copy.

apjanke commented 5 years ago

Oh. I could just compartmentalize that in a ForgePkgInstaller class with local functions.

apjanke commented 5 years ago

I've got something kinda working. But for some reason, some packages' configure and make output goes to the Command Window instead of being captured in the logs.

TESTS FAILED!
1 failures in tests for packages: image

testify.ForgePkgTool: pkg unload image
testify.ForgePkgTool: pkg uninstall image

testify.ForgePkgTester: Doing Forge package image-acquisition 0.2.2
testify.ForgePkgTester: Installing Forge package image-acquisition
testify.ForgePkgInstaller: install -forge image-acquisition
checking whether the C++ compiler works... yes
checking for C++ compiler default output file name... a.out
checking for suffix of executables...
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether we are using the GNU C++ compiler... yes
checking whether clang++ -std=gnu++11 accepts -g... yes
checking for mkoctfile... yes
checking for fltk-config... /usr/local/bin/fltk-config
checking for v4l2_open in -lv4l2... no
configure: error: unable to find the v4l2_open() function

testify.ForgePkgTester: Error while installing package image-acquisition: pkg: error running the configure script for image-acquisition.

testify.ForgePkgTester: Doing Forge package instrument-control 0.3.1
testify.ForgePkgTester: Installing Forge package instrument-control
testify.ForgePkgInstaller: install -forge instrument-control

Same with package struct:


testify.ForgePkgTester: Doing Forge package struct 1.0.15
testify.ForgePkgTester: Installing Forge package struct
testify.ForgePkgInstaller: install -forge struct
CXXFLAGS="-I/Applications/Octave-5.1.0.app/Contents/Resources/usr/opt/sundials@2/include -I/Applications/Octave-5.1.0.app/Contents/Resources/usr/opt/qscintilla2/include -Wno-deprecated-declarations" /Applications/Octave-5.1.0.app/Contents/Resources/usr/Cellar/octave-octave-app@5.1.0/5.1.0/bin/mkoctfile-5.1.0 -c error-helpers.cc
In file included from error-helpers.cc:22:
./error-helpers.h:31:22: error: unknown type name 'octave_execution_exception'; did you mean 'octave::execution_exception'?
void c_verror (const octave_execution_exception&, const char *, ...);
                     ^~~~~~~~~~~~~~~~~~~~~~~~~~
                     octave::execution_exception
/Applications/Octave-5.1.0.app/Contents/Resources/usr/Cellar/octave-octave-app@5.1.0/5.1.0/include/octave-5.1.0/octave/errwarn.h:35:9: note: 'octave::execution_exception' declared here
  class execution_exception;
        ^
error-helpers.cc:36:17: error: unknown type name 'octave_execution_exception'; did you mean 'octave::execution_exception'?
c_verror (const octave_execution_exception&, const char *fmt, ...)
                ^~~~~~~~~~~~~~~~~~~~~~~~~~
                octave::execution_exception
/Applications/Octave-5.1.0.app/Contents/Resources/usr/Cellar/octave-octave-app@5.1.0/5.1.0/include/octave-5.1.0/octave/errwarn.h:35:9: note: 'octave::execution_exception' declared here
  class execution_exception;
        ^
error-helpers.cc:60:8: error: no member named 'cerr' in namespace 'std'
  std::cerr << msg;
  ~~~~~^
3 errors generated.
make: *** [error-helpers.o] Error 1

testify.ForgePkgTester: Error while installing package struct: pkg: error running `make' for the struct package.
apjanke commented 5 years ago

Ah. I'm grabbing the install logs from successful package installs, but not from failed ones. See if there's a way to do that. It'll require changing error(...) calls inside my pkg install replacement to returning error result objects.

apjanke commented 5 years ago

Also, the build logs from installing dependencies are still going to the console. (Because I'm using regular pkg install -forge <packages> for them.) It'd be nice if those were suppressed; they're not the focus of testing at the point where they happen.

apjanke commented 5 years ago

Got a start on this: https://github.com/apjanke/octave-testify/commit/23ebb455f7bcd7a55b739df49548afe3442834fd.

Example output: octave-testify-ForgePkgTester-2019-03-16_18-03-00.zip

apjanke commented 5 years ago

Maybe I can suppress the console output for dependency compilation with a verbose=false input to pkg install.

apjanke commented 5 years ago

Okay, capturing build logs for failed installs wasn't so bad: https://github.com/apjanke/octave-testify/commit/a0b20ed36be27d01125786b8b3760839ea9a8f69

Example output: octave-testify-ForgePkgTester-2019-03-16_19-09-04.zip

apjanke commented 5 years ago

Maybe I can suppress the console output for dependency compilation with a verbose=false input to pkg install.

Hmm, no; there's no verbose=false option; just a -verbose flag. I need to look into the source some more to see where that output is coming from.

apjanke commented 5 years ago

Hmm, no; there's no verbose=false option; just a -verbose flag. I need to look into the source some more to see where that output is coming from.

Ehh, it's buried way down in there. Save this for a bigger refactor.

apjanke commented 5 years ago

Okay, build log capturing is working. Closing as done.