<feed xmlns='http://www.w3.org/2005/Atom'>
<title>delta/NetworkManager.git/shared/nm-test-utils-impl.c, branch th/device-availability</title>
<subtitle>gitlab.freedesktop.org: NetworkManager/NetworkManager.git
</subtitle>
<link rel='alternate' type='text/html' href='http://git.baserock.org/cgit/delta/NetworkManager.git/'/>
<entry>
<title>all: don't use gchar/gshort/gint/glong but C types</title>
<updated>2018-07-11T10:02:06+00:00</updated>
<author>
<name>Thomas Haller</name>
<email>thaller@redhat.com</email>
</author>
<published>2018-07-11T05:40:19+00:00</published>
<link rel='alternate' type='text/html' href='http://git.baserock.org/cgit/delta/NetworkManager.git/commit/?id=e1c7a2b5d0b142a3d4347ec6f1934f53c4b402a9'/>
<id>e1c7a2b5d0b142a3d4347ec6f1934f53c4b402a9</id>
<content type='text'>
We commonly don't use the glib typedefs for char/short/int/long,
but their C types directly.

    $ git grep '\&lt;g\(char\|short\|int\|long\|float\|double\)\&gt;' | wc -l
    587
    $ git grep '\&lt;\(char\|short\|int\|long\|float\|double\)\&gt;' | wc -l
    21114

One could argue that using the glib typedefs is preferable in
public API (of our glib based libnm library) or where it clearly
is related to glib, like during

  g_object_set (obj, PROPERTY, (gint) value, NULL);

However, that argument does not seem strong, because in practice we don't
follow that argument today, and seldomly use the glib typedefs.
Also, the style guide for this would be hard to formalize, because
"using them where clearly related to a glib" is a very loose suggestion.

Also note that glib typedefs will always just be typedefs of the
underlying C types. There is no danger of glib changing the meaning
of these typedefs (because that would be a major API break of glib).

A simple style guide is instead: don't use these typedefs.

No manual actions, I only ran the bash script:

  FILES=($(git ls-files '*.[hc]'))
  sed -i \
      -e 's/\&lt;g\(char\|short\|int\|long\|float\|double\)\&gt;\( [^ ]\)/\1\2/g' \
      -e 's/\&lt;g\(char\|short\|int\|long\|float\|double\)\&gt;  /\1   /g' \
      -e 's/\&lt;g\(char\|short\|int\|long\|float\|double\)\&gt;/\1/g' \
      "${FILES[@]}"
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
We commonly don't use the glib typedefs for char/short/int/long,
but their C types directly.

    $ git grep '\&lt;g\(char\|short\|int\|long\|float\|double\)\&gt;' | wc -l
    587
    $ git grep '\&lt;\(char\|short\|int\|long\|float\|double\)\&gt;' | wc -l
    21114

One could argue that using the glib typedefs is preferable in
public API (of our glib based libnm library) or where it clearly
is related to glib, like during

  g_object_set (obj, PROPERTY, (gint) value, NULL);

However, that argument does not seem strong, because in practice we don't
follow that argument today, and seldomly use the glib typedefs.
Also, the style guide for this would be hard to formalize, because
"using them where clearly related to a glib" is a very loose suggestion.

Also note that glib typedefs will always just be typedefs of the
underlying C types. There is no danger of glib changing the meaning
of these typedefs (because that would be a major API break of glib).

A simple style guide is instead: don't use these typedefs.

No manual actions, I only ran the bash script:

  FILES=($(git ls-files '*.[hc]'))
  sed -i \
      -e 's/\&lt;g\(char\|short\|int\|long\|float\|double\)\&gt;\( [^ ]\)/\1\2/g' \
      -e 's/\&lt;g\(char\|short\|int\|long\|float\|double\)\&gt;  /\1   /g' \
      -e 's/\&lt;g\(char\|short\|int\|long\|float\|double\)\&gt;/\1/g' \
      "${FILES[@]}"
</pre>
</div>
</content>
</entry>
<entry>
<title>Increase timeout in test-nm-client to 30s</title>
<updated>2018-07-05T14:48:06+00:00</updated>
<author>
<name>Michael Biebl</name>
<email>biebl@debian.org</email>
</author>
<published>2018-07-05T01:53:35+00:00</published>
<link rel='alternate' type='text/html' href='http://git.baserock.org/cgit/delta/NetworkManager.git/commit/?id=7ab7dc94873984fdb026dc3e16ce52d31b227623'/>
<id>7ab7dc94873984fdb026dc3e16ce52d31b227623</id>
<content type='text'>
On slow architectures it can take longer then 3s for the test service to
start up.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
On slow architectures it can take longer then 3s for the test service to
start up.
</pre>
</div>
</content>
</entry>
<entry>
<title>build: use default NM_BUILD_* defines for tests</title>
<updated>2018-05-31T13:59:38+00:00</updated>
<author>
<name>Thomas Haller</name>
<email>thaller@redhat.com</email>
</author>
<published>2018-05-30T08:23:17+00:00</published>
<link rel='alternate' type='text/html' href='http://git.baserock.org/cgit/delta/NetworkManager.git/commit/?id=b7426e91dbcbc9080e0018a43efd0aec1f5fc5ba'/>
<id>b7426e91dbcbc9080e0018a43efd0aec1f5fc5ba</id>
<content type='text'>
Use two common defines NM_BUILD_SRCDIR and NM_BUILD_BUILDDIR
for specifying the location of srcdir and builddir.

Note that this is only relevant for tests, as they expect
a certain layout of the directories, to find files that concern
them.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Use two common defines NM_BUILD_SRCDIR and NM_BUILD_BUILDDIR
for specifying the location of srcdir and builddir.

Note that this is only relevant for tests, as they expect
a certain layout of the directories, to find files that concern
them.
</pre>
</div>
</content>
</entry>
<entry>
<title>tests: use libnm via pygobject in tools/test-networkmanager-service.py</title>
<updated>2018-05-11T14:51:20+00:00</updated>
<author>
<name>Thomas Haller</name>
<email>thaller@redhat.com</email>
</author>
<published>2018-05-06T06:51:26+00:00</published>
<link rel='alternate' type='text/html' href='http://git.baserock.org/cgit/delta/NetworkManager.git/commit/?id=9628aabc2fbf9315eb9c87478da1588c72d8b44c'/>
<id>9628aabc2fbf9315eb9c87478da1588c72d8b44c</id>
<content type='text'>
tools/test-networkmanager-service.py is our NetworkManager stub server.

NetworkManager uses libnm(-core) heavily, for example to decide whether
a connection verifies (nm_connection_verify()) and for normalizing
connections (nm_connection_normalize()).

If the stub server wants to mimic NetworkManager, it also must use these
function. Luckily, we already can do so, by loading libnm using python
GObject introspection.

We already correctly set GI_TYPELIB_PATH search path, so that the
correct libnm is loaded -- provided that we build with introspection
enabled.

We still need to gracefully fail, if starting the stub server fails.
That requries some extra effort. If the stub server notices that
something is missing, it shall exit with status 77. That will cause
the tests to g_test_skip().
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
tools/test-networkmanager-service.py is our NetworkManager stub server.

NetworkManager uses libnm(-core) heavily, for example to decide whether
a connection verifies (nm_connection_verify()) and for normalizing
connections (nm_connection_normalize()).

If the stub server wants to mimic NetworkManager, it also must use these
function. Luckily, we already can do so, by loading libnm using python
GObject introspection.

We already correctly set GI_TYPELIB_PATH search path, so that the
correct libnm is loaded -- provided that we build with introspection
enabled.

We still need to gracefully fail, if starting the stub server fails.
That requries some extra effort. If the stub server notices that
something is missing, it shall exit with status 77. That will cause
the tests to g_test_skip().
</pre>
</div>
</content>
</entry>
<entry>
<title>build: refine the NETWORKMANAGER_COMPILATION define</title>
<updated>2018-01-08T11:38:53+00:00</updated>
<author>
<name>Thomas Haller</name>
<email>thaller@redhat.com</email>
</author>
<published>2018-01-02T12:37:06+00:00</published>
<link rel='alternate' type='text/html' href='http://git.baserock.org/cgit/delta/NetworkManager.git/commit/?id=22ef6a507a308f2fe495b60bef78ac2ca00fb6d2'/>
<id>22ef6a507a308f2fe495b60bef78ac2ca00fb6d2</id>
<content type='text'>
Note that:

 - we compile some source files multiple times. Most notably those
   under "shared/".

 - we include a default header "shared/nm-default.h" in every source
   file. This header is supposed to setup a common environment by defining
   and including parts that are commonly used. As we always include the
   same header, the header must behave differently depending
   one whether the compilation is for libnm-core, NetworkManager or
   libnm-glib. E.g. it must include &lt;glib/gi18n.h&gt; or &lt;glib/gi18n-lib.h&gt;
   depending on whether we compile a library or an application.

For that, the source files need the NETWORKMANAGER_COMPILATION #define
to behave accordingly.

Extend the define to be composed of flags. These flags are all named
NM_NETWORKMANAGER_COMPILATION_WITH_*, they indicate which part of the
build are available. E.g. when building libnm-core.la itself, then
WITH_LIBNM_CORE, WITH_LIBNM_CORE_INTERNAL, and WITH_LIBNM_CORE_PRIVATE
are available. When building NetworkManager, WITH_LIBNM_CORE_PRIVATE
is not available but the internal parts are still accessible. When
building nmcli, only WITH_LIBNM_CORE (the public part) is available.
This granularily controls the build.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Note that:

 - we compile some source files multiple times. Most notably those
   under "shared/".

 - we include a default header "shared/nm-default.h" in every source
   file. This header is supposed to setup a common environment by defining
   and including parts that are commonly used. As we always include the
   same header, the header must behave differently depending
   one whether the compilation is for libnm-core, NetworkManager or
   libnm-glib. E.g. it must include &lt;glib/gi18n.h&gt; or &lt;glib/gi18n-lib.h&gt;
   depending on whether we compile a library or an application.

For that, the source files need the NETWORKMANAGER_COMPILATION #define
to behave accordingly.

Extend the define to be composed of flags. These flags are all named
NM_NETWORKMANAGER_COMPILATION_WITH_*, they indicate which part of the
build are available. E.g. when building libnm-core.la itself, then
WITH_LIBNM_CORE, WITH_LIBNM_CORE_INTERNAL, and WITH_LIBNM_CORE_PRIVATE
are available. When building NetworkManager, WITH_LIBNM_CORE_PRIVATE
is not available but the internal parts are still accessible. When
building nmcli, only WITH_LIBNM_CORE (the public part) is available.
This granularily controls the build.
</pre>
</div>
</content>
</entry>
<entry>
<title>all: use nm_close() instead of close()</title>
<updated>2017-11-14T14:10:42+00:00</updated>
<author>
<name>Thomas Haller</name>
<email>thaller@redhat.com</email>
</author>
<published>2017-11-14T13:22:21+00:00</published>
<link rel='alternate' type='text/html' href='http://git.baserock.org/cgit/delta/NetworkManager.git/commit/?id=5b29c2e5b93c30347919b40e0885280fdb83c1a5'/>
<id>5b29c2e5b93c30347919b40e0885280fdb83c1a5</id>
<content type='text'>
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
</pre>
</div>
</content>
</entry>
<entry>
<title>build: allow specifying the python interpreter for building</title>
<updated>2016-12-14T18:00:42+00:00</updated>
<author>
<name>Thomas Haller</name>
<email>thaller@redhat.com</email>
</author>
<published>2016-12-14T17:18:37+00:00</published>
<link rel='alternate' type='text/html' href='http://git.baserock.org/cgit/delta/NetworkManager.git/commit/?id=6070fe697a4ccf9c90817f6d7268ba184fc744ea'/>
<id>6070fe697a4ccf9c90817f6d7268ba184fc744ea</id>
<content type='text'>
As build-requirement, we either require
  - python2 with python-gobject-base
  - python3 with python3-gobject-base
Previously, we would require that a plain `python` gives the desired
interpreter version.

If somebody's "/usr/bin/env python" however points to a different
python version, there was no easy way to change it -- aside
resetting the $PATH variable to some desired "python" binary.

Now, you can specify it during configure:

  ./configure PYTHON=python3 ...

This especially matters, if you only have python3-gobject-base
installed, you /usr/bin/python is a symlink to python2.

https://bugzilla.gnome.org/show_bug.cgi?id=775768
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
As build-requirement, we either require
  - python2 with python-gobject-base
  - python3 with python3-gobject-base
Previously, we would require that a plain `python` gives the desired
interpreter version.

If somebody's "/usr/bin/env python" however points to a different
python version, there was no easy way to change it -- aside
resetting the $PATH variable to some desired "python" binary.

Now, you can specify it during configure:

  ./configure PYTHON=python3 ...

This especially matters, if you only have python3-gobject-base
installed, you /usr/bin/python is a symlink to python2.

https://bugzilla.gnome.org/show_bug.cgi?id=775768
</pre>
</div>
</content>
</entry>
<entry>
<title>all: cleanup includes and let "nm-default.h" include "config.h"</title>
<updated>2016-02-19T16:53:25+00:00</updated>
<author>
<name>Thomas Haller</name>
<email>thaller@redhat.com</email>
</author>
<published>2016-02-19T13:57:48+00:00</published>
<link rel='alternate' type='text/html' href='http://git.baserock.org/cgit/delta/NetworkManager.git/commit/?id=8bace23bebcc28396460663203d54aac4ec8ffbf'/>
<id>8bace23bebcc28396460663203d54aac4ec8ffbf</id>
<content type='text'>
- All internal source files (except "examples", which are not internal)
  should include "config.h" first. As also all internal source
  files should include "nm-default.h", let "config.h" be included
  by "nm-default.h" and include "nm-default.h" as first in every
  source file.
  We already wanted to include "nm-default.h" before other headers
  because it might contains some fixes (like "nm-glib.h" compatibility)
  that is required first.

- After including "nm-default.h", we optinally allow for including the
  corresponding header file for the source file at hand. The idea
  is to ensure that each header file is self contained.

- Don't include "config.h" or "nm-default.h" in any header file
  (except "nm-sd-adapt.h"). Public headers anyway must not include
  these headers, and internal headers are never included after
  "nm-default.h", as of the first previous point.

- Include all internal headers with quotes instead of angle brackets.
  In practice it doesn't matter, because in our public headers we must
  include other headers with angle brackets. As we use our public
  headers also to compile our interal source files, effectively the
  result must be the same. Still do it for consistency.

- Except for &lt;config.h&gt; itself. Include it with angle brackets as suggested by
  https://www.gnu.org/software/autoconf/manual/autoconf.html#Configuration-Headers
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
- All internal source files (except "examples", which are not internal)
  should include "config.h" first. As also all internal source
  files should include "nm-default.h", let "config.h" be included
  by "nm-default.h" and include "nm-default.h" as first in every
  source file.
  We already wanted to include "nm-default.h" before other headers
  because it might contains some fixes (like "nm-glib.h" compatibility)
  that is required first.

- After including "nm-default.h", we optinally allow for including the
  corresponding header file for the source file at hand. The idea
  is to ensure that each header file is self contained.

- Don't include "config.h" or "nm-default.h" in any header file
  (except "nm-sd-adapt.h"). Public headers anyway must not include
  these headers, and internal headers are never included after
  "nm-default.h", as of the first previous point.

- Include all internal headers with quotes instead of angle brackets.
  In practice it doesn't matter, because in our public headers we must
  include other headers with angle brackets. As we use our public
  headers also to compile our interal source files, effectively the
  result must be the same. Still do it for consistency.

- Except for &lt;config.h&gt; itself. Include it with angle brackets as suggested by
  https://www.gnu.org/software/autoconf/manual/autoconf.html#Configuration-Headers
</pre>
</div>
</content>
</entry>
<entry>
<title>libnm/tests: add test code driving python test service</title>
<updated>2015-12-26T15:43:49+00:00</updated>
<author>
<name>Thomas Haller</name>
<email>thaller@redhat.com</email>
</author>
<published>2015-12-25T19:27:45+00:00</published>
<link rel='alternate' type='text/html' href='http://git.baserock.org/cgit/delta/NetworkManager.git/commit/?id=142ea41cae133f6e645fced9ee899196b6c682f2'/>
<id>142ea41cae133f6e645fced9ee899196b6c682f2</id>
<content type='text'>
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
</pre>
</div>
</content>
</entry>
<entry>
<title>libnm/tests: add dbus-glib support to "nm-test-libnm-utils"</title>
<updated>2015-12-26T15:43:49+00:00</updated>
<author>
<name>Thomas Haller</name>
<email>thaller@redhat.com</email>
</author>
<published>2015-12-23T13:07:36+00:00</published>
<link rel='alternate' type='text/html' href='http://git.baserock.org/cgit/delta/NetworkManager.git/commit/?id=570d24b88ca82332d472dcb562f5e0d825d63cf2'/>
<id>570d24b88ca82332d472dcb562f5e0d825d63cf2</id>
<content type='text'>
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
</pre>
</div>
</content>
</entry>
</feed>
