Ceedling icon indicating copy to clipboard operation
Ceedling copied to clipboard

Problems with mingw64 on windows line endings

Open RamDav opened this issue 6 years ago • 6 comments

Hello, i'm no ruby programmer but i got an issue with test reports, i've written a simple test which Passes and then get the answer from ceedling that the sanity check for the tests failed.

# ceedling test:list
  
  
Test 'test_list.c'
------------------
Generating runner for test_list.c...
Compiling test_list_runner.c...
Compiling test_list.c...
Linking test_list.out...
Running test_list.out...

ERROR: Internal sanity check for test fixture 'test_list.out' finds that Unity's final test count (1) does not match Ceedling's summation of all test cases (0).
  Possible causes:
    1. Your test + source dereferenced a null pointer.
    2. Your test + source indexed past the end of a buffer.
    3. Your test + source committed a memory access violation.
    4. Your test fixture produced an exit code of 0 despite execution ending prematurely.
  Sanity check failures of test results are usually a symptom of interrupted test execution.

rake aborted!

/d/Projekte/ISZ/UDS-LC/work/UDS-LC_uC/application/vendor/ceedling/lib/ceedling/generator_test_results_sanity_checker.rb:61:in `sanity_check_warning'
/d/Projekte/ISZ/UDS-LC/work/UDS-LC_uC/application/vendor/ceedling/lib/ceedling/generator_test_results_sanity_checker.rb:42:in `verify'
/d/Projekte/ISZ/UDS-LC/work/UDS-LC_uC/application/vendor/ceedling/lib/ceedling/generator_test_results.rb:48:in `process_and_write_results'
/d/Projekte/ISZ/UDS-LC/work/UDS-LC_uC/application/vendor/ceedling/lib/ceedling/generator.rb:165:in `generate_test_results'
/d/Projekte/ISZ/UDS-LC/work/UDS-LC_uC/application/vendor/ceedling/lib/ceedling/rules_tests.rake:56:in `block in <top (required)>'
/d/Projekte/ISZ/UDS-LC/work/UDS-LC_uC/application/vendor/ceedling/lib/ceedling/task_invoker.rb:86:in `invoke_test_results'
/d/Projekte/ISZ/UDS-LC/work/UDS-LC_uC/application/vendor/ceedling/lib/ceedling/test_invoker.rb:123:in `block in setup_and_invoke'
/d/Projekte/ISZ/UDS-LC/work/UDS-LC_uC/application/vendor/ceedling/lib/ceedling/test_invoker.rb:63:in `each'
/d/Projekte/ISZ/UDS-LC/work/UDS-LC_uC/application/vendor/ceedling/lib/ceedling/test_invoker.rb:63:in `setup_and_invoke'
/d/Projekte/ISZ/UDS-LC/work/UDS-LC_uC/application/vendor/ceedling/lib/ceedling/rules_tests.rake:71:in `block (2 levels) in <top (required)>'
/home/Mitarbeiter ISZ/.gem/ruby/2.6.0/gems/ceedling-0.28.3/bin/ceedling:311:in `block in <top (required)>'
/home/Mitarbeiter ISZ/.gem/ruby/2.6.0/gems/ceedling-0.28.3/bin/ceedling:298:in `<top (required)>'
/home/Mitarbeiter ISZ/.gem/ruby/2.6.0/bin/ceedling:23:in `load'
/home/Mitarbeiter ISZ/.gem/ruby/2.6.0/bin/ceedling:23:in `<main>'
Tasks: TOP => build/test/results/test_list.pass
(See full trace by running task with --trace)

--------------------
OVERALL TEST SUMMARY
--------------------

No tests executed.

The Problem seems to be that the line

lib/ceedling/generator_test_result.rb 28: output_string.lines do |line|

is not capable to split the output which is

 {:output=>"test_list.c:29:test_ListInit:PASS\r\n\r\n-----------------------\r\n1 Tests 0 Failures 0 Ignored \r\nOK\r\n", :exit_code=>0, :time=>0.06192088799980411}

i fixed this the following way:

From 0969d419064e4e9f2f57e2f389e8b7b20d4b269d Mon Sep 17 00:00:00 2001
From: David Ramunno <[email protected]>
Date: Tue, 21 May 2019 10:54:13 +0200
Subject: [PATCH] Fixed Carriage Return newline on MSys2 test output

---
 lib/ceedling/generator_test_results.rb | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lib/ceedling/generator_test_results.rb b/lib/ceedling/generator_test_results.rb
index 67bfce1..c9cf9fb 100644
--- a/lib/ceedling/generator_test_results.rb
+++ b/lib/ceedling/generator_test_results.rb
@@ -26,7 +26,7 @@ class GeneratorTestResults
     # remove test statistics lines
     output_string = unity_shell_result[:output].sub(TEST_STDOUT_STATISTICS_PATTERN, '')
 
-    output_string.lines do |line|
+    output_string.split(/\r?\n|\r/).each do |line|
       # process unity output
       case line
       when /(:IGNORE)/
--

appended as txt because .patch files are not supported

0001-Fixed-Carriage-Return-newline-on-MSys2-test-output.txt

RamDav avatar May 21 '19 08:05 RamDav

Have same issue on msys2 with following packets.

$ pacman -Q
asciidoc 9.1.0-1
autoconf 2.71-1
autoconf2.13 2.13-3
autogen 5.18.16-1
automake-wrapper 11-1
automake1.10 1.10.3-4
automake1.11 1.11.6-4
automake1.12 1.12.6-4
automake1.13 1.13.4-5
automake1.14 1.14.1-4
automake1.15 1.15.1-2
automake1.16 1.16.3-1
automake1.6 1.6.3-3
automake1.7 1.7.9-3
automake1.8 1.8.5-4
automake1.9 1.9.6-3
base 2020.12-1
bash 5.1.004-1
bash-completion 2.11-1
bison 3.7.6-1
brotli 1.0.9-1
bsdtar 3.5.1-1
btyacc 20200910-1
bzip2 1.0.8-2
ca-certificates 20190110-1
coreutils 8.32-1
curl 7.74.0-4
dash 0.5.11.3-1
db 5.3.28-3
diffstat 1.63-1
diffutils 3.7-1
docbook-xml 4.5-2
docbook-xsl 1.79.2-1
dos2unix 7.4.2-1
expat 2.2.10-1
file 5.39-2
filesystem 2021.02-1
findutils 4.7.0-1
flex 2.6.4-1
gawk 5.1.0-1
gcc-libs 10.2.0-1
gdb 9.2-3
gdbm 1.19-1
getent 2.18.90-2
gettext 0.19.8.1-1
gettext-devel 0.19.8.1-1
glib2 2.66.6-1
gmp 6.2.1-1
gnupg 2.2.27-1
gperf 3.1-2
grep 3.0-2
groff 1.22.4-1
gzip 1.10-1
heimdal-libs 7.7.0-2
help2man 1.47.16-1
icu 68.2-1
inetutils 1.9.4-2
info 6.7-3
intltool 0.51.0-2
less 563-2
libarchive 3.5.1-1
libargp 20110921-2
libasprintf 0.19.8.1-1
libassuan 2.5.4-1
libatomic_ops 7.6.10-1
libbz2 1.0.8-2
libcrypt 2.1-2
libcurl 7.74.0-4
libdb 5.3.28-3
libedit 20191231_3.1-2
libexpat 2.2.10-1
libffi 3.3-1
libgc 8.0.4-1
libgcrypt 1.8.7-1
libgdbm 1.19-1
libgettextpo 0.19.8.1-1
libgnutls 3.7.0-1
libgpg-error 1.41-2
libgpgme 1.15.1-1
libguile 2.2.7-1
libhogweed 3.7-1
libiconv 1.16-2
libiconv-devel 1.16-2
libidn2 2.3.0-1
libintl 0.19.8.1-1
libksba 1.4.0-1
libltdl 2.4.6-9
liblz4 1.9.3-1
liblzma 5.2.5-1
libmetalink 0.1.3-3
libnettle 3.7-1
libnghttp2 1.41.0-1
libnpth 1.6-1
libopenssl 1.1.1.i-1
libp11-kit 0.23.22-2
libpcre 8.44-1
libpcre16 8.44-1
libpcre2_16 10.36-1
libpcre2_32 10.36-1
libpcre2_8 10.36-1
libpcre2posix 10.36-1
libpcre32 8.44-1
libpcrecpp 8.44-1
libpcreposix 8.44-1
libpipeline 1.5.3-2
libpsl 0.21.1-2
libreadline 8.1.0-1
libsqlite 3.35.1-1
libssh2 1.9.0-1
libtasn1 4.16.0-1
libtool 2.4.6-9
libunistring 0.9.10-1
libunrar 6.0.3-1
libunrar-devel 6.0.3-1
libutil-linux 2.35.2-1
libxml2 2.9.10-7
libxslt 1.1.34-3
libyaml 0.2.5-1
libzstd 1.4.8-1
m4 1.4.18-2
make 4.3-1
man-db 2.9.3-1
mingw-w64-x86_64-arm-none-eabi-binutils 2.35-1
mingw-w64-x86_64-arm-none-eabi-gcc 10.1.0-1
mingw-w64-x86_64-arm-none-eabi-newlib 3.3.0-1
mingw-w64-x86_64-avr-binutils 2.35-3
mingw-w64-x86_64-avr-gcc 8.4.0-4
mingw-w64-x86_64-binutils 2.36.1-1
mingw-w64-x86_64-bzip2 1.0.8-2
mingw-w64-x86_64-ca-certificates 20200601-2
mingw-w64-x86_64-crt-git 9.0.0.6128.07922837-1
mingw-w64-x86_64-expat 2.2.10-1
mingw-w64-x86_64-gcc 10.2.0-9
mingw-w64-x86_64-gcc-ada 10.2.0-9
mingw-w64-x86_64-gcc-fortran 10.2.0-9
mingw-w64-x86_64-gcc-libgfortran 10.2.0-9
mingw-w64-x86_64-gcc-libs 10.2.0-9
mingw-w64-x86_64-gcc-objc 10.2.0-9
mingw-w64-x86_64-gdb 10.1-2
mingw-w64-x86_64-gdb-multiarch 10.1-2
mingw-w64-x86_64-gettext 0.19.8.1-10
mingw-w64-x86_64-gmp 6.2.1-1
mingw-w64-x86_64-headers-git 9.0.0.6128.07922837-1
mingw-w64-x86_64-isl 0.23-1
mingw-w64-x86_64-libffi 3.3-3
mingw-w64-x86_64-libgccjit 10.2.0-9
mingw-w64-x86_64-libiconv 1.16-2
mingw-w64-x86_64-libmangle-git 9.0.0.6128.07922837-1
mingw-w64-x86_64-libsystre 1.0.1-4
mingw-w64-x86_64-libtasn1 4.16.0-1
mingw-w64-x86_64-libtre-git r128.6fb7206-2
mingw-w64-x86_64-libwinpthread-git 9.0.0.6128.07922837-2
mingw-w64-x86_64-make 4.3-1
mingw-w64-x86_64-mpc 1.2.1-1
mingw-w64-x86_64-mpdecimal 2.5.0-1
mingw-w64-x86_64-mpfr 4.1.0-3
mingw-w64-x86_64-ncurses 6.2-2
mingw-w64-x86_64-openssl 1.1.1.j-1
mingw-w64-x86_64-p11-kit 0.23.22-1
mingw-w64-x86_64-pkgconf 1.7.3-6
mingw-w64-x86_64-python 3.8.8-2
mingw-w64-x86_64-readline 8.0.004-2
mingw-w64-x86_64-sqlite3 3.35.1-2
mingw-w64-x86_64-tcl 8.6.11-2
mingw-w64-x86_64-termcap 1.3.1-6
mingw-w64-x86_64-tk 8.6.11.1-1
mingw-w64-x86_64-tools-git 9.0.0.6128.07922837-1
mingw-w64-x86_64-windows-default-manifest 6.4-3
mingw-w64-x86_64-winpthreads-git 9.0.0.6128.07922837-2
mingw-w64-x86_64-winstorecompat-git 9.0.0.6128.07922837-1
mingw-w64-x86_64-xxhash 0.8.0-1
mingw-w64-x86_64-xz 5.2.5-2
mingw-w64-x86_64-zlib 1.2.11-9
mingw-w64-x86_64-zstd 1.4.8-2
mintty 1~3.4.5-1
mpdecimal 2.5.0-1
mpfr 4.1.0-1
msys2-keyring 1~20210213-1
msys2-launcher 1.0-1
msys2-runtime 3.1.7-6
nano 5.6.1-1
ncurses 6.2-1
nettle 3.7-1
openssl 1.1.1.i-1
p11-kit 0.23.22-2
pacman 5.2.2-13
pacman-contrib 1.4.0-1
pacman-mirrors 20210227-1
pactoys-git r2.07ca37f-1
patch 2.7.6-1
patchutils 0.4.2-1
pcre 8.44-1
pcre2 10.36-1
perl 5.32.0-2
perl-Locale-Gettext 1.07-7
perl-Module-Build 0.4231-1
perl-Test-Pod 1.52-1
perl-XML-Parser 2.46-3
perl-YAML-Syck 1.34-1
perl-inc-latest 0.500-1
pinentry 1.1.0-2
pkgconf 1.7.3-2
pkgfile 21-1
python 3.8.7-1
quilt 0.66-2
rebase 4.4.4-2
reflex 20200715-1
ruby 2.7.2-1
scons 3.1.2-4
sed 4.8-1
swig 4.0.2-1
tar 1.33-1
tcl 8.6.10-1
texinfo 6.7-3
texinfo-tex 6.7-3
tftp-hpa 5.2-3
time 1.9-1
ttyrec 1.0.8-2
tzcode 2020f-1
unrar 6.0.3-1
util-linux 2.35.2-1
wget 1.21.1-2
which 2.21-2
xmlto 0.0.28-2
xz 5.2.5-1
zlib 1.2.11-1
zstd 1.4.8-1

izon1453 avatar Mar 19 '21 14:03 izon1453

Same here. The solution was given in the original post. Yet it dates back from 2019. Can we get the regex update applied?

yannickbt avatar Mar 31 '21 18:03 yannickbt

@RamDav 's patch worked for me on MinGW64

ghost avatar May 05 '21 22:05 ghost

Works for me on MSYS64 as well .... hmm

rhempel avatar Jun 06 '21 11:06 rhempel

This issue should be fixed by PR #698.

lcavalli avatar Sep 05 '22 08:09 lcavalli

I love the patch @RamDav provided since I am using the library sys/queue.h. Thank you so much!

sirdeniel avatar Apr 02 '23 04:04 sirdeniel