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

Release automation: run spec tests with just OSH on different platforms #167

Open
andychu opened this issue Aug 14, 2018 · 11 comments
Open

Comments

@andychu
Copy link
Contributor

andychu commented Aug 14, 2018

For OS X, BSDs, etc. where we might not want to bother building with spec-bin.sh

And maybe ARM Linux would be a good one too. Although it would be nice to build binaries there.

@andychu
Copy link
Contributor Author

andychu commented Oct 5, 2018

This is is more significant now that we have a __GLIBC__ test in native/libc.c for extglob.

In other words, some things don't work on Alpine now, and it would be nice to see that in the tests.

@andychu
Copy link
Contributor Author

andychu commented Jul 7, 2019

TODO: What are dependencies of spec tests?

Anything else?

On the one hand, since they are confined to test/spec.sh and test/spec-runner.sh, we could make these more like POSIX scripts. I guess it depends what we do with Python 2, which is needed to run test/sh_spec.py. And gawk!

On the other hand, if we can use the same portability solution for all 4 deps, that would be nice.

Note test/spec-bin.sh builds binaries of other shells. We don't technically need it for this task. However we could use the same solution to build Python 2, bash, coreutils (which is admittedly onerous, but I guess BSDs are source-based anyway)

@andychu
Copy link
Contributor Author

andychu commented Jul 7, 2019

@jyn514 I realized the spec tests have a fairly significant gawk dependency. The match() function is a useful extension -- see test/spec-runner.sh

So ideally we could package up these 4 dependencies somehow. I don't think they are particularly weird or exotic.

I think putting gawk in $PATH is not too hard, as well as accounting for name differences with a tiny shell wrapper.

@andychu
Copy link
Contributor Author

andychu commented Jul 7, 2019

I think having something like:

$REPO/
  sh-env/
    darwin/
      nproc
      gawk
      rm
      xargs
    freebsd/
      nproc
      gawk
      rm
      xargs
    debian/
      # missing dependencies are assumed to be on system

would work. Some of these can be symlinks, some are tiny shell wrappers, and some are native binaries.

It's similar to the philosophy of avoiding #ifdefs. The Go/Plan 9 guys advocate that -- they avoid #ifdefs and instead create portable interfaces.

@andychu
Copy link
Contributor Author

andychu commented Mar 5, 2020

This is kind of the opposite of #42 -- because we want to run at least some tests in a DIFFERENT environment!

@andychu
Copy link
Contributor Author

andychu commented Mar 5, 2020

Updated dependencies:

For sh_spec.py, test/spec-runner.sh and dependencies like test/common.sh, and test/spec-alpine.sh, etc.

  • Python 2 for sh_spec.py
    • this was in Python 3 at some point, but I dropped support for it, woudln't be too hard to port again. I think we mostly need b'' everywhere.
  • bash or known working version of Oil (might have arrays, associative arrays, etc. so not just POSIX)
  • gawk: probably could move this to Python pretty easily. For generating spec test HTML report, which is nice to upload.
  • POSIX cp, rm, etc.

OPTIONAL:

  • GNU findutils for xargs -P parallelization

tarball layout:

oil-0.8.pre2/
  _bin/
    oil   # oil-native, the thing being tested
    oil.ovm  # also can be tested
  test/
    spec-alpine.sh
  spec/
    ...
    var-op-other.test.sh
    ...
  

Problems expected

  • assuming hardcoded paths like /lib exist
  • assuming rm is in /bin/rm
  • assuming that we have the Python repo, e.g. core/completion.py
    • (this could be in the tarball as TESTDATA then?)

@jyn514
Copy link
Contributor

jyn514 commented Mar 5, 2020

I think you'll also need python-dev since you include Python.h during build/dev.sh all. Not sure if spec tests run with the dev build or the tarball.

@andychu
Copy link
Contributor Author

andychu commented Mar 5, 2020

This is for testing the end-user binaries, so the user just needs to run ./configure && make etc.

No Python is needed to use Oil, either now or in the near future with oil-native! Developing Oil is a different story, but this issue is basically moving spec tests from "dev" --> "distro maintainer" / "end user"

andychu pushed a commit that referenced this issue Mar 6, 2020
test/spec-alpine.sh smoke works with 1 error due to an 'ls' difference.

Addresses issue #167.

TODO: Consolidates test/alpine2.sh with test/alpine.sh.
andychu pushed a commit that referenced this issue Mar 7, 2020
Only 11 tests need --no-cd-tmp now.  They depend on $PWD/bin
existing, etc. which is true in the repo.

Will help with #167.
andychu pushed a commit that referenced this issue Mar 7, 2020
- Starting with tests that require --no-cd-tmp.
- Add --osh-failures-allowed
- Also make note of some dependencies needed for parallel execution,
  e.g. GNU time and xargs.

Will help with #167.
andychu pushed a commit that referenced this issue Mar 7, 2020
time.py takes optional --append, instead of defaulting to it, so we can
run in parallel.  The spec tests do that.

Update all usages to pass --append like /usr/bin/time.

Work towards #167.
andychu pushed a commit that referenced this issue Mar 7, 2020
Had to rename it because 'import time' on Alpine somehow shadows the
stdlib!

Reduces dependencies for issue #167.
andychu pushed a commit that referenced this issue Mar 7, 2020
andychu pushed a commit that referenced this issue Mar 7, 2020
Addresses issue #167.

Still needs a lot of cleanup.
@andychu
Copy link
Contributor Author

andychu commented Mar 7, 2020

TODO

  • fold in test/alpine2.sh into test/alpine.sh
  • Make it so you can copy an arbitrary tarball in, not just the _release/oil-*.tar.gz one
  • set up non-root user so more tests pass
    • although the root user also exposes bugs!
  • "diff" functionality vs Ubuntu spec results
    • look into failures. Some tests need to be modified. Categorize them?
  • Make sure other people can successfully run it. Document it

Later:

  • Run on OS X. This seems pretty feasible now
    • gawk is a remaining problem. Otherwise everything should be there: Python 2, bash, etc. and zip and scp for uploading

andychu pushed a commit that referenced this issue Mar 7, 2020
See comments at the top of test/alpine.sh.

We have _chroot/alpine-oil-{tar,spec}

Addresses #167.
@andychu
Copy link
Contributor Author

andychu commented Mar 20, 2020

#70 is really a specific instance of this issue

@andychu
Copy link
Contributor Author

andychu commented Nov 20, 2021

Pinging this since it came up in the #oil-dev meeting

i.e. verifying a tarball/binary built with Nix

@andychu andychu added the c-i label Jan 5, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants