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

Segmentation fault al correr los tests en MacOS X #48

Open
mgarciaisaia opened this issue Aug 28, 2014 · 15 comments
Open

Segmentation fault al correr los tests en MacOS X #48

mgarciaisaia opened this issue Aug 28, 2014 · 15 comments
Labels

Comments

@mgarciaisaia
Copy link
Member

Super baja prioridad, pero estaba probando a pedido de @gastonprieto cómo anda lo de cspecs en Mac, y me están dando un segfault los tests :(

Estoy probando en 0955634 con estos cambiecitos para que compile y corra valgrind:

diff --git a/tests/unit-tests/makefile b/tests/unit-tests/makefile
index bfe086d..94aa943 100644
--- a/tests/unit-tests/makefile
+++ b/tests/unit-tests/makefile
@@ -25,7 +25,7 @@ clean:
        $(RM) build

 test: all
-       LD_LIBRARY_PATH="../../src/build/:$(C_SPEC_BIN)" build/commons-unit-test
+       LD_LIBRARY_PATH="../../src/build/:$(C_SPEC_BIN)" DYLD_LIBRARY_PATH="../../src/build/:$(C_SPEC_BIN)" valgrind build/commons-unit-test

 dependents:
        -cd ../../ && git submodule init && git submodule update
make test
cd src && /Applications/Xcode.app/Contents/Developer/usr/bin/make all
mkdir -p build/commons/collections
gcc -shared -o "build/libcommons.so" build/commons/bitarray.o build/commons/collections/dictionary.o build/commons/collections/list.o build/commons/collections/queue.o build/commons/config.o build/commons/error.o build/commons/log.o build/commons/process.o build/commons/string.o build/commons/temporal.o build/commons/txt.o
cd tests/unit-tests && /Applications/Xcode.app/Contents/Developer/usr/bin/make all
cd ../../ && git submodule init && git submodule update
cd ../../cspec && /Applications/Xcode.app/Contents/Developer/usr/bin/make all
mkdir -p release/cspecs/
gcc -shared -o "release/libcspecs.so" release/cspecs/cspec.o
cd ../../src/ && /Applications/Xcode.app/Contents/Developer/usr/bin/make all
mkdir -p build/commons/collections
gcc -shared -o "build/libcommons.so" build/commons/bitarray.o build/commons/collections/dictionary.o build/commons/collections/list.o build/commons/collections/queue.o build/commons/config.o build/commons/error.o build/commons/log.o build/commons/process.o build/commons/string.o build/commons/temporal.o build/commons/txt.o
mkdir -p build
gcc -L"../../src/build" -L"../../cspec/release" -o "build/commons-unit-test" build/test_bitarray.o build/test_config.o build/test_dictionary.o build/test_list.o build/test_queue.o build/test_string.o -lcommons -lcspecs
cd tests/unit-tests && /Applications/Xcode.app/Contents/Developer/usr/bin/make test
cd ../../ && git submodule init && git submodule update
cd ../../cspec && /Applications/Xcode.app/Contents/Developer/usr/bin/make all
mkdir -p release/cspecs/
gcc -shared -o "release/libcspecs.so" release/cspecs/cspec.o
cd ../../src/ && /Applications/Xcode.app/Contents/Developer/usr/bin/make all
mkdir -p build/commons/collections
gcc -shared -o "build/libcommons.so" build/commons/bitarray.o build/commons/collections/dictionary.o build/commons/collections/list.o build/commons/collections/queue.o build/commons/config.o build/commons/error.o build/commons/log.o build/commons/process.o build/commons/string.o build/commons/temporal.o build/commons/txt.o
mkdir -p build
gcc -L"../../src/build" -L"../../cspec/release" -o "build/commons-unit-test" build/test_bitarray.o build/test_config.o build/test_dictionary.o build/test_list.o build/test_queue.o build/test_string.o -lcommons -lcspecs
LD_LIBRARY_PATH="../../src/build/:../../cspec/release" DYLD_LIBRARY_PATH="../../src/build/:../../cspec/release" valgrind build/commons-unit-test
==39273== Memcheck, a memory error detector
==39273== Copyright (C) 2002-2013, and GNU GPL'd, by Julian Seward et al.
==39273== Using Valgrind-3.9.0 and LibVEX; rerun with -h for copyright info
==39273== Command: build/commons-unit-test
==39273== 
==39273== WARNING: Support on MacOS 10.8/10.9 is experimental and mostly broken.
==39273== WARNING: Expect incorrect results, assertions and crashes.
==39273== WARNING: In particular, Memcheck on 32-bit programs will fail to
==39273== WARNING: detect any errors associated with heap-allocated data.
==39273== 
--39273-- build/commons-unit-test:
--39273-- dSYM directory is missing; consider using --dsymutil=yes
--39273-- /Users/mgarcia/Documents/workspace/so-commons-library/src/build/libcommons.so:
--39273-- dSYM directory is missing; consider using --dsymutil=yes
--39273-- /Users/mgarcia/Documents/workspace/so-commons-library/cspec/release/libcspecs.so:
--39273-- dSYM directory is missing; consider using --dsymutil=yes
==39273== Conditional jump or move depends on uninitialised value(s)
==39273==    at 0x39FBFB: _libxpc_initializer (in /usr/lib/system/libxpc.dylib)
==39273==    by 0x1CAA7: libSystem_initializer (in /usr/lib/libSystem.B.dylib)
==39273==    by 0x7FFF5FC11C2D: ImageLoaderMachO::doModInitFunctions(ImageLoader::LinkContext const&) (in /usr/lib/dyld)
==39273==    by 0x7FFF5FC11DB9: ImageLoaderMachO::doInitialization(ImageLoader::LinkContext const&) (in /usr/lib/dyld)
==39273==    by 0x7FFF5FC0EA61: ImageLoader::recursiveInitialization(ImageLoader::LinkContext const&, unsigned int, ImageLoader::InitializerTimingList&) (in /usr/lib/dyld)
==39273==    by 0x7FFF5FC0E9EA: ImageLoader::recursiveInitialization(ImageLoader::LinkContext const&, unsigned int, ImageLoader::InitializerTimingList&) (in /usr/lib/dyld)
==39273==    by 0x7FFF5FC0E8F5: ImageLoader::runInitializers(ImageLoader::LinkContext const&, ImageLoader::InitializerTimingList&) (in /usr/lib/dyld)
==39273==    by 0x7FFF5FC021B6: dyld::initializeMainExecutable() (in /usr/lib/dyld)
==39273==    by 0x7FFF5FC0555F: dyld::_main(macho_header const*, unsigned long, int, char const**, char const**, char const**, unsigned long*) (in /usr/lib/dyld)
==39273==    by 0x7FFF5FC0127A: dyldbootstrap::start(macho_header const*, int, char const**, long, macho_header const*, unsigned long*) (in /usr/lib/dyld)
==39273==    by 0x7FFF5FC0105D: _dyld_start (in /usr/lib/dyld)
==39273== 

  Bitarray
    ✔ should get the bit value at position
    ✔ should clean the bit value at position
    ✔ should set the bit value at position
    ✔ should get the bits count

  Config
==39273== Invalid read of size 1
==39273==    at 0xF6F4: _is_last_token.3409 (in /Users/mgarcia/Documents/workspace/so-commons-library/src/build/libcommons.so)
==39273==    by 0xFBE4: _string_split (in /Users/mgarcia/Documents/workspace/so-commons-library/src/build/libcommons.so)
==39273==    by 0xF727: string_split (in /Users/mgarcia/Documents/workspace/so-commons-library/src/build/libcommons.so)
==39273==    by 0xE650: add_cofiguration.3420 (in /Users/mgarcia/Documents/workspace/so-commons-library/src/build/libcommons.so)
==39273==    by 0xF96C: string_iterate_lines (in /Users/mgarcia/Documents/workspace/so-commons-library/src/build/libcommons.so)
==39273==    by 0xE7DB: config_create (in /Users/mgarcia/Documents/workspace/so-commons-library/src/build/libcommons.so)
==39273==    by 0x10000121E: __$__.3037 (in build/commons-unit-test)
==39273==    by 0x18571: __before_execute (in /Users/mgarcia/Documents/workspace/so-commons-library/cspec/release/libcspecs.so)
==39273==    by 0x17356: __it (in /Users/mgarcia/Documents/workspace/so-commons-library/cspec/release/libcspecs.so)
==39273==    by 0x1000013D5: __$__.3034 (in build/commons-unit-test)
==39273==    by 0x1725B: __describe (in /Users/mgarcia/Documents/workspace/so-commons-library/cspec/release/libcspecs.so)
==39273==    by 0x100001204: cspec_context_test_config (in build/commons-unit-test)
==39273==  Address 0x0 is not stack'd, malloc'd or (recently) free'd
==39273== 
==39273== 
==39273== Process terminating with default action of signal 11 (SIGSEGV)
==39273==  Access not within mapped region at address 0x0
==39273==    at 0xF6F4: _is_last_token.3409 (in /Users/mgarcia/Documents/workspace/so-commons-library/src/build/libcommons.so)
==39273==    by 0xFBE4: _string_split (in /Users/mgarcia/Documents/workspace/so-commons-library/src/build/libcommons.so)
==39273==    by 0xF727: string_split (in /Users/mgarcia/Documents/workspace/so-commons-library/src/build/libcommons.so)
==39273==    by 0xE650: add_cofiguration.3420 (in /Users/mgarcia/Documents/workspace/so-commons-library/src/build/libcommons.so)
==39273==    by 0xF96C: string_iterate_lines (in /Users/mgarcia/Documents/workspace/so-commons-library/src/build/libcommons.so)
==39273==    by 0xE7DB: config_create (in /Users/mgarcia/Documents/workspace/so-commons-library/src/build/libcommons.so)
==39273==    by 0x10000121E: __$__.3037 (in build/commons-unit-test)
==39273==    by 0x18571: __before_execute (in /Users/mgarcia/Documents/workspace/so-commons-library/cspec/release/libcspecs.so)
==39273==    by 0x17356: __it (in /Users/mgarcia/Documents/workspace/so-commons-library/cspec/release/libcspecs.so)
==39273==    by 0x1000013D5: __$__.3034 (in build/commons-unit-test)
==39273==    by 0x1725B: __describe (in /Users/mgarcia/Documents/workspace/so-commons-library/cspec/release/libcspecs.so)
==39273==    by 0x100001204: cspec_context_test_config (in build/commons-unit-test)
==39273==  If you believe this happened as a result of a stack
==39273==  overflow in your program's main thread (unlikely but
==39273==  possible), you can try to increase the size of the
==39273==  main thread stack using the --main-stacksize= flag.
==39273==  The main thread stack size used in this run was 67104768.
==39273== 
==39273== HEAP SUMMARY:
==39273==     in use at exit: 36,188 bytes in 398 blocks
==39273==   total heap usage: 501 allocs, 103 frees, 42,853 bytes allocated
==39273== 
==39273== LEAK SUMMARY:
==39273==    definitely lost: 4,096 bytes in 1 blocks
==39273==    indirectly lost: 0 bytes in 0 blocks
==39273==      possibly lost: 0 bytes in 0 blocks
==39273==    still reachable: 6,910 bytes in 25 blocks
==39273==         suppressed: 25,182 bytes in 372 blocks
==39273== Rerun with --leak-check=full to see details of leaked memory
==39273== 
==39273== For counts of detected and suppressed errors, rerun with: -v
==39273== Use --track-origins=yes to see where uninitialised values come from
==39273== ERROR SUMMARY: 2 errors from 2 contexts (suppressed: 146 from 37)
make[1]: *** [test] Segmentation fault: 11
make: [test] Error 2 (ignored)

CC: @gastonprieto @fedescarpa

@fedescarpa
Copy link
Contributor

Uh! bajón

Pregunta... probaste sin valgrind? Se que make + valgrind no se lleva muy bien, o por lo menos se que te leakea mal la memoria

@mgarciaisaia
Copy link
Member Author

Probé con valgrind porque sin él daba segfault.

En algún otro momento lo debuggearé un poco más, supongo.

Te copié a vos, pero no estoy seguro de que sea problema de cspec. Valgrind
indica que es problema del código que estamos testeando.

Quizá sería super awesome que cspec pueda "cachear" el segfault y eso, pero
dudo que eso sea fácil de hacer.

@ivan-r
Copy link

ivan-r commented Aug 28, 2014

Ahí dice:

==39273== WARNING: Support on MacOS 10.8/10.9 is experimental and mostly broken.
==39273== WARNING: Expect incorrect results, assertions and crashes.
==39273== WARNING: In particular, Memcheck on 32-bit programs will fail to
==39273== WARNING: detect any errors associated with heap-allocated data.

@gastonprieto
Copy link
Contributor

Ni se les ocurra handlear el SIGSEGV, vos no podes asegurar nada después de que hay un Segmentation Fault.

@mgarciaisaia
Copy link
Member Author

@mgarciaisaia
Copy link
Member Author

Quizá es más para abrirle un issue a cspec eso que para tenerlo acá ;-)

@fedescarpa
Copy link
Contributor

Para que sepas, el primera versión de cspecs catcheaba todas las señales. Hacer eso es fácil... Pero leyendo en muchos foros y después de hablar con Gastón, como hace un año atrás, decidí sacarlo.

El segmentation fault es una violación de segmento, y si bien se puede capturar la memoria puede quedar corrupta y provocar desastres. Por ese motivo se las saqué.

Si podría crear un proceso nuevo por cada test, lo cual garantizaría que si rompo toda la memoria es solo de ese test... pero quiero hacer eso? No creo. me la baja bastante

@fedescarpa
Copy link
Contributor

@mgarciaisaia Además recién veo que dice....

==39273== WARNING: Support on MacOS 10.8/10.9 is experimental and mostly broken.
==39273== WARNING: Expect incorrect results, assertions and crashes.
==39273== WARNING: In particular, Memcheck on 32-bit programs will fail to
==39273== WARNING: detect any errors associated with heap-allocated data.

Encontré el issue acá Homebrew/legacy-homebrew#23660
Está cerrado, no lo leí pero parece que dice como solucionarlo.

En realidad ni se si tiene que ver... pero es solo para molestarte :P

@mgarciaisaia
Copy link
Member Author

Pero sin correr valgrind rompe igual con el segfault. No le echen la culpa a él :(

(Incluso ahí dicen que ahora funciona).

Como sea, lo de correr cada test en un nuevo proceso ¿no es parte de que los tests sean independientes? :D

Puede ser una paja de implementar, no te lo voy a negar. Pero que se me pinche toda la suite de tests porque un test falla es una paja más grande :)

Onda, me gustaría esperar eso de un framework de unit testing groso. Tampoco te digo que lo implementes ya, eh, ni que no vaya a participar. Pero estaría bueno tenerlo.

@gastonprieto
Copy link
Contributor

Mati proba con la versión anterior al merge
El 28/08/2014 19:22, "Matias Garcia Isaia" notifications@github.com
escribió:

Pero sin correr valgrind rompe igual con el segfault. No le echen la
culpa a él :(

(Incluso ahí
Homebrew/legacy-homebrew#23660 (comment)
dicen que ahora funciona).

Como sea, lo de correr cada test en un nuevo proceso ¿no es parte de que
los tests sean independientes? :D

Puede ser una paja de implementar, no te lo voy a negar. Pero que se me
pinche toda la suite de tests porque un test falla es una paja más
grande :)

Onda, me gustaría esperar eso de un framework de unit testing groso.
Tampoco te digo que lo implementes ya, eh, ni que no vaya a participar.
Pero estaría bueno tenerlo.


Reply to this email directly or view it on GitHub
#48 (comment)
.

@mgarciaisaia
Copy link
Member Author

Parado en 1c0a008 más:

diff --git a/tests/unit-tests/makefile b/tests/unit-tests/makefile
index fc16564..b41c79d 100644
--- a/tests/unit-tests/makefile
+++ b/tests/unit-tests/makefile
@@ -22,7 +22,7 @@ clean:
        $(RM) build

 test: all
-       LD_LIBRARY_PATH=../../src/build/ build/commons-unit-test
+       LD_LIBRARY_PATH=../../src/build/ valgrind build/commons-unit-test

 dependents:
        -cd ../../src/ && $(MAKE) all

Rompe distinto:

make -e CC=gcc-4.6 test
cd src && /Applications/Xcode.app/Contents/Developer/usr/bin/make all
mkdir -p build/commons/collections
gcc-4.6 -shared -o "build/libcommons.so" build/commons/bitarray.o build/commons/collections/dictionary.o build/commons/collections/list.o build/commons/collections/queue.o build/commons/config.o build/commons/error.o build/commons/log.o build/commons/process.o build/commons/string.o build/commons/temporal.o build/commons/txt.o
cd tests/unit-tests && /Applications/Xcode.app/Contents/Developer/usr/bin/make all
cd ../../src/ && /Applications/Xcode.app/Contents/Developer/usr/bin/make all
mkdir -p build/commons/collections
gcc-4.6 -shared -o "build/libcommons.so" build/commons/bitarray.o build/commons/collections/dictionary.o build/commons/collections/list.o build/commons/collections/queue.o build/commons/config.o build/commons/error.o build/commons/log.o build/commons/process.o build/commons/string.o build/commons/temporal.o build/commons/txt.o
mkdir -p build
gcc-4.6 -L"../../src/build" -o "build/commons-unit-test" build/test_bitarray.o build/test_config.o build/test_dictionary.o build/test_list.o build/test_queue.o build/test_string.o build/tests.o -lcommons -lcunit
cd tests/unit-tests && /Applications/Xcode.app/Contents/Developer/usr/bin/make test
cd ../../src/ && /Applications/Xcode.app/Contents/Developer/usr/bin/make all
mkdir -p build/commons/collections
gcc-4.6 -shared -o "build/libcommons.so" build/commons/bitarray.o build/commons/collections/dictionary.o build/commons/collections/list.o build/commons/collections/queue.o build/commons/config.o build/commons/error.o build/commons/log.o build/commons/process.o build/commons/string.o build/commons/temporal.o build/commons/txt.o
mkdir -p build
gcc-4.6 -L"../../src/build" -o "build/commons-unit-test" build/test_bitarray.o build/test_config.o build/test_dictionary.o build/test_list.o build/test_queue.o build/test_string.o build/tests.o -lcommons -lcunit
LD_LIBRARY_PATH=../../src/build/ valgrind build/commons-unit-test
==41254== Memcheck, a memory error detector
==41254== Copyright (C) 2002-2013, and GNU GPL'd, by Julian Seward et al.
==41254== Using Valgrind-3.9.0 and LibVEX; rerun with -h for copyright info
==41254== Command: build/commons-unit-test
==41254== 
==41254== WARNING: Support on MacOS 10.8/10.9 is experimental and mostly broken.
==41254== WARNING: Expect incorrect results, assertions and crashes.
==41254== WARNING: In particular, Memcheck on 32-bit programs will fail to
==41254== WARNING: detect any errors associated with heap-allocated data.
==41254== 
--41254-- build/commons-unit-test:
--41254-- dSYM directory is missing; consider using --dsymutil=yes
==41254== Conditional jump or move depends on uninitialised value(s)
==41254==    at 0x3C6BFB: _libxpc_initializer (in /usr/lib/system/libxpc.dylib)
==41254==    by 0x24AA7: libSystem_initializer (in /usr/lib/libSystem.B.dylib)
==41254==    by 0x7FFF5FC11C2D: ImageLoaderMachO::doModInitFunctions(ImageLoader::LinkContext const&) (in /usr/lib/dyld)
==41254==    by 0x7FFF5FC11DB9: ImageLoaderMachO::doInitialization(ImageLoader::LinkContext const&) (in /usr/lib/dyld)
==41254==    by 0x7FFF5FC0EA61: ImageLoader::recursiveInitialization(ImageLoader::LinkContext const&, unsigned int, ImageLoader::InitializerTimingList&) (in /usr/lib/dyld)
==41254==    by 0x7FFF5FC0E9EA: ImageLoader::recursiveInitialization(ImageLoader::LinkContext const&, unsigned int, ImageLoader::InitializerTimingList&) (in /usr/lib/dyld)
==41254==    by 0x7FFF5FC0E8F5: ImageLoader::runInitializers(ImageLoader::LinkContext const&, ImageLoader::InitializerTimingList&) (in /usr/lib/dyld)
==41254==    by 0x7FFF5FC021B6: dyld::initializeMainExecutable() (in /usr/lib/dyld)
==41254==    by 0x7FFF5FC0555F: dyld::_main(macho_header const*, unsigned long, int, char const**, char const**, char const**, unsigned long*) (in /usr/lib/dyld)
==41254==    by 0x7FFF5FC0127A: dyldbootstrap::start(macho_header const*, int, char const**, long, macho_header const*, unsigned long*) (in /usr/lib/dyld)
==41254==    by 0x7FFF5FC0105D: _dyld_start (in /usr/lib/dyld)
==41254== 


     CUnit - A unit testing framework for C - Version 2.1-2
     http://cunit.sourceforge.net/


Suite: Test BitArray TAD
  Test: Test get bit value in bitarray ...passed
  Test: Test clean bitarray ...passed
  Test: Test set bitarray ...passed
  Test: Test get max bits in bitarray ...passed
Suite: Test Config TAD
  Test: Test read config ...==41254== Invalid read of size 8
==41254==    at 0xE95A: add_cofiguration.3228 (in /usr/lib/libcommons.so)
==41254==    by 0xFC9F: string_iterate_lines (in /usr/lib/libcommons.so)
==41254==    by 0xEAD8: config_create (in /usr/lib/libcommons.so)
==41254==    by 0x100001A5D: test_read_config (in build/commons-unit-test)
==41254==    by 0x18E6A: run_single_test (in /usr/local/Cellar/cunit/2.1-2/lib/libcunit.1.dylib)
==41254==    by 0x189DD: run_single_suite (in /usr/local/Cellar/cunit/2.1-2/lib/libcunit.1.dylib)
==41254==    by 0x18792: CU_run_all_tests (in /usr/local/Cellar/cunit/2.1-2/lib/libcunit.1.dylib)
==41254==    by 0x100008760: main (in build/commons-unit-test)
==41254==  Address 0x100028108 is 0 bytes after a block of size 8 alloc'd
==41254==    at 0x6DFB: malloc (in /usr/local/Cellar/valgrind/3.9.0/lib/valgrind/vgpreload_memcheck-amd64-darwin.so)
==41254==    by 0x788B: realloc (in /usr/local/Cellar/valgrind/3.9.0/lib/valgrind/vgpreload_memcheck-amd64-darwin.so)
==41254==    by 0xFACC: string_split (in /usr/lib/libcommons.so)
==41254==    by 0xE94D: add_cofiguration.3228 (in /usr/lib/libcommons.so)
==41254==    by 0xFC9F: string_iterate_lines (in /usr/lib/libcommons.so)
==41254==    by 0xEAD8: config_create (in /usr/lib/libcommons.so)
==41254==    by 0x100001A5D: test_read_config (in build/commons-unit-test)
==41254==    by 0x18E6A: run_single_test (in /usr/local/Cellar/cunit/2.1-2/lib/libcunit.1.dylib)
==41254==    by 0x189DD: run_single_suite (in /usr/local/Cellar/cunit/2.1-2/lib/libcunit.1.dylib)
==41254==    by 0x18792: CU_run_all_tests (in /usr/local/Cellar/cunit/2.1-2/lib/libcunit.1.dylib)
==41254==    by 0x100008760: main (in build/commons-unit-test)
==41254== 
==41254== Invalid read of size 1
==41254==    at 0xD46F: dictionary_put (in /usr/lib/libcommons.so)
==41254==    by 0xE975: add_cofiguration.3228 (in /usr/lib/libcommons.so)
==41254==    by 0xFC9F: string_iterate_lines (in /usr/lib/libcommons.so)
==41254==    by 0xEAD8: config_create (in /usr/lib/libcommons.so)
==41254==    by 0x100001A5D: test_read_config (in build/commons-unit-test)
==41254==    by 0x18E6A: run_single_test (in /usr/local/Cellar/cunit/2.1-2/lib/libcunit.1.dylib)
==41254==    by 0x189DD: run_single_suite (in /usr/local/Cellar/cunit/2.1-2/lib/libcunit.1.dylib)
==41254==    by 0x18792: CU_run_all_tests (in /usr/local/Cellar/cunit/2.1-2/lib/libcunit.1.dylib)
==41254==    by 0x100008760: main (in build/commons-unit-test)
==41254==  Address 0x0 is not stack'd, malloc'd or (recently) free'd
==41254== 
==41254== 
==41254== Process terminating with default action of signal 11 (SIGSEGV)
==41254==  Access not within mapped region at address 0x0
==41254==    at 0xD46F: dictionary_put (in /usr/lib/libcommons.so)
==41254==    by 0xE975: add_cofiguration.3228 (in /usr/lib/libcommons.so)
==41254==    by 0xFC9F: string_iterate_lines (in /usr/lib/libcommons.so)
==41254==    by 0xEAD8: config_create (in /usr/lib/libcommons.so)
==41254==    by 0x100001A5D: test_read_config (in build/commons-unit-test)
==41254==    by 0x18E6A: run_single_test (in /usr/local/Cellar/cunit/2.1-2/lib/libcunit.1.dylib)
==41254==    by 0x189DD: run_single_suite (in /usr/local/Cellar/cunit/2.1-2/lib/libcunit.1.dylib)
==41254==    by 0x18792: CU_run_all_tests (in /usr/local/Cellar/cunit/2.1-2/lib/libcunit.1.dylib)
==41254==    by 0x100008760: main (in build/commons-unit-test)
==41254==  If you believe this happened as a result of a stack
==41254==  overflow in your program's main thread (unlikely but
==41254==  possible), you can try to increase the size of the
==41254==  main thread stack using the --main-stacksize= flag.
==41254==  The main thread stack size used in this run was 67104768.
==41254== 
==41254== HEAP SUMMARY:
==41254==     in use at exit: 36,020 bytes in 549 blocks
==41254==   total heap usage: 641 allocs, 92 frees, 42,524 bytes allocated
==41254== 
==41254== LEAK SUMMARY:
==41254==    definitely lost: 4,096 bytes in 1 blocks
==41254==    indirectly lost: 0 bytes in 0 blocks
==41254==      possibly lost: 0 bytes in 0 blocks
==41254==    still reachable: 6,894 bytes in 181 blocks
==41254==         suppressed: 25,030 bytes in 367 blocks
==41254== Rerun with --leak-check=full to see details of leaked memory
==41254== 
==41254== For counts of detected and suppressed errors, rerun with: -v
==41254== Use --track-origins=yes to see where uninitialised values come from
==41254== ERROR SUMMARY: 3 errors from 3 contexts (suppressed: 139 from 35)
make[1]: *** [test] Segmentation fault: 11
make: [test] Error 2 (ignored)

De nuevo, sin el valgrind da segfault igual.

@fedescarpa
Copy link
Contributor

Pero ahi estas usando CUnit, verdad?

@mgarciaisaia
Copy link
Member Author

Ajam.​

¿No era esa la versión antes del merge?

@fedescarpa
Copy link
Contributor

Si. Pero eso implica que ya puedo desaparecer jajajaja

@mgarciaisaia
Copy link
Member Author

Bueno, imagino que strtok_r funcionará distinto en Linux y en OSX, porque al final parece que el problema era lo mismo que el problema de #56: next quedaba valiendo NULL, y entonces cuando hacía condition(next, size) daba SIGSEGV porque condition intentaba hacer next[0].

Supongo que con #70 se debería solucionar, pero habrá que chequearlo bien.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants