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

Tests failing (Ubuntu 20.04) #175

Closed
isotopp opened this issue Mar 19, 2022 · 8 comments
Closed

Tests failing (Ubuntu 20.04) #175

isotopp opened this issue Mar 19, 2022 · 8 comments

Comments

@isotopp
Copy link
Contributor

isotopp commented Mar 19, 2022

I am running autoreconf -i, ./configure, make, and make check.

The final lines of the configure output are

configure: creating ./config.status
config.status: creating Makefile
config.status: creating tests/jo.07.sh
config.status: executing depfiles commands

  Jo.............: version 1.6
  Prefix.........: /usr/local
  C compiler.....: gcc -g -O2
  Pandoc.........: NONE
  Bash completion: /usr/share/bash-completion/completions/jo.bash

  Now type 'make [<target>]'
    where the optional <target> is:
      all                - build all binaries
      check              - run the tests
      install            - install everything

The make succeeds.

kris@Kris-Yoga:~/C/jo$ make
  CC       jo.o
  CC       json.o
  CC       base64.o
  CCLD     jo

A make check then explodes.

kris@Kris-Yoga:~/C/jo$ make check
make  check-TESTS
make[1]: Entering directory '/home/kris/C/jo'
make[2]: Entering directory '/home/kris/C/jo'
./build-aux/tap-driver.sh: line 16: $'\r': command not found
./build-aux/tap-driver.sh: line 21: $'\r': command not found
./build-aux/tap-driver.sh: line 25: $'\r': command not found
./build-aux/tap-driver.sh: line 27: $'\r': command not found
: invalid optiondriver.sh: line 30: set: -
set: usage: set [-abefhkmnptuvxBCHP] [-o option-name] [--] [arg ...]
./build-aux/tap-driver.sh: line 31: $'\r': command not found
./build-aux/tap-driver.sh: line 33: $'\r': command not found
./build-aux/tap-driver.sh: line 34: syntax error near unexpected token `$'\r''
'/build-aux/tap-driver.sh: line 34: `fatal ()
make[2]: *** [Makefile:936: tests/jo.log] Error 2
make[2]: Leaving directory '/home/kris/C/jo'
make[1]: *** [Makefile:918: check-TESTS] Error 2
make[1]: Leaving directory '/home/kris/C/jo'
make: *** [Makefile:1120: check-am] Error 2

There is no \r in tap-driver.sh, and the line numbers emitted are not really helpful.

What's going on?

@isotopp
Copy link
Contributor Author

isotopp commented Mar 19, 2022

Ubuntu 20.04 in WSL2 on Windows, The ~/C/jo is local, not on the 9P bridge

kris@Kris-Yoga:~/C/jo$ df -Th .
Filesystem     Type  Size  Used Avail Use% Mounted on
/dev/sdb       ext4  251G  6,4G  232G   3% /

@isotopp isotopp changed the title Tests failinging (Ubuntu 20.04) Tests failing (Ubuntu 20.04) Mar 19, 2022
@gromgit
Copy link
Collaborator

gromgit commented Mar 19, 2022

$'\r' is bash's character expansion for a carriage return character, so I'm betting that file (and maybe some others) were written with MS-DOS line endings (CR/LF) instead of Unix ones (LF).

I don't do Windows, so I don't have an environment to test it in, but I know for sure that all the source files were checked in with Unix line endings. Is there a setting in WSL2's Git Bash (or whatever you used to download the sources) that quietly "corrects" line endings in text files to Windows standard?

@jpmens
Copy link
Owner

jpmens commented Mar 19, 2022

./build-aux/tap-driver.sh: line 16: $'\r': command not found

line 16 is the first empty line in the file, and the other line numbers correspond to empty lines as well. I tend to also think something has extracted those *.sh with CRNL ...

Crazy idea: %s/^$/#/ ? :-)

@gromgit
Copy link
Collaborator

gromgit commented Mar 19, 2022

Unfortunately, I suspect the entire file has CR/LF line endings; see the line 30 set error for instance. Likely the entire source tree is similarly tainted, so the tests may fail regardless.

@isotopp, if you checked out the jo sources via git, what does git status under your jo source tree output?

@isotopp
Copy link
Contributor Author

isotopp commented Mar 19, 2022

Hm, nothing weird shows:

kris@Kris-Yoga:~/C$ rm -rf jo
kris@Kris-Yoga:~/C$ git clone git@github.com:jpmens/jo.git
Cloning into 'jo'...
remote: Enumerating objects: 985, done.
remote: Counting objects: 100% (155/155), done.
remote: Compressing objects: 100% (112/112), done.
remote: Total 985 (delta 78), reused 99 (delta 40), pack-reused 830
Receiving objects: 100% (985/985), 289.94 KiB | 4.75 MiB/s, done.
Resolving deltas: 100% (544/544), done.
kris@Kris-Yoga:~/C$ cd jo
kris@Kris-Yoga:~/C/jo$ autoreconf -i
configure.ac:7: installing 'build-aux/compile'
configure.ac:32: installing 'build-aux/install-sh'
configure.ac:32: installing 'build-aux/missing'
Makefile.am: installing 'build-aux/depcomp'
kris@Kris-Yoga:~/C/jo$ ./configure > /dev/null
configure: WARNING: pandoc not found, man pages rebuild will not be possible
kris@Kris-Yoga:~/C/jo$ make
  CC       jo.o
  CC       json.o
  CC       base64.o
  CCLD     jo
kris@Kris-Yoga:~/C/jo$ make check
make  check-TESTS
make[1]: Entering directory '/home/kris/C/jo'
make[2]: Entering directory '/home/kris/C/jo'
./build-aux/tap-driver.sh: line 16: $'\r': command not found
./build-aux/tap-driver.sh: line 21: $'\r': command not found
./build-aux/tap-driver.sh: line 25: $'\r': command not found
./build-aux/tap-driver.sh: line 27: $'\r': command not found
: invalid optiondriver.sh: line 30: set: -
set: usage: set [-abefhkmnptuvxBCHP] [-o option-name] [--] [arg ...]
./build-aux/tap-driver.sh: line 31: $'\r': command not found
./build-aux/tap-driver.sh: line 33: $'\r': command not found
./build-aux/tap-driver.sh: line 34: syntax error near unexpected token `$'\r''
'/build-aux/tap-driver.sh: line 34: `fatal ()
make[2]: *** [Makefile:936: tests/jo.log] Error 2
make[2]: Leaving directory '/home/kris/C/jo'
make[1]: *** [Makefile:918: check-TESTS] Error 2
make[1]: Leaving directory '/home/kris/C/jo'
make: *** [Makefile:1120: check-am] Error 2

@isotopp
Copy link
Contributor Author

isotopp commented Mar 19, 2022

Aaargh.

kris@Kris-Yoga:~/C/jo$ git config  --global --get-regexp '.'
user.email kris-git@koehntopp.de
user.name Kristian Koehntopp
core.excludesfile /home/kris/win/.gitignore
core.autocrlf true

That's set so that the Linux- and Windows-Side of the machine can both git the files. If not set, bad things happen with everything else.

kris@Kris-Yoga:~/C/jo$ git config --local core.autocrlf false
kris@Kris-Yoga:~/C/jo$ git config --get-regexp '.'
user.email kris-git@koehntopp.de
user.name Kristian Koehntopp
core.excludesfile /home/kris/win/.gitignore
core.autocrlf true
core.repositoryformatversion 0
core.filemode true
core.bare false
core.logallrefupdates true
core.autocrlf false
remote.origin.url git@github.com:jpmens/jo.git
remote.origin.fetch +refs/heads/*:refs/remotes/origin/*
branch.master.remote origin
branch.master.merge refs/heads/master

and

kris@Kris-Yoga:~/C/jo$ git reset --hard
HEAD is now at eefaf71 change URL again         addresses #174
kris@Kris-Yoga:~/C/jo$ git status
On branch master
Your branch is up to date with 'origin/master'.

nothing to commit, working tree clean
kris@Kris-Yoga:~/C/jo$ autoreconf -i
configure.ac:7: installing 'build-aux/compile'
configure.ac:32: installing 'build-aux/install-sh'
configure.ac:32: installing 'build-aux/missing'
Makefile.am: installing 'build-aux/depcomp'
kris@Kris-Yoga:~/C/jo$ ./configure > /dev/null
configure: WARNING: pandoc not found, man pages rebuild will not be possible
kris@Kris-Yoga:~/C/jo$ make
  CC       jo.o
  CC       json.o
  CC       base64.o
  CCLD     jo
kris@Kris-Yoga:~/C/jo$ make check
make  check-TESTS
make[1]: Entering directory '/home/kris/C/jo'
make[2]: Entering directory '/home/kris/C/jo'
PASS: tests/jo.test 1 -  basic logo
PASS: tests/jo.test 2 -  basic logo (stdin)
PASS: tests/jo.test 3 -  basic two values
PASS: tests/jo.test 4 -  nested with executable
PASS: tests/jo.test 5 -  nested native
...

Ok, so something in that test script thingie is incredibly sensitive to line endings.

@isotopp
Copy link
Contributor Author

isotopp commented Mar 19, 2022

Meh. No Jetbrains CLion for you, then.

@gromgit
Copy link
Collaborator

gromgit commented Mar 19, 2022

Ok, so something in that test script thingie is incredibly sensitive to line endings.

bash (being a Unix shell) is sensitive to line endings. I'm actually surprised Microsoft didn't patch bash to use Windows line-endings; perhaps they found that it would break too many other WSL utilties.

@jpmens jpmens closed this as completed in 939ec66 Mar 20, 2022
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

3 participants