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

Fix issues with running tests on macOS #76

Closed
rspeed opened this issue Dec 8, 2017 · 8 comments
Closed

Fix issues with running tests on macOS #76

rspeed opened this issue Dec 8, 2017 · 8 comments

Comments

@rspeed
Copy link
Contributor

rspeed commented Dec 8, 2017

More of a reminder to myself.

In short: The tests assume that mktemp generates everything under /tmp, but that isn't the case on macOS. So… gotta fix that.

@blueyed
Copy link
Collaborator

blueyed commented Dec 10, 2017

Good point.
Where is it created for you?
Probably only the expected globs need to be adjusted?!

@rspeed
Copy link
Contributor Author

rspeed commented Dec 13, 2017

It's a random directory created at login under /var/folders/fw/. Right now for me it's /var/folders/fw/hgtkrd7x4kvgxmlp5j3n31780000gn/T/. I think the solution is to compare the path against $TMPDIR, rather than assuming it's /var/tmp.

blueyed added a commit to blueyed/zsh-autoenv that referenced this issue Dec 13, 2017
@blueyed
Copy link
Collaborator

blueyed commented Dec 13, 2017

#78 should fix it, can you try it? (assuming that Travis likes it)

There is $CRAMTMP, but it cannot be used in the expected output (AFAIK).

blueyed added a commit that referenced this issue Dec 13, 2017
@rspeed
Copy link
Contributor Author

rspeed commented Dec 14, 2017

Seems like it! Though I'm still not able to get the tests to run… it's as though autoenv.zsh isn't being sourced. Do you have instructions for running the tests?

@rspeed
Copy link
Contributor Author

rspeed commented Dec 14, 2017

Disregard that. I looked at .travis.yml and noticed that it needs a couple of environmental variables. Most of the tests are passing now, except for tests/recurse-upwards.t. Looking into it.

@rspeed
Copy link
Contributor Author

rspeed commented Dec 14, 2017

I'm not quite sure. May not be a platform issue. This is what I get from ZDOTDIR=tests/ZDOTDIR make:

cram --shell=zsh -v tests
tests/_autoenv_stack.t: passed
tests/_autoenv_utils.t: passed
tests/autoenv-edit.t: passed
tests/autoenv.t: passed
tests/cwd.t: passed
tests/leave.t: passed
tests/recurse-upwards.t: failed
--- tests/recurse-upwards.t
+++ tests/recurse-upwards.t.err
@@ -77,9 +77,7 @@
   $ test_autoenv_auth_env_files
 
   $ cd .
-  autoenv_source_parent_from_sub:
-  ENTERED_root: PWD:sub from:sub to:sub
-  ENTERED_sub: PWD:sub from:sub to:sub
+  autoenv_source_parent_from_sub:nautoenv_source_parentnecho ENTERED_sub: PWD:sub from:sub to:sub
   ENTER2
   done_sub
 
@@ -90,9 +88,7 @@
   $ test_autoenv_add_to_env sub2/.autoenv.zsh
   $ cd sub2
   autoenv_source_parent_from_sub2:
-  autoenv_source_parent_from_sub:
-  ENTERED_root: PWD:sub2 from:sub to:sub2
-  ENTERED_sub: PWD:sub2 from:sub to:sub2
+  autoenv_source_parent_from_sub:nautoenv_source_parentnecho ENTERED_sub: PWD:sub2 from:sub to:sub2
   ENTER2
   done_sub
   done_sub2
@@ -113,18 +109,7 @@
   $ echo "echo NEW" >| .autoenv.zsh
   $ _autoenv_ask_for_yes() { echo "no"; return 1 }
   $ cd sub
-  autoenv_source_parent_from_sub:
-  Attempting to load unauthorized env file!
-  -* /*/cramtests-*/recurse-upwards.t/.autoenv.zsh (glob)
-  
-  **********************************************
-  
-  echo NEW
-  
-  **********************************************
-  
-  Would you like to authorize it? (type 'yes') no
-  ENTERED_sub: PWD:sub from:recurse-upwards.t to:sub
+  autoenv_source_parent_from_sub:nautoenv_source_parentnecho ENTERED_sub: PWD:sub from:recurse-upwards.t to:sub
   ENTER2
   done_sub
 
@@ -138,7 +123,13 @@
 
   $ touch -t 201401010104 .autoenv.zsh
   $ cd .
-  autoenv_source_parent_from_sub:
+  autoenv_source_parent_from_sub:nautoenv_source_parentnecho ENTERED_sub: PWD:sub from:sub to:sub
+  ENTER2
+  done_sub
+
+
+  $ cd ..
+  LEFT_sub: PWD:recurse-upwards.t from:sub to:recurse-upwards.t
   Attempting to load unauthorized env file!
   -* /*/cramtests-*/recurse-upwards.t/.autoenv.zsh (glob)
   
@@ -150,19 +141,10 @@
   
   Would you like to authorize it? (type 'yes') yes
   NEW
-  ENTERED_sub: PWD:sub from:sub to:sub
-  ENTER2
-  done_sub
-
-
-  $ cd ..
-  LEFT_sub: PWD:recurse-upwards.t from:sub to:recurse-upwards.t
   $ mkdir sub/sub2/sub3
   $ cd sub/sub2/sub3
   autoenv_source_parent_from_sub2:
-  autoenv_source_parent_from_sub:
-  NEW
-  ENTERED_sub: PWD:sub3 from:recurse-upwards.t to:sub3
+  autoenv_source_parent_from_sub:nautoenv_source_parentnecho ENTERED_sub: PWD:sub3 from:recurse-upwards.t to:sub3
   ENTER2
   done_sub
   done_sub2
tests/source-parent-until.t: passed
tests/source-parent-vars.t: passed
tests/upgrade_hash.t: passed
tests/varstash-alias.t: passed
tests/varstash-unstash-on-leave.t: passed
tests/varstash.t: passed
tests/varstash_export.t: passed
# Ran 14 tests, 0 skipped, 1 failed.

@rspeed
Copy link
Contributor Author

rspeed commented Dec 14, 2017

Okay, I'm pretty sure this is also a platform issue. There are some differences in sed between FreeBSD and GNU Coreutils.

Edit: Yup, pretty sure this is the issue. On Linux sed replaces the \n with actual newlines, but on macOS it doesn't.

@rspeed
Copy link
Contributor Author

rspeed commented Dec 14, 2017

Aaaaaand this is really annoying because the standard solution would be to use actual newlines, but then cram errors out because you can't have multiline commands. Argh.

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

No branches or pull requests

2 participants