ATF-devel archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: Try to build atf 0.4 under ALT Linux



On Wed, Mar 19, 2008 at 12:22 PM, Slava Semushin 
<php-coder%altlinux.org@localhost> wrote:
> 2008/3/19, Julio M. Merino Vidal <jmmv84 / gmail.com>:
>  > I have never seen it here in any of the platforms I test the code under.
>
>  It's because you BSD-user? ;-)

I test releases under many more systems as seen here:

http://www.netbsd.org/~jmmv/atf/download.html

Doing that is painful, but must be done! ;-)

>  >  Which version of GCC are you using, and under which platform?
>
>  [c0der@xxx ~]$ rpm -q glibc-core gcc4.1
>  glibc-core-2.5.1-alt3
>  gcc4.1-4.1.2-alt1
>
>  My machine is x86_64, but all system compiled for i586. I think it
>  doesn't matter.

Hmm... I now checked and I have glibc-2.7-2 here in a Fedora 8 x86_64
box.  I notice that the system function's prototype in stdlib.h is
marked with __wur, which I assume is the warn_unused_result your log
showed.  After some investigation (*), I found that these checks are
only issued when you build with -D_FORTIFY_SOURCE=2.  Remove that flag
from your build and things should work without patches.

* http://www.mailinglistarchive.com/gcc%gcc.gnu.org@localhost/msg07617.html

>  >  >  So I think we should:
>  >  >  - check exit code returned by system()
>  > The attached patch should fix this for you.  I'll commit it to the
>  >  tree later today when I get back home.
>
>  Patch fixes only first error. Second still exists and now compilation fails 
> at:

Oops, sorry.  I did not notice the second warning in your message.

> tools/atf-run.cpp: In function 'void call_hook(const std::string&,
>  const std::string&)':
>  tools/atf-run.cpp:573: warning: ignoring return value of 'int
>  system(const char*)', declared with attribute warn_unused_result

Try again with the attached patch.

> >  >  - add --disable-werror flag to configure (now I just add sed -i
>  >  >  '/-Werror/d' m4/developer-mode.m4 but it's looks like a hack)
>  > No, sorry.  Developer mode is meant to catch all these problems, and
>  >  thus this is why it enables all kinds of warnings and enforces
>  >  -Werror.  You can always pass --disable-developer to the configure
>  >  script, but I wouldn't do this because you will not get run-time
>  >  assertion checks (which are very useful at this point of development).
>
>  So, why developer mode is enabled by default in the stable version (0.4)?

Typically 0.x releases are not stable.  It is a formal release, but it
cannot be considered stable (not even beta!).  The NEWS file mentions
the status of all releases.

>  [...]
>
> >  >  testsuite: error: cannot find atf-config
>  >  >  FAIL: ./tests/bootstrap/testsuite
>  >  >  =====================================
>  >  >  1 of 1 tests failed
>
> > This is the normal behavior of autotest.  You need to have the
>  >  installation directory in the path for it to find the binaries; this
>  >  way you can run the same test suite against different installations.
>  >  Or alternatively add the $(srcdir)/tools directory to the path, if you
>  >  want to run 'make check' prior installation; it should work.
>
>  Ok. It helps me pass some tests:
>  [...]
>  What I should do next?
>
>  In attach testsuite.log file. I see many errors like
>
>  atf_test_case: command not found

Aha.  Well, that's normal based on what I see in the log, because the
code is trying to use some files that should be installed, but which
aren't because you did not run make install yet.  There are some
workarounds for this which might let you go a bit further, but I'm not
sure you want to know them.  Using them are begging for failure, at
least at the moment because that situation is not regularly tested.
For now I suggest you to run make check only after you have run make
install and adjusted the path correctly to point to prefix/bin.  But
I'll think about this and maybe change the code to ensure that 'make
check' works prior installation.

>  And this command really not found:
>
>  [c0der@xxx ~]$ find RPM -name atf_test_case
>  [c0der@xxx ~]$

atf_test_case is a function defined by atf.footer.subr, which is not
correctly sourced in the test programs as shown in the logs (due to
what I mentioned above).

> >  >  Also one bug: I always use make --silent but I see all commands for
>  >  >  compilatioa as is. It shouldn't be shown.
>  >
>  > Does 'make --silent' work with any package that uses Automake and
>  >  Libtool?  I've tried that here and I see all kinds of commands
>  >  generated by these tools, so most likely this is not ATF's fault.
>
>  Most of package shown nothing with --silent option.
> [...]
>    The `-s' or `--silent' flag to `make' prevents all echoing, as if
>  all commands started with `@'.  A rule in the makefile for the special
>  target `.SILENT' without prerequisites has the same effect (*note
>  Special Built-in Target Names: Special Targets.).  `.SILENT' is
>  essentially obsolete since `@' is more flexible.

The problem is that Automake generates command lines that run 'echo'
to print the command to be executed.  Using @ in these won't have your
desired result.  And there is nothing I can do to resolve this.

If you want silent output, just do 'make >/dev/null'.

Kind regards,

-- 
Julio M. Merino Vidal <jmmv84%gmail.com@localhost>
#
# old_revision [4eb0a4c867f5dca54cc649efb8774ab6828a90ea]
#
# patch "tests/atf/test_programs/h_cpp.cpp"
#  from [35af6e21cdd024ed8d1cc259e7ca32781e794dd3]
#    to [0f43431d0fc04c2f7e6a12bcc94e6cf732e82f48]
# 
# patch "tools/atf-run.cpp"
#  from [0ecc06fc74cdd31dabc430f651cebc13f02e4c92]
#    to [64156f4093d691356545369575ccf11a7911592f]
#
============================================================
--- tests/atf/test_programs/h_cpp.cpp   35af6e21cdd024ed8d1cc259e7ca32781e794dd3
+++ tests/atf/test_programs/h_cpp.cpp   0f43431d0fc04c2f7e6a12bcc94e6cf732e82f48
@@ -251,7 +251,9 @@ ATF_TEST_CASE_BODY(env_list)
 }
 ATF_TEST_CASE_BODY(env_list)
 {
-    std::system("env");
+    int exitcode = std::system("env");
+    ATF_CHECK(WIFEXITED(exitcode));
+    ATF_CHECK(WEXITSTATUS(exitcode) == EXIT_SUCCESS);
 }
 
 // ------------------------------------------------------------------------
============================================================
--- tools/atf-run.cpp   0ecc06fc74cdd31dabc430f651cebc13f02e4c92
+++ tools/atf-run.cpp   64156f4093d691356545369575ccf11a7911592f
@@ -571,7 +571,12 @@ call_hook(const std::string& tool, const
     atf::fs::path p = atf::fs::path(atf::config::get("atf_pkgdatadir")) /
                       (tool + ".hooks");
     std::string cmd = sh + " '" + p.str() + "' '" + hook + "'";
-    std::system(cmd.c_str());
+    int exitcode = std::system(cmd.c_str());
+    if (!WIFEXITED(exitcode) || WEXITSTATUS(exitcode) != EXIT_SUCCESS)
+        throw std::runtime_error("Failed to run the '" + hook + "' hook "
+                                 "for '" + tool + "'; command was '" +
+                                 cmd + "'; exit code " +
+                                 atf::text::to_string(exitcode));
 }
 
 int


Home | Main Index | Thread Index | Old Index