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

Migrate to Packajoozle? #64

Open apjanke opened 5 years ago

apjanke commented 5 years ago

Testify carries around its own hacked version of the pkg package installation code, so it can capture build logs. Maybe it should just migrate to using Packajoozle for this. That would be good testing exercise for Packajoozle, too.

apjanke commented 5 years ago

Yes, this is a good idea. I just started work on it, and it's already helped me shake out a couple bugs in Packajoozle. And it removes a whole bunch of code copied from pkg into Testify.

apjanke commented 5 years ago

Work in progress on branch https://github.com/apjanke/octave-testify/tree/migrate-to-Packajoozle.

apjanke commented 5 years ago

Well, I've got all the objects migrated over, except now Octave goes all crazy and loses functions like dir, ls, and so on, and crashes.

pkj: installing: fpl 1.3.5
Installed fpl 1.3.5 from Octave Forge to user pkg dir
For information about changes from previous versions of the fpl package, run 'news fpl'.
testify.ForgePkgTester: No build logs for fpl
error: value on right hand side of assignment is undefined
error: called from
    find_file_droppings at line 271 column 9
    install_and_test_forge_pkg at line 305 column 24
    install_and_test_forge_pkgs at line 252 column 13
    install_and_test_forge_pkgs at line 48 column 3
stopped in /Users/janke/local/repos/octave-testify/inst/+testify/+internal/ForgePkgTester.m at line 271
271:       d = dir;
debug> diary off
debug> diary on
debug> which dir
debug> dir
debug> which lis
debug> which ls
debug> which ver
debug> ver
debug>

https://gist.github.com/apjanke/210e7efcd492badcfc4a7001499a648c

Happens under both Octave 4.4.1 and Octave 5.1.0.

apjanke commented 5 years ago

And it's worse under Octave default. It can't even find testify.internal.Util's static methods.

$ octave-default
GNU Octave, version 6.0.0
Copyright (C) 2019 John W. Eaton and others.
This is free software; see the source code for copying conditions.
There is ABSOLUTELY NO WARRANTY; not even for MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE.  For details, type 'warranty'.

Octave was configured for "x86_64-apple-darwin18.2.0".

Additional information about Octave is available at https://www.octave.org.

Please contribute if you find this software useful.
For more information, visit https://www.octave.org/get-involved.html

Read https://www.octave.org/bugs.html to learn how to submit bug reports.
For information about changes from previous versions, type 'news'.

octave:1> addpath('~/local/repos/octave-testify/inst'); addpath('~/local/repos/octave-packajoozle/inst')
octave:2> dbstop if error
octave:3> testify.install_and_test_forge_pkgs
error: no such method or property `testify_data_dir'
error: called from
    install_and_test_forge_pkgs at line 43 column 13
stopped in /Users/janke/local/repos/octave-testify/inst/+testify/install_and_test_forge_pkgs.m at line 43
43:   pkgtester = testify.internal.ForgePkgTester;
debug> dbstack
stopped in:

  --> install_and_test_forge_pkgs at line 43 [/Users/janke/local/repos/octave-testify/inst/+testify/install_and_test_forge_pkgs.m]
debug> testif.internal.Util.testify_data_dir
error: 'testif' undefined near line 1 column 1
error: called from
    install_and_test_forge_pkgs at line 43 column 13
debug> testify.internal.Util.testify_data_dir
error: no such method or property `testify_data_dir'
error: called from
    install_and_test_forge_pkgs at line 43 column 13
debug> testify.internal.Util.safe_hostname
error: no such method or property `safe_hostname'
error: called from
    install_and_test_forge_pkgs at line 43 column 13
debug> path

Octave's search path contains the following directories:

.
/Users/janke/local/repos/octave-packajoozle/inst/shims/all
/Users/janke/local/repos/octave-packajoozle/inst
/Users/janke/local/repos/octave-testify/inst
/Users/janke/Dropbox/computer/data/Documents/octave
/usr/local/Cellar/octave-default/default/lib/octave/6.0.0/site/oct/x86_64-a
apjanke commented 5 years ago

Note: This will make integrating Testify into core Octave harder, because they're probably not going to pull in Packajoozle any time soon.

What should probably happen is that Testify should become a smaller core testing library thing, and the stuff that involves actually downloading and installing packages or other things that rely on Packajoozle should be broken out to a separate package that depends on both Packajoozle and Testify. "Testajoozle"?

apjanke commented 4 years ago

Or maybe Testify should optionally support, but not require, Packajoozle. And it should use pkg/pkj just for discovery of where the tested packages are located, but not do any package installation itself. Then, conversely, Packajoozle, which knows more about its "world" setup and the ability to do isolated package installations, could optionally support, but not require, Testify, and it could supply a function to download and install a certain set of packages, possibly into a clean "world" or "place", and run tests on them.