Giter Site home page Giter Site logo

clear-code / cutter Goto Github PK

View Code? Open in Web Editor NEW
49.0 11.0 53.0 15.95 MB

An easy to write and debug unit testing framework for C and C++.

Home Page: http://cutter.sourceforge.net/

Ruby 1.19% Makefile 1.57% Shell 0.23% C++ 2.57% C 93.13% CSS 0.10% HTML 0.15% Batchfile 0.02% M4 0.98% Emacs Lisp 0.01% Dockerfile 0.05%

cutter's Introduction

# -*- rd -*-

= README --- An introduction of Cutter, a Unit Testing Framework for C and C++

== Name

Cutter

== Author

=== Program

  * Kouhei Sutou <[email protected]>
  * Hiroyuki Ikezoe <[email protected]>
  * Yuto Hayamizu <[email protected]>

=== Kinotan Icons

  * Mayu & Co.

== License

  * Source: LGPLv3 or later. (detail:
    ((<"license/lgpl-3.txt"|URL:http://www.gnu.org/licenses/lgpl.html>)))
  * Document and kinotan icons: Triple license: LGPL, GFDL and/or CC.
    * LGPL: v3 or later. (detail:
      ((<"license/lgpl-3.txt"|URL:http://www.gnu.org/licenses/lgpl.html>)))
    * GFDL: v1.3 or later. (detail:
      ((<"license/gfdl-1.3.txt"|URL:http://www.gnu.org/licenses/fdl.html>)))
    * CC: ((<BY-SA|URL:http://creativecommons.org/licenses/by-sa/3.0/>))
  * Exceptions:
    * glib-compatible/glibintl.h, glib-compatible/gregex.*,
      glib-compatible/gscripttable.h, glib-compatible/gsequence.*,
      glib-compatible/gstring.*, glib-compatible/gunicode.h,
      glib-compatible/guniprop.c: LGPL v2.0 or later.
      (detail:
      ((<"glib-compatible/COPYING"|URL:http://www.gnu.org/licenses/old-licenses/lgpl-2.0.html>)))
    * glib-compatible/pcre/: PCRE LICENSE.
      (detail:
      ((<"glib-compatible/pcre/COPYING"|URL:http://www.pcre.org/licence.txt>)))
    * html/blog.*, html/download.*, html/heading-mark.*
      html/install.*, html/readme.*, html/reference.*,
      html/tango-logo.png, html/tutorial.*, html/mini-*.svg:
      Public domain. They are deliverables by ((<Tango Desktop
      Project|URL:http://tango.freedesktop.org/>)). (Some of
      them are modified.)
    * html/ja.png, html/us.png, html/famfamfam-logo.png:
      Public domain. They are distributed by
      ((<famfamfam.com|URL:http://famfamfam.com/>)).

== What's this?

Cutter is a xUnit family Unit Testing Framework for C and
C++.

This is a list of features of Cutter:
  * easy to write tests.
  * outputs result with useful format for debugging.
  * tests are built as shared libraries.

See ((<FEATURES>)) for more details.

== Dependency libraries

  * GLib >= 2.16

== Install

See ((<Install>)).

== Repository

There is the repository at ((<"clear-code/cutter on GitHub"|URL:https://github.com/clear-code/cutter/>)).

  % git clone https://github.com/clear-code/cutter.git

== Usage

  % cutter [OPTION ...] TEST_DIRECTORY

TEST_DIRECTORY should have test_*.so. test_*.so are searched
recursively.

See ((<cutter|"doc/cutter.rd">)) for more details.

== How to test

Executing flow of test is the following.

  (1) Write a test.
  (2) Compile it and build test_*.so.
  (3) Execute cutter. It loads test_*.so and runs them.

See ((<a tutorial|TUTORIAL>)) and sample/stack/.

== Test result

Here is an example test result:

  ..........F.................................................

  1) Failure: test_test_case_count
  <1 == cut_test_case_get_n_tests(test_object, NULL)>
  expected: <1>
   but was: <0>
  test/test-cut-test-case.c:143: test_test_case_count()

  Finished in 0.020857 seconds

  60 test(s), 253 assertion(s), 1 failure(s), 0 error(s), 0 pending(s), 0 notification(s)

=== Progress

A part that contains "." and "F" of the test result shows
test progress:

  ..........F.................................................

Each "." and "F" shows a test case (test function). "."
shows a test case that is succeeded and "F" shows a test
case that is failed. There are "E", "P" and "N". They shows
error, pending and notification respectively. Here is a
summary of test case marks:

: .
   A succeeded test

: F
   A failed test

: E
   A test that had an error

: P
   A test that is marked as pending

: N
   A test that had an notification

The above marks are showed after each test is finished. We
can confirm the test progress from the output in testing.

=== Summary of test result

Cutter outputs a summary of test result after all tests are
finished. The first of a summary is a list of a detail of
test result of non-succeeded test. In the example, cutter
outputs a detail of test result because there is a failure.

  1) Failure: test_test_case_count
  <1 == cut_test_case_get_n_tests(test_object, NULL)>
  expected: <1>
   but was: <0>
  test/test-cut-test-case.c:143: test_test_case_count()

In the example, test_test_case_count test case is failed. We
expected that cut_test_case_get_n_tests(test_object, NULL)
is 1 but was 0. The failed assertion is in
test_test_case_count() function in test/test-cut-test-case.c
at 143th line.

Elapsed time for testing is showed after a list of a detail
of test result:

  Finished in 0.020857 seconds

The last line is an summary of test result:

  60 test(s), 253 assertion(s), 1 failure(s), 0 error(s), 0 pending(s), 0 notification(s)

Here are the means of each output:

: n test(s)

   n test case(s) (test function(s)) are run.

: n assertion(s)

   n assertion(s) are passed.

: n failure(s)

   n assertion(s) are failed.

: n error(s)

   n error(s) are occurred (cut_error() is used n times)

: n pending(s)

   n test case(s) are pending (cut_pending() is used n times)

: n notification(s)

   n notification(s) are occurred (cut_notification() is used n times)

In the example, 60 test cases are run, 253 assertions are
passed and an assertion is failed. There are no error,
pending, notification.

=== XML report

Cutter reports test result as XML format if --xml-report
option is specified. A reported XML has the following
structure:

  <report>
    <!-- "result" tag is generated for a test result.
          Normally, a "result" tag is generated for a test.
          If you use cut_message(), you will get two or more "result" tags
          for a test. -->
    <result>
      <test-case>
        <name>TEST CASE NAME</name>
        <description>DESCRIPTION OF TEST CASE (if exists)</description>
        <start-time>START TIME OF TEST CASE (ISO 8601 format) [e.g.: 2013-11-12T03:32:56.691676Z]</start-time>
        <elapsed>ELAPSED TIME OF TEST CASE (in seconds) [e.g.: 0.030883]</elapsed>
      </test-case>
      <test>
        <name>TEST NAME</name>
        <description>DESCRIPTION OF TEST CASE (if exists)</description>
        <start-time>START TIME OF TEST (ISO 8601 format) [e.g.: 2013-11-12T03:32:56.691823Z]</start-time>
        <elapsed>ELAPSED TIME OF TEST (in seconds) [e.g.: 0.030883]</elapsed>
        <option><!-- ATTRIBUTE INFORMATION (if exists) -->
          <name>ATTRIBUTE NAME [e.g.: bug]</name>
          <value>ATTRIBUTE VALUE [e.g.: 1234]</value>
        </option>
        <option>
          ...
        </option>
        ...
      </test>
      <status>TEST RESULT (one of them: success, notification, omission, pending, failure, error, crash)</status>
      <detail>DETAIL OF TEST RESULT (if exists)</detail>
      <backtrace><!-- BACKTRACE (if exists) -->
        <entry>
          <file>FILE NAME</file>
          <line>LINE</line>
          <info>ADDITIONAL INFORMATION</info>
        </entry>
        <entry>
          ...
        </entry>
      </backtrace>
      <start-time>START TIME OF TEST (ISO 8601 format) [e.g.: 2013-11-12T03:32:56.691823Z]</start-time>
      <elapsed>ELAPSED TIME OF TEST (in seconds) [e.g.: 0.030883]</elapsed>
    </result>
    <result>
      ...
    </result>
    ...
  </report>

=== Test coverage

You can see the code coverage with Cutter if your system
have ((<LTP tools|URL:http://ltp.sourceforge.net/>)).  To
see the coverage, add the followling line in your
configure.ac and type "make coverage".

  AC_CHECK_COVERAGE

== References

=== Assertions

See ((<"cutter/cut-assertions.h"|cutter-cut-assertions.html>)).

=== Attributes

You can add attributes to your test to get more useful
information on failure. For example, you can add Bug ID like
the following

  void attributes_invalid_input(void);
  void test_invalid_input(void);

  void
  attributes_invalid_input (void)
  {
      cut_set_attributes("bug", "123");
  }

  void
  test_invalid_input (void)
  {
      cut_assert_equal("OK", get_input());
  }

In the above example, test_invalid_input test has an
attribute that the test is for Bug #123.

You need to define a function whose name is
"attributes_#{TEST_NAME - 'test_' PREFIX}" to add
attributes to a test. In the above example, attributes set
function, "attributes_invalid_input", is defined to set
"bug" attribute to "test_invalid_input" test.

=== Template

The following is a template of test.

  #include <cutter.h>
  
  #include "HEADER_FILE_OF_YOUR_PROGRAM"
  
  void test_condition(void);
  void test_strstr(void);

  static int condition = 0;
  
  void
  cut_setup (void)
  {
      condition = 1;
  }
  
  void
  cut_teardown (void)
  {
      condition = 0;
  }

  void
  test_condition(void)
  {
      cut_set_message("The condition value should be set to 1 in cut_setup()");
      cut_assert_equal_int(1, condition);
    ...
  }
  
  void
  test_strstr(void)
  {
      cut_assert_equal_string("sub-string",
                              strstr("string sub-string", "sub"));
      ...
  }
  
== Thanks

  * Kazumasa Matsunaga: reported a build bug.
  * Daijiro MORI: reported bugs.
  * UNNO Hideyuki:
    * reported a document bug.
    * assisted Solaris install document.
  * gunyara-kun: suggested API design.
  * Yamakawa Hiroshi: reported works on Cygwin.
  * Yoshinori K. Okuji:
    * reported locale related bugs.
    * suggested a new feature.
  * Zed Shaw: reported bugs.
  * Romuald Conty: reported a document bug.
  * Romain Tartière:
    * reported bugs.
    * suggested improvements.
  * Ilya Barygin:
    * reported bugs in test.
  * Hiroaki Nakamura:
    * reported a bug on CentOS.
  * Tobias Gruetzmacher:
    * fixed a GTK+ test runner bug.

cutter's People

Contributors

cosmo0920 avatar hayamiz avatar kenhys avatar kou avatar master-q avatar myokoym avatar nobu avatar noriki-nakamura avatar ohkubo avatar okkez avatar s-yata avatar wbreeze avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

cutter's Issues

test failure with gdk-pixbuf 2.38.1

Problem

./test/run-test.sh fails with gdk-pixbuf 2.38.1+dfsg-1.

Even though changed to use gdk_pixbuf_read_pixel_bytes in expected, the result of gcut_object_inspect(G_OBJECT(pixbuf1)) is still different. It seems that pixel-bytes are newly allocated implicitly.

Actual

(no modification in test/gdkcutter-pixbuf/test-gdkcut-pixbuf.c)

........................................F
===============================================================================                                                            
Failure: test_inspect
<expected == gcut_object_inspect(G_OBJECT(pixbuf1))>
expected: <"#<GdkPixbuf:0x5569acba3580 colorspace=<#<GdkColorspace: rgb(GDK_COLORSPACE_RGB:0)>>, n-channels=<4>, has-alpha=<TRUE>, bits-per-sample=<8>, width=<100>, height=<100>, rowstride=<400>, pixels=<((gpointer) 0x5569acbc7410)>, pixel-bytes=<NULL>>">                        
  actual: <"#<GdkPixbuf:0x5569acba3580 colorspace=<#<GdkColorspace: rgb(GDK_COLORSPACE_RGB:0)>>, n-channels=<4>, has-alpha=<TRUE>, bits-per-sample=<8>, width=<100>, height=<100>, rowstride=<400>, pixels=<((gpointer) 0x5569acbc7410)>, pixel-bytes=<((GBytes*) 0x5569ac7d9d60)>>">  

diff:
? "#<GdkPixbuf:0x5569acba3580 colorspace=<#<GdkColorspace: rgb(GDK_COLORSPACE_RGB:0)>>, n-channels=<4>, has-alpha=<TRUE>, bits-per-sample=<8>, width=<100>, height=<100>, rowstride=<400>, pixels=<((gpointer) 0x5569acbc7410)>, pixel-bytes=<NULL                      >>"            
?                                                                                                                                          
                                                                                                  ((GBytes*) 0x5569ac7d9d60)               

./test/gdkcutter-pixbuf/test-gdkcut-pixbuf.c:152: test_inspect(): cut_assert_equal_string_with_free(expected, gcut_object_inspect(((((GObject*) g_type_check_instance_cast ((GTypeInstance*) ((pixbuf1)), (((GType) ((20) << (2))))))))), )                                            
===============================================================================                                                            
...F
===============================================================================                                                            
Failure: test_equal
<expected_strings == actual_strings>
expected: <("equal test", NULL, "<pixbuf1 == pixbuf2> (2)
  expected: <#<GdkPixbuf:0x5569acb9f5e0 colorspace=<#<GdkColorspace: rgb(GDK_COLORSPACE_RGB:0)>>, n-channels=<4>, has-alpha=<TRUE>, bits-per-sample=<8>, width=<100>, height=<100>, rowstride=<400>, pixels=<((gpointer) 0x5569acbe2e30)>, pixel-bytes=<((GBytes*) 0x5569ac912d80)>>>  
    actual: <#<GdkPixbuf:0x5569acba3520 colorspace=<#<GdkColorspace: rgb(GDK_COLORSPACE_RGB:0)>>, n-channels=<4>, has-alpha=<TRUE>, bits-per-sample=<8>, width=<100>, height=<100>, rowstride=<400>, pixels=<((gpointer) 0x5569acbeca80)>, pixel-bytes=<((GBytes*) 0x5569ac8ffa40)>>>  
 threshold: <2>
diff image: <test-gdkcut-pixbuf-assertions.c-135.png>", "<pixbuf1 == pixbuf2> (2)                                                          
  expected: <#<GdkPixbuf:0x5569acb9f5e0 colorspace=<#<GdkColorspace: rgb(GDK_COLORSPACE_RGB:0)>>, n-channels=<4>, has-alpha=<TRUE>, bits-per-sample=<8>, width=<100>, height=<100>, rowstride=<400>, pixels=<((gpointer) 0x5569acbe2e30)>, pixel-bytes=<((GBytes*) 0x5569ac912d80)>>>  
    actual: <#<GdkPixbuf:0x5569acba3520 colorspace=<#<GdkColorspace: rgb(GDK_COLORSPACE_RGB:0)>>, n-channels=<4>, has-alpha=<TRUE>, bits-per-sample=<8>, width=<100>, height=<100>, rowstride=<400>, pixels=<((gpointer) 0x5569acbeca80)>, pixel-bytes=<((GBytes*) 0x5569ac8ffa40)>>>  
 threshold: <2>
diff image: <test-gdkcut-pixbuf-assertions.c-135.png>", NULL, NULL, "test-gdkcut-pixbuf-assertions.c:135", "stub_equal")>
  actual: <("equal test", NULL, "<pixbuf1 == pixbuf2> (2)
  expected: <#<GdkPixbuf:0x5569acb9f5e0 colorspace=<#<GdkColorspace: rgb(GDK_COLORSPACE_RGB:0)>>, n-channels=<4>, has-alpha=<TRUE>, bits-per-sample=<8>, width=<100>, height=<100>, rowstride=<400>, pixels=<((gpointer) 0x5569acbe2e30)>, pixel-bytes=<((GBytes*) 0x5569ac900090)>>>
    actual: <#<GdkPixbuf:0x5569acba3520 colorspace=<#<GdkColorspace: rgb(GDK_COLORSPACE_RGB:0)>>, n-channels=<4>, has-alpha=<TRUE>, bits-per-sample=<8>, width=<100>, height=<100>, rowstride=<400>, pixels=<((gpointer) 0x5569acbeca80)>, pixel-bytes=<((GBytes*) 0x5569ac90f160)>>>
 threshold: <2>
diff image: <test-gdkcut-pixbuf-assertions.c-135.png>", "<pixbuf1 == pixbuf2> (2)
  expected: <#<GdkPixbuf:0x5569acb9f5e0 colorspace=<#<GdkColorspace: rgb(GDK_COLORSPACE_RGB:0)>>, n-channels=<4>, has-alpha=<TRUE>, bits-per-sample=<8>, width=<100>, height=<100>, rowstride=<400>, pixels=<((gpointer) 0x5569acbe2e30)>, pixel-bytes=<((GBytes*) 0x5569ac900090)>>>
    actual: <#<GdkPixbuf:0x5569acba3520 colorspace=<#<GdkColorspace: rgb(GDK_COLORSPACE_RGB:0)>>, n-channels=<4>, has-alpha=<TRUE>, bits-per-sample=<8>, width=<100>, height=<100>, rowstride=<400>, pixels=<((gpointer) 0x5569acbeca80)>, pixel-bytes=<((GBytes*) 0x5569ac90f160)>>>
 threshold: <2>
diff image: <test-gdkcut-pixbuf-assertions.c-135.png>", NULL, NULL, "test-gdkcut-pixbuf-assertions.c:135", "stub_equal")>

diff:
  ("equal test", NULL, "<pixbuf1 == pixbuf2> (2)
?   expected: <#<GdkPixbuf:0x5569acb9f5e0 colorspace=<#<GdkColorspace: rgb(GDK_COLORSPACE_RGB:0)>>, n-channels=<4>, has-alpha=<TRUE>, bits-per-sample=<8>, width=<100>, height=<100>, rowstride=<400>, pixels=<((gpointer) 0x5569acbe2e30)>, pixel-bytes=<((GBytes*) 0x5569ac912d80)>>>
?                                                                                                                                                                                                                                                                             0009     
?     actual: <#<GdkPixbuf:0x5569acba3520 colorspace=<#<GdkColorspace: rgb(GDK_COLORSPACE_RGB:0)>>, n-channels=<4>, has-alpha=<TRUE>, bits-per-sample=<8>, width=<100>, height=<100>, rowstride=<400>, pixels=<((gpointer) 0x5569acbeca80)>, pixel-bytes=<((GBytes*) 0x5569ac8 ffa40)>>>
?                                                                                                                                                                                                                                                                            90 16      
   threshold: <2>
  diff image: <test-gdkcut-pixbuf-assertions.c-135.png>", "<pixbuf1 == pixbuf2> (2)
?   expected: <#<GdkPixbuf:0x5569acb9f5e0 colorspace=<#<GdkColorspace: rgb(GDK_COLORSPACE_RGB:0)>>, n-channels=<4>, has-alpha=<TRUE>, bits-per-sample=<8>, width=<100>, height=<100>, rowstride=<400>, pixels=<((gpointer) 0x5569acbe2e30)>, pixel-bytes=<((GBytes*) 0x5569ac912d80)>>>
?                                                                                                                                           
                                                                                                                                  0009     
?     actual: <#<GdkPixbuf:0x5569acba3520 colorspace=<#<GdkColorspace: rgb(GDK_COLORSPACE_RGB:0)>>, n-channels=<4>, has-alpha=<TRUE>, bits-p
er-sample=<8>, width=<100>, height=<100>, rowstride=<400>, pixels=<((gpointer) 0x5569acbeca80)>, pixel-bytes=<((GBytes*) 0x5569ac8 ffa40)>>>
?                                                                                                                                           
                                                                                                                                 90 16      
   threshold: <2>
  diff image: <test-gdkcut-pixbuf-assertions.c-135.png>", NULL, NULL, "test-gdkcut-pixbuf-assertions.c:135", "stub_equal")

./test/./lib/cuttest-assertions.c:284: cut_assert_test_result_helper(): gcut_assert_equal_list_string(expected_strings, actual_strings, )
./test/gdkcutter-pixbuf/test-gdkcut-pixbuf-assertions.c:171: test_equal(): cut_assert_test_result(run_context, 0, CUT_TEST_RESULT_FAILURE, "
equal test", ((void *)0), message, ((void *)0), ((void *)0), (cut_test_context_take_printf(cut_test_context_current_peek(), "%s:%d", "test-g
dkcut-pixbuf-assertions.c", fail_line)), "stub_equal", ((void *)0))
===============================================================================
..............

Finished in 5.055534 seconds (total: 3.842856 seconds)

612 test(s), 2992 assertion(s), 2 failure(s), 0 error(s), 0 pending(s), 0 omission(s), 0 notification(s)
99.6732% passed

Expected

./test/run-test.sh succeeds.

Cutter 1.2.6

いくつか残作業があるので、まとめておく。

cutter exits on a C++ exception

When a test case throws C++ exception, cutter stops test and exit soon. Is there a good way or recommended way to avoid this problem?

Drop dependency to gtkdoc-mktmpl

Problem

gtkdoc-mktmpl is removed since gtk-doc-tools 1.26.
Cutter rely on it to generate documents.

Expected

make -C doc generates documents correctly without gtkdoc-mktmpl.

Note

make -C doc still works on Debian stretch.

gtkdoc の入っていない環境で make install に失敗する

自分の手元で再現できていないのですが、gtkdoc の入っていない環境で make install に失敗します。

$ ./configure --prefix=/tmp/x --disable-gstreamer
$ make
$ make install

たぶん gtkdoc の入っていない環境でも gtk-doc.make を include してしまっているのが原因ではないかと思います。

make check fails on Fedora 21 due to using gdk-pixbuf 2.31.1

Now on Fedora 21 (already released) make check (on both cutter 1.2.4 and git head) fails like:

===============================================================================
Failure: test_inspect
<expected == gcut_object_inspect(G_OBJECT(pixbuf1))>
expected: <"#<GdkPixbuf:0x97c1958 colorspace=<#<GdkColorspace: rgb(GDK_COLORSPACE_RGB:0)>>, n-channels=<4>, has-alpha=<TRUE>, bits-per-sample=<8>, width=<100>, height=<100>, rowstride=<400>, pixels=<((gpointer) 0x98b56c8)>>">
  actual: <"#<GdkPixbuf:0x97c1958 colorspace=<#<GdkColorspace: rgb(GDK_COLORSPACE_RGB:0)>>, n-channels=<4>, has-alpha=<TRUE>, bits-per-sample=<8>, width=<100>, height=<100>, rowstride=<400>, pixels=<((gpointer) 0x98b56c8)>, pixel-bytes=<NULL>>">

diff:
? "#<GdkPixbuf:0x97c1958 colorspace=<#<GdkColorspace: rgb(GDK_COLORSPACE_RGB:0)>>, n-channels=<4>, has-alpha=<TRUE>, bits-per-sample=<8>, width=<100>, height=<100>, rowstride=<400>, pixels=<((gpointer) 0x98b56c8)>, pixel-bytes=<NULL>>"

./gdkcutter-pixbuf/test-gdkcut-pixbuf.c:143: test_inspect(): cut_assert_equal_string_with_free(expected, gcut_object_inspect(((((GObject*) g_type_check_instance_cast ((GTypeInstance*) ((pixbuf1)), (((GType) ((20) << (2))))))))), )
===============================================================================

(and now cutter srpm on Fedora FTBFS (fail to build from source) on Fedora 21, 22)

I guess this is due to this commit (and bug report):
https://git.gnome.org/browse/gdk-pixbuf/commit/?id=862e3890f54aaeb8589a6ee4c146f1fb50556004
https://bugzilla.gnome.org/show_bug.cgi?id=732297

Current "unstable" GdkPixbuf API:
https://developer.gnome.org/gdk-pixbuf/unstable/gdk-pixbuf-The-GdkPixbuf-Structure.html#GdkPixbuf--pixel-bytes

I think it is safe that 2.31.1 and above has "pixel-bytes”.

P.S. first of all Fedora 21 should not use such an "unstable" stage of gdk-pixbuf2, I think :( however that happened...

Assertions are not runned in the child processes created with cut_fork

For example, I would expect this code snippet to fail:

#include <cutter.h>

// This will pass.
void test_proveUnexpectedFailure()
{
    int pid = cut_fork();
    if (0 == pid) {
        cut_assert_equal_int(0, 1);  // If it passes, then something is wrong...
    }

    cut_assert_equal_int(0, 0); 
}

But it succeeds.

Test suite "segfaults" on Fedora 22

With Fedora 22 (GLib is now 2.43.90, same as 2.43.4) using git head (3947d29) make check fails like

FAIL: run-test.sh
============================================================================
Testsuite summary for cutter 1.2.4
============================================================================
# TOTAL: 1
# PASS:  0
# SKIP:  0
# XFAIL: 0
# FAIL:  1
# XPASS: 0
# ERROR: 0
============================================================================
See test/test-suite.log
Please report to [email protected]
============================================================================

and test/test-suite.log is:
https://bugzilla.redhat.com/attachment.cgi?id=993869

(While I have not investigated in detail) it looks like (again just my guess) this segv is derived from cutter/test-cut-test.c:323. and the signal wasn't caught properly...???

Failed to install on Debian/buster

I tried to install the cutter according to the below document.

https://cutter.osdn.jp/reference/ja/install-to-debian.html

However, I met with the below error.

sudo apt update
ヒット:1 http://security.debian.org/debian-security buster/updates InRelease
ヒット:2 https://download.docker.com/linux/debian buster InRelease                                                                                                                
ヒット:3 https://packages.groonga.org/debian buster InRelease                                                                                                                     
無視:4 https://osdn.net/projects/cutter/storage/debian buster InRelease                       
取得:5 https://osdn.net/projects/cutter/storage/debian buster Release [8,924 B]                                
取得:6 https://osdn.net/projects/cutter/storage/debian buster Release.gpg [195 B]                              
無視:6 https://osdn.net/projects/cutter/storage/debian buster Release.gpg                      
ヒット:7 http://deb.debian.org/debian buster InRelease        
ヒット:8 http://deb.debian.org/debian buster-updates InRelease
ヒット:9 https://download.virtualbox.org/virtualbox/debian buster InRelease
パッケージリストを読み込んでいます... 完了
W: GPG エラー: https://osdn.net/projects/cutter/storage/debian buster Release: 公開鍵を利用できないため、以下の署名は検証できませんでした: NO_PUBKEY 18790411F07C74AC
E: リポジトリ https://osdn.net/projects/cutter/storage/debian buster Release は署名されていません。
N: このようなリポジトリから更新を安全に行うことができないので、デフォルトでは更新が無効になっています。
N: リポジトリの作成とユーザ設定の詳細は、apt-secure(8) man ページを参照してください。

I tried to add the above public key by the below command.
However, It failed it too.

gpg --recv-key 18790411F07C74AC
gpg: key 18790411F07C74AC: new key but contains no user ID - skipped
gpg:           処理数の合計: 1
gpg:           ユーザIDなし: 1

gpg -a --export 18790411F07C74AC | sudo apt-key add -
gpg: *警告*: 何もエクスポートされていません
gpg: 有効なOpenPGPデータが見つかりません。

Release 1.2.5

修正がいくつかたまっているのとしばらく新しいのをだしていないので、今月Cutter 1.2.5としてリリースする。

懸案はホスティングでsf.netを利用しているが、依然としてshellサービスが復旧していないということ。
リポジトリやtar.gzをアップロードするのに支障がある。7/22付のblogでまだ駄目だと告知されている。
see http://sourceforge.net/blog/sourceforge-project-web-service-online/

githubにもtar.gzは置いているので、復旧が長引きそうならパッケージはあとでということにするかも。

cppcut-message.h:77: bad cal to c_str ?

cppcut-message.h:77]: (error) Dangerous usage of c_str(). The value returned by c_str() is invalid after this call.

Source code is

    CUT_EXPORT inline const char *
    string() const
    {
        return buffer_.str().c_str();
    }

Use other repository hosting

milter-manager/milter-manager#100
cutterもsf.netを利用しているので状況は同じ。

↑で言及されているようにpackagecloudに限らないけど、aptやyumのリポジトリはどこか別に移したほうがよさそう。(プロジェクトWebのホスティングはここでは置いておく)

把握している範囲だと安定的に提供する観点からいくつか不安要素がある。

  • sf.netのミラーが減少傾向にある
  • ミラー先にファイルがない状態になっていることがある(すべてのミラーをチェックしたわけではない)
  • 日本からのアクセスなのに海外のミラー先に飛ばされる(たぶん海外でも似たような状況なのでは)
  • sf.net最近障害が多い https://twitter.com/sfnet_ops

Where to get Debian packages?

We're a cutter user and previously we used the packages provided by Debian which recently has removed the package from it's repositories (https://tracker.debian.org/news/871063). I tried to follow the instructions on (http://cutter.sourceforge.net/reference/install-to-debian.html) but that doesn't work because apt-get fails to load the indices from SF:

Err http://downloads.sourceforge.net jessie/main amd64 Packages
Err http://downloads.sourceforge.net jessie/main amd64 Packages
Err http://downloads.sourceforge.net jessie/main amd64 Packages
Err http://downloads.sourceforge.net jessie/main amd64 Packages
Err http://downloads.sourceforge.net jessie/main amd64 Packages
Fetched 9633 kB in 28s (333 kB/s)
W: Failed to fetch http://downloads.sourceforge.net/project/cutter/debian/dists/jessie/main/binary-amd64/Packages

So how do I get a working cutter version now? I've already tried various modifications but without improvements.

Unable to work the tutorial on a Mac (MacOS Mojave 10.14.4)

Thank you for cutter. I've looked at the source and there's a lot to it. It is not a casual effort. Pardon me for not making a PR. It would be mostly changes to the tutorial instructions that might or might not be universally applicable. Or perhaps a version specific to Mac. In the end; however, I've run-into a library search problem that I'm not sure how to solve.

First, the problem:

~/Documents/p.temp/stack$ test/run-test.sh
-bash: test/run-test.sh: No such file or directory
~/Documents/p.temp/stack$ test/run_test.sh
Making all in src
/Library/Developer/CommandLineTools/usr/bin/make  all-am
Making all in test
make[1]: Nothing to be done for `all'.
make[1]: Nothing to be done for `all-am'.

** (cutter:89812): WARNING **: 09:44:21.468: can't load a shared object for test case: test/.libs/test_stack.so: dlopen(test/.libs/test_stack.so, 1): Library not loaded: /usr/local/lib/libstack.0.dylib
  Referenced from: /Users/dcl/Documents/p.temp/stack/test/.libs/test_stack.so
  Reason: image not found


Finished in 0.000153 seconds (total: 0.000000 seconds)

0 test(s), 0 assertion(s), 0 failure(s), 0 error(s), 0 pending(s), 0 omission(s), 0 notification(s)
0% passed
~/Documents/p.temp/stack$

While libstack.0.dylib exists in src/.libs, it is being searched as /usr/local/lib/libstack.0.dylib I'm not sure how to fix it.

I like cutter because it works most like miniTest, with which I'm familar. It:

  • has similar output
  • has setup and teardown functions
  • finds the tests, so there's no need to write a lot of test harness code. Just write tests.

If only I could make it work!

Following are some notes from following the tutorial. There were a number of differences.
For starters, I installed with brew install cutter autoconf automake libtool This gave the following versions:

cutter 1.2.6
autoconf (GNU Autoconf) 2.69
glibtool (GNU libtool) 2.4.6
automake (GNU automake) 1.16.1
  • The brew libtool installs as glibtool in order not to overwrite libtool already installed. However libtoolize is not linked into the path. Thus, in autogen.sh I replaced libtoolize with glibtoolize.
  • Note, GNU build tools looks like it is moving away from alocal and the invocations of autogen.sh toward use of autoreconf. See for example, Future of alocal
  • Upgraded the use of AM_INIT_AUTOMAKE to call it without parameters. See Automake public macros
  • I'm using underscores '_' in place of hyphens '-' in the file names. Personal preference and hoping that won't make problems.
  • glibtoolize had suggestions for using m4, which I followed. They were:
glibtoolize: Consider adding '-I m4' to ACLOCAL_AMFLAGS in Makefile.am
glibtoolize: Consider adding 'AC_CONFIG_MACRO_DIRS([m4])' to configure.ac,
glibtoolize: and rerunning glibtoolize and aclocal.

(Backing-out these changes didn't solve my linking problem.)

  • Having set-up stack.h, I got linker errors for undefined symbols. Cutter ran without errors, only not running any tests.
  • After setting-up test/run-test.sh, make -s check needed me to rerun autogen.sh in order to install test-driver.
  • I was unable to add the echo-cutter target to test/Makefile.am due to this error:
config.status: error: in `/Users/dcl/Documents/p.temp/stack':
config.status: error: Something went wrong bootstrapping makefile fragments
    for automatic dependency tracking.  Try re-running configure with the
    '--disable-dependency-tracking' option to at least be able to build
    the package (albeit without support for automatic dependency tracking).
  • Rurunning autogen.sh I got a warning asking to substitute AM_CPPFLAGS for INCLUDES. I changed "INCLUDES" to "test_stack_la_CPPFLAGS"
  • After implementing stack.c and setting it up for for compile, zero tests run and I get the dynamic link library not found error.

Find the files in this gist: https://gist.github.com/wbreeze/4b49948740278cdd156c5f9478bfebf5

Invalid UTF-8 passed to g_io_channel_write_chars()

I've just noticed that current cutter (HEAD) test fails.

How to reproduce:

./run-test.sh

I've executed on Debian/GNU Linux unstable.

Actual result: there are 2 failures.

  • cppcut_assertion_message::test_format
  • cppcut_assertion_message::test_shift

Here is the output log.

Failure: cppcut_assertion_message::test_format
<expected_strings == actual_strings>
expected: <("optional message test", "The message of assertion", "<"abcde" == "ABCDE">", "The message of assertion
<"abcde" == "ABCDE">
expected: <"abcde">
  actual: <"ABCDE">", ""abcde"", ""ABCDE"", "test-cppcut-assertions.cpp:1331", "void cppcut_assertion_message::stub_format()")>
  actual: <[Invalid UTF-8] \x1b[01;31m("optional message test", "\x80_\x04\x01", "<"abcde" == "ABCDE">", "\x80_\x04\x01
<"abcde" == "ABCDE">
expected: <"abcde">
  actual: <"ABCDE">", ""abcde"", ""ABCDE"", "test-cppcut-assertions.cpp:1331", "void cppcut_assertion_message::stub_format()")\x1b[00m>

diff:
? ("optional message test", "The message of assertion", "<"abcde" == "ABCDE">", "The message of assertion
?                            [Invalid UTF-8] \x1b[01;37m\x1b[41m\x80_\x04\x01\x1b[00m                                                [Invalid UTF-8] \x1b[01;37m\x1b[41m
\x80_\x04\x01\x1b[00m                    
  <"abcde" == "ABCDE">
  expected: <"abcde">
    actual: <"ABCDE">", ""abcde"", ""ABCDE"", "test-cppcut-assertions.cpp:1331", "void cppcut_assertion_message::stub_format()")

././lib/cuttest-assertions.c:284: cut_assert_test_result_helper(): gcut_assert_equal_list_string(expected_strings, actual_strings, )
./cppcutter/test-cppcut-assertions.cpp:1347: void cppcut_assertion_message::test_format(): cut_assert_test_result(run_context, 0, CUT_TEST_RESULT_FAILURE, "optional mes
sage test", "The message of assertion", "<\"abcde\" == \"ABCDE\">", "\"abcde\"", "\"ABCDE\"", (cut_test_context_take_printf(cut_test_context_current_peek(), "%s:%d", "t
est-cppcut-assertions.cpp", fail_line)), "void cppcut_assertion_message::stub_format()", __null)
===============================================================================

(lt-cutter:11381): GLib-WARNING **: Invalid UTF-8 passed to g_io_channel_write_chars().

** (lt-cutter:11381): WARNING **: WriteError: g_convert_error:1: Invalid byte sequence in conversion input

F
===============================================================================
Failure: cppcut_assertion_message::test_shift
<expected_strings == actual_strings>
expected: <("optional message test", "The message of assertion", "<"abcde" == "ABCDE">", "The message of assertion
<"abcde" == "ABCDE">
expected: <"abcde">
  actual: <"ABCDE">", ""abcde"", ""ABCDE"", "test-cppcut-assertions.cpp:1355", "void cppcut_assertion_message::stub_shift()")>
  actual: <[Invalid UTF-8] \x1b[01;31m("optional message test", "\xd0\xfb\x06\x01", "<"abcde" == "ABCDE">", "\xd0\xfb\x06\x01
<"abcde" == "ABCDE">
expected: <"abcde">
  actual: <"ABCDE">", ""abcde"", ""ABCDE"", "test-cppcut-assertions.cpp:1355", "void cppcut_assertion_message::stub_shift()")\x1b[00m>

diff:
? ("optional message test", "The message of assertion", "<"abcde" == "ABCDE">", "The message of assertion
?                            [Invalid UTF-8] \x1b[01;37m\x1b[41m\xd0\xfb\x06\x01\x1b[00m                                                 [Invalid UTF-8] \x1b[01;37m\x1b
[41m\xd0\xfb\x06\x01\x1b[00m                     
  <"abcde" == "ABCDE">
  expected: <"abcde">
    actual: <"ABCDE">", ""abcde"", ""ABCDE"", "test-cppcut-assertions.cpp:1355", "void cppcut_assertion_message::stub_shift()")

././lib/cuttest-assertions.c:284: cut_assert_test_result_helper(): gcut_assert_equal_list_string(expected_strings, actual_strings, )
./cppcutter/test-cppcut-assertions.cpp:1371: void cppcut_assertion_message::test_shift(): cut_assert_test_result(run_context, 0, CUT_TEST_RESULT_FAILURE, "optional mess
age test", "The message of assertion", "<\"abcde\" == \"ABCDE\">", "\"abcde\"", "\"ABCDE\"", (cut_test_context_take_printf(cut_test_context_current_peek(), "%s:%d", "te
st-cppcut-assertions.cpp", fail_line)), "void cppcut_assertion_message::stub_shift()", __null)
===============================================================================

(lt-cutter:11381): GLib-WARNING **: Invalid UTF-8 passed to g_io_channel_write_chars().

** (lt-cutter:11381): WARNING **: WriteError: g_convert_error:1: Invalid byte sequence in conversion input

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.