thewtex / tmux-mem-cpu-load

CPU, RAM, and load monitor for use with tmux
Apache License 2.0
1.02k stars 136 forks source link

--colors broken on OpenBSD #20

Closed jasperla closed 9 years ago

jasperla commented 9 years ago

When running the tests for an upcoming OpenBSD port I noticed that the --colors test fails:

===>  Regression tests for tmux-mem-cpu-load-3.2.0
[1/1] cd /usr/obj/ports/tmux-mem-cpu-load-3.2.0/build-amd64 && /usr/local/bin/ctest --force-new-ctest-process
Test project /usr/obj/ports/tmux-mem-cpu-load-3.2.0/build-amd64
    Start 1: usage
1/8 Test #1: usage ............................   Passed    0.00 sec
    Start 2: no_arguments
2/8 Test #2: no_arguments .....................   Passed    1.00 sec
    Start 3: custom_interval
3/8 Test #3: custom_interval ..................   Passed    3.00 sec
    Start 4: no_cpu_graph
4/8 Test #4: no_cpu_graph .....................   Passed    1.00 sec
    Start 5: colors
5/8 Test #5: colors ...........................***Exception: SegFault  0.01 sec
    Start 6: invalid_status_interval
6/8 Test #6: invalid_status_interval ..........   Passed    0.00 sec
    Start 7: invalid_graph_lines
7/8 Test #7: invalid_graph_lines ..............   Passed    0.00 sec
    Start 8: old_option_specification
8/8 Test #8: old_option_specification .........   Passed    0.00 sec

88% tests passed, 1 tests failed out of 8

Total Test time (real) =   5.03 sec

The following tests FAILED:
          5 - colors (SEGFAULT)
Errors while running CTest

Backtrace:

(gdb) bt
#0  strlen () at /usr/src/lib/libc/arch/amd64/string/strlen.S:124
#1  0x00000ab7751abdb1 in operator<< <std::char_traits<char> > (__out=@0x7f7fffff9bd8, 
    __s=0xab545001620 <Address 0xab545001620 out of bounds>) at char_traits.h:258
#2  0x00000ab544f02a74 in mem_string (use_colors=true) at memory.cc:106
#3  0x00000ab544f0226b in main (argc=2, argv=0x7f7fffff9e68) at main.cc:157
Current language:  auto; currently asm
(gdb) bt full
#0  strlen () at /usr/src/lib/libc/arch/amd64/string/strlen.S:124
No locals.
#1  0x00000ab7751abdb1 in operator<< <std::char_traits<char> > (__out=@0x7f7fffff9bd8, 
    __s=0xab545001620 <Address 0xab545001620 out of bounds>) at char_traits.h:258
No locals.
#2  0x00000ab544f02a74 in mem_string (use_colors=true) at memory.cc:106
        hw_pagesize = {6, 7}
        vm_totalmem = {2, 1}
        vm_bcstats = {10, 0, 3}
        oss = <incomplete type>
        total_mem = -409329664
        used_mem = 1488257024
        free_mem = -1897586688
        size = 120
        page_size = 1
        vm_total = {t_rq = 1, t_dw = 7, t_pw = 0, t_sl = 63, t_sw = 0, t_vm = 468078, t_avm = 268424, 
  t_rm = 468078, t_arm = 268424, t_vmshr = 0, t_avmshr = 0, t_rmshr = 0, t_armshr = 0, t_free = 480564}
        bcstats = {numbufs = 26146, numbufpages = 104734, numdirtypages = 736, numcleanpages = 103998, 
  pendingwrites = 0, pendingreads = 0, numwrites = 38431, numreads = 29518, cachehits = 451144, busymapped = 0, 
  dmapages = 0, highpages = 0, delwribufs = 184, kvaslots = 6553, kvaslots_avail = 6553}
#3  0x00000ab544f0226b in main (argc=2, argv=0x7f7fffff9e68) at main.cc:157
        long_options = {{name = 0xab5450041d0 "help", has_arg = 0, flag = 0x0, val = 104}, {
    name = 0xab5450041d5 "colors", has_arg = 0, flag = 0x0, val = 99}, {name = 0xab5450041dc "interval", 
    has_arg = 1, flag = 0x0, val = 105}, {name = 0xab5450041e5 "graph-lines", has_arg = 1, flag = 0x0, 
    val = 103}, {name = 0x0, has_arg = 0, flag = 0x0, val = 0}}
        cpu_usage_delay = 990000
        graph_lines = 10
        use_colors = true
        c = -1
(gdb) 

This happens both with and without MALLOC_OPTIONS set to S. Note that even when run without --colors the memory reporting is odd:

1421/-390MB [ ]

jasperla commented 9 years ago

With #22 applied this is fixed:

[1/1] cd /usr/obj/ports/tmux-mem-cpu-load-3.2.0/build-amd64 && /usr/local/bin/ctest --force-new-ctest-process
Test project /usr/obj/ports/tmux-mem-cpu-load-3.2.0/build-amd64
    Start 1: usage
1/8 Test #1: usage ............................   Passed    0.00 sec
    Start 2: no_arguments
2/8 Test #2: no_arguments .....................   Passed    1.00 sec
    Start 3: custom_interval
3/8 Test #3: custom_interval ..................   Passed    3.00 sec
    Start 4: no_cpu_graph
4/8 Test #4: no_cpu_graph .....................   Passed    1.00 sec
    Start 5: colors
5/8 Test #5: colors ...........................   Passed    1.00 sec
    Start 6: invalid_status_interval
6/8 Test #6: invalid_status_interval ..........   Passed    0.00 sec
    Start 7: invalid_graph_lines
7/8 Test #7: invalid_graph_lines ..............   Passed    0.00 sec
    Start 8: old_option_specification
8/8 Test #8: old_option_specification .........   Passed    0.00 sec

100% tests passed, 0 tests failed out of 8

Total Test time (real) =   6.02 sec
thewtex commented 9 years ago

22 merged.