summaryrefslogtreecommitdiff
path: root/tools
Commit message (Collapse)AuthorAgeFilesLines
* nm-in-container: set NMCI_DEBUG=1 in bashrcThomas Haller2023-04-261-0/+2
|
* nm-in-container: add commands to bash historyThomas Haller2023-04-181-0/+4
|
* nm-in-container: install libselinux-utilsBeniamino Galvani2023-04-181-0/+1
| | | | | It contains "getenforce" and "setenforce", which are needed by some NMCI tests.
* client/tests: don't do dup2() dance to pass file descriptor to ↵Thomas Haller2023-03-301-4/+2
| | | | | | | | | | | | "tools/test-cloud-meta-mock.py" "preexec_fn" is not great, because it is not generally safe in multi threaded code (and we don't know whether the test didn't start other threads already, like a GDBus worker thread). Well, it probably is safe, if you only call async signal safe code, but it's not clear what os.dup2() does under the hood. Just avoid that. We can pass on the FD directly.
* tools/test-cloud-meta-mock: add a mock metadata server for cloud-setupLubomir Rintel2023-03-211-0/+90
| | | | Useful for testing/development.
* test/nm-service: short circuit activation if AC activation delay is zeroLubomir Rintel2023-03-211-3/+11
| | | | | This makes it possible for use to create a connection in immediately rely on it being activated.
* test/nm-service: make activation delay actually usefulLubomir Rintel2023-03-211-4/+5
| | | | | | | | | | | | | | | The activation_state_change_delay_ms was not too useful, since it could be changed only after the AC started activating. Not a big deal, since it was actually unused. Apart from that, the SetActiveConnectionStateChangedDelay() didn't make a whole lot of sense either: it accepted a Device path, but actually was looking up an AC. Let's move the property to the Device, so that 1.) it can be adjusted before the AC is constructed (the AC will inherit it from the Device) and 2.) SetActiveConnectionStateChangedDelay() does no longer hurt my feelings.
* test/nm-service: implement applied connection handlingLubomir Rintel2023-03-211-0/+19
| | | | | GetAppliedConnection() and Reapply(), both just enough to support nm-cloud-setup.
* test/nm-service: deconstruct string properties in connections tooLubomir Rintel2023-03-211-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | I don't know what's going on: ====================================================================== ERROR: test_ec2 (__main__.TestNmCloudSetup.test_ec2) ---------------------------------------------------------------------- Traceback (most recent call last): File "NetworkManager/src/tests/client/test-client.py", line 2169, in f func(self) File "NetworkManager/src/tests/client/test-client.py", line 2194, in test_ec2 conn = self.srv.op_AddAndActivateConnection( ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "NetworkManager/src/tests/client/test-client.py", line 748, in __call__ return method(*args) ^^^^^^^^^^^^^ File "/usr/lib64/python3.11/site-packages/dbus/proxies.py", line 72, in __call__ return self._proxy_method(*args, **keywords) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/lib64/python3.11/site-packages/dbus/proxies.py", line 141, in __call__ return self._connection.call_blocking(self._named_service, ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/lib64/python3.11/site-packages/dbus/connection.py", line 634, in call_blocking reply_message = self.send_message_with_reply_and_block( ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ dbus.exceptions.DBusException: org.freedesktop.DBus.Python.Exception: Traceback (most recent call last): File "/usr/lib64/python3.11/site-packages/dbus/service.py", line 712, in _message_cb retval = candidate_method(self, *args, **keywords) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "NetworkManager/tools/test-networkmanager-service.py", line 1693, in AddAndActivateConnection conpath, acpath, result = self.AddAndActivateConnection2( ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "NetworkManager/tools/test-networkmanager-service.py", line 1707, in AddAndActivateConnection2 conpath = gl.settings.AddConnection(con_hash) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "NetworkManager/tools/test-networkmanager-service.py", line 2198, in AddConnection return self.add_connection(con_hash) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "NetworkManager/tools/test-networkmanager-service.py", line 2208, in add_connection con_inst = Connection(self.c_counter, con_hash, do_verify_strict) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "NetworkManager/tools/test-networkmanager-service.py", line 2045, in __init__ NmUtil.con_hash_verify(con_hash, do_verify_strict=do_verify_strict) File "NetworkManager/tools/test-networkmanager-service.py", line 594, in con_hash_verify BusErr.raise_nmerror(e) File "NetworkManager/tools/test-networkmanager-service.py", line 497, in raise_nmerror raise e File "NetworkManager/tools/test-networkmanager-service.py", line 590, in con_hash_verify con_nm = NmUtil.con_hash_to_connection( ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "NetworkManager/tools/test-networkmanager-service.py", line 537, in con_hash_to_connection assert GLib.Variant.equal(x_con, Util.variant_from_dbus(con_hash)) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "NetworkManager/tools/test-networkmanager-service.py", line 378, in variant_from_dbus raise Exception("Unsupported type for value '%s'" % (repr(val))) Exception: Unsupported type for value 'dbus.Dictionary({ dbus.String('connection'): dbus.Dictionary({ dbus.String('type'): dbus.String('802-3-ethernet'), dbus.String('id'): dbus.String('con-eth0'), 'uuid': '5fcfd6d7-1e63-3332-8826-a7eda103792d' }, signature=dbus.Signature('ss')), dbus.String('ipv4'): dbus.Dictionary({ dbus.String('method'): dbus.String('auto') }, signature=dbus.Signature('ss')) }, signature=dbus.Signature('sa{ss}'))'
* contrib,tools: move "nm-in-container.sh" script to "tools"Thomas Haller2023-03-207-0/+878
| | | | | This script seems very useful to me. Give it a more prominent place and move it out from "contrib/scripts". Also do some further renaming.
* build: fix pretty() sed invocation portability in .ver scriptDaniel Kolesa2023-03-071-1/+1
| | | | | | | | | | | | The `\0` being used to refer to the whole match is a GNU extension. On other implementations of sed, this will simply replace the each matched line with ` 0;`, resulting in symbols being missing in the NetworkManager executable, which breaks the wifi plugin and others. Use `&` instead, which behaves as expected in all implementations. https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/1562
* build: add test for checking consistency of "nm-autoptr.h"Thomas Haller2023-02-281-0/+26
|
* vapi: add test for consistency of "vapi/NM-1.0.metadata"Thomas Haller2023-02-281-0/+25
|
* ovs: add support for "other_config" settingsThomas Haller2023-01-111-0/+1
| | | | | | See `man ovs-vswitchd.conf.db` for documentation of "other_config" keys. https://bugzilla.redhat.com/show_bug.cgi?id=2151455
* tools/check-docs: more checks for missing includeslr/gtk-docLubomir Rintel2022-11-131-0/+23
| | | | We get this wrong *very* often.
* build: pass both filenames to "tools/check-compare-generated.sh" scriptThomas Haller2022-10-311-6/+5
| | | | | | | | It just feels nicer to be explicit about the filenames and not rely on a specific naming. Also, in meson we can directly pass the target as argument, which expands to the filename but also adds a dependency.
* tools: drop unused variables from "tools/generate-docs-nm-property-infos.py"Thomas Haller2022-10-251-2/+0
| | | | Found by lgtm.com.
* tools: avoid Python 3 f-string in "generate-docs-nm-property-infos.py"Thomas Haller2022-10-071-1/+1
| | | | | | We also need to build with python2. No f-strings. Fixes: 8fc7b6df12ed ('tools: rework generating documentation from libnm meta data')
* tools: sort the settings in "generate-docs-nm-property-infos.py" by nameThomas Haller2022-10-061-11/+44
| | | | | | | | | | | | | | | "nm-setting-ip-config.c" is a base class for IPv4 and IPv6 settings. So far, any tags there were ignored, which was not obvious. It can be useful to document common properties there. Well, maybe every property better has a IPv4/IPv6 specific text, but that should not be a technical limitation of the tool. So also honor the base file for "ipv4" and "ipv6" settings. When doing that, the settings are no longer processed in the order as they are provided on the command line. Because, one file would be parsed twice, it wouldn't make much sense. Instead, sort the my setting name. The advantage is that the generated XML is independent from the order that make/meson passes to the tool.
* tools: don't set empty attributes in "generate-docs-nm-property-infos.py"Thomas Haller2022-10-061-6/+1
| | | | | | | | | | If the information is missing, the entire attribute should not be there. Don't set it to the empty word. Also, don't alias the "variable" attribute to the "name". It's not clear what the "variable" fields is supposed to mean, but if it's not explicitly set, don't make up the information. If a user of that information cares, the can always fallback to the "name".
* tools: don't write empty XML nodes in "generate-docs-nm-property-infos.py"Thomas Haller2022-10-061-2/+0
| | | | | This generates '<setting name="XXX">\n</setting>' nodes in case there is no additional data. Don't do that. Just '<setting name="XXX"/>'
* tools: preserve newlines and indentation in "generate-docs-nm-property-infos.py"Thomas Haller2022-10-061-2/+2
| | | | | | | | | | | | Our docs can be long. It's important to be able to express paragraphs. Honor a blank line to include a newline. For XML often whitespace is ignored, but our tools can choose to honor the newline. Also, don't strip the whitespace from the beginning and the end. We keep whitespace for a certain indentation level, but additional whitespace gets preserved. This is less important, because regular spaces is indeed irrelevant. But when we write the annotations, we should be in full control over spaces.
* tools: rework generating documentation from libnm meta dataThomas Haller2022-10-061-113/+382
| | | | | | | | | | | | | | | | | | | With the given input, this produces *exactly* the same XML as before. - the parsing is now stricter (and thus the code more verbose). No funny stuff, get the annotations correct. - on parsing errors, we log now the affecting lines - "nm-setting-ip-config.c" is a base class. Previously it was ignored and for the moment we still do that. Next, we will allow to also describe properties there. - prepare the code to better preserve whitespace, indentation and line wrappings. In particular, to honor a blank line to indicate a line break and support paragraphs. This is not yet done to compare the output to before, but will be turned on with a small patch next. - the code will make it simple to promote the XML attributes to nodes. Attributes aren't great, let's write XML nodes later. We will only need to adjust the "keywords" dictionary for that, but this change will require changes to the entire chain of tools.
* style: fix python black formatting of "generate-docs-nm-settings-docs-merge.py"Thomas Haller2022-09-081-0/+2
|
* generate-docs-nm-settings-docs-gir: remove space from the beginning of a paralr/docs-deprec-propsLubomir Rintel2022-09-071-3/+3
| | | | | | | | | | | | | | | | | | | | | | From nm-settings-dbus(5): Before (ugly, offensive, possibly in violation of geneva protocol): ... | set, the authentication retries for 3 | times before failing the connection. | | Currently, this only applies to 802-1x | authentication. After (beautiful, smells good, in harmony with nature): ... | set, the authentication retries for 3 | times before failing the connection. | | Currently, this only applies to 802-1x | authentication.
* generate-docs-nm-settings-docs-gir: move deprecation info to a separate tagLubomir Rintel2022-09-071-7/+32
| | | | | | | | | | | | | | | | | | | | | | | | | | Previously, the deprecation data was included in <description*>, in form of an integer. E.g.: /** * NMSettingLala:hello: * * Does this and that. * * Deprecated: 1.12: Be sad instead. **/ Results in: <property name="hello"> <description>Does this and that. Deprecated: 1</description> </property> Let's make it do this instead: <property name="hello"> <description>Does this and that.</description> <deprecated since="1.12">Be sad instead.</description> </property>
* generate-docs-nm-settings-docs-merge: merge <deprecated*> elementsLubomir Rintel2022-09-071-0/+7
| | | | They will be used to include property deprecation data.
* generate-docs-nm-settings-docs-merge: streamline a bitLubomir Rintel2022-09-071-18/+8
| | | | | Replace a pair of overly sophisticated expressions with something that's easier to follow, avoiding code duplication at the same time.
* build/meson: force overwriting files in "meson-post-install.sh"Thomas Haller2022-08-081-5/+5
| | | | | | | | | | Repeated `ninja -C build install` should succeed. But they did not: Running custom install script '/data/src/NetworkManager/tools/meson-post-install.sh /usr/share /usr/bin /etc/NetworkManager /usr/lib/NetworkManager /var/lib/NetworkManager /usr/share/man /etc 1 1 1 1' --- stdout --- --- stderr --- ln: failed to create symbolic link '/usr/lib/NetworkManager/dispatcher.d/90-nm-cloud-setup.sh': File exists
* doc: preserve paraghraphs in nmcli man pagesVojtech Bubela2022-07-153-5/+134
| | | | | | | | | | | | | | | | | | | | | | | | | Improve documentation by preserving paragraphs in the nm-settings-nmcli man pages. To do that structure of src/libnm-client-impl/nm-settings-docs-gir.xml was changed to have "description" as subnode to property node instead of attribute of property node. Another subnode "description-docbook" was added - this node is then used when generating man pages. tools/generate-docs-nm-settings-docs-gir.py and man/nm-settings-dbus.xsl were also changed to accomodate for changes mentioned above. Replace xsltproc tool with python script when generating ./src/libnmc-setting/settings-docs.h. Deleted settings-docs.xsl since it was replaced by python script. Change src/libnmc-setting/settings-docs.h.in accodring to newly generated src/libnmc-setting/settings-docs.h https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/issues/661 https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/1260
* tools: Fix generate-docs-nm-settings-docs-gir.py on Python 2Igor Ponomarev2022-06-031-6/+5
| | | | | | | | | | | | | | | | | | | | On python2 the following error is raised: `LookupError: unknown encoding: unicode` Seems like `unicode` is a correct encoding in Python 3 but not 2. Fix: 1. Change encoding to `utf-8` 2. Pass output path string instead of opening file and passing opened file object. Python2 and 3 might need different file modes, passing just path lets ElementTree select appropriate file mode. Fixes: f00e90923c8c ('tools: Use ElementTree to write XML in generate-docs-nm-settings-docs-gir.py') https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/1249
* tools: Use ElementTree to write XML in generate-docs-nm-settings-docs-gir.pyIgor Ponomarev2022-05-311-39/+30
| | | | | | | | Instead of manually writting XML line by line. Quoting is automatic. Makes it much easier to modify. (just add new elements) Generated XML not indented at the moment.
* tools: Modernize generate-docs-nm-settings-docs-gir.py to 2022 standardsIgor Ponomarev2022-05-311-101/+113
| | | | | | | | | * Create main() function and put its execution under __name__ == '__main__' guard. * Only one module import per line * Use required=True to check if necessary arguments have been passed. * Remove usage() as ArgumentParser handles that already
* build/meson: use "rename" directive for installing nmcli bash completionThomas Haller2022-05-131-5/+0
| | | | | | | Otherwise, `ninja -C build uninstall` tries to delete "nmcli-completion", when the file got renamed to "nmcli". We depend on meson 0.47.2 already.
* libnm/docs: fix documentation for "proxy.pac-script"Thomas Haller2022-03-211-1/+7
|
* tests: propagate 77 exit code from "tools/run-nm-test.sh"Thomas Haller2022-02-191-2/+2
| | | | | | | | This is important. We must not swallow 77, which has the meaning that the test was skipped. Fixes: f65747f6e9ed ('tests: let "run-nm-test.sh" fail with exit code 1 on failure') (cherry picked from commit aff40f736c63cda19b87533578e0ca3435943f38)
* tools: fix constructing XML by dropping broken pretty_xml()Thomas Haller2022-02-101-14/+0
| | | | | | | | | | | | | | | | | | | | I don't understand the code, but it mangles the XML. There is no difference in the markup we have so far. But if you have nested XML (like for description-docbook tag) there are cases where this is wrong. There is also no need to prettify anything. If you want pretty-formatted XML, do it yourself, for example with $ tidy --indent yes --indent-spaces 4 --indent-attributes yes --wrap-attributes yes --input-xml yes --output-xml yes src/libnm-client-impl/nm-property-infos-nmcli.xml I think this was initially done, because we had the tool in perl, and when migrating, we wanted to generate the exactly same output. And it was the same output, and it was fine for the input we have. But with different input, it's wrong. Drop it now. (cherry picked from commit 35599b4349c18b771d86ea6a7f577909cfcb7a2f)
* tools: re-use regular expression in process_data()Thomas Haller2022-02-101-21/+24
| | | | | | | Yes, they get cached by the library already. Still, no need for doing this repeatedly. (cherry picked from commit 41a177486b4c84fd6d7ce5b488c22c991b9c4a84)
* tests: let "run-nm-test.sh" fail with exit code 1 on failureThomas Haller2022-02-101-3/+4
| | | | | | | | | | | | | | | `git bisect run` is peculiar about the exit code: error: bisect run failed: exit code 134 from '...' is < 0 or >= 128 If we just "exec" the test, it usually will fail on an assert. That results in SIGABRT or exit code 134. So out of the box that is annoying with git-bisect. Work around that and let the test wrapper always coerce any test failure to exit code 1. (cherry picked from commit f65747f6e9edc4a6d01d8825e6c6bc3da284c6b9)
* tools/tests: set available-connections for vlan device in NM test stubThomas Haller2022-01-211-0/+6
|
* tools: support --no-make-first option in "run-nm-test.sh"Thomas Haller2022-01-211-0/+5
| | | | | | | | | | | | | | | | Why? Because I often use a command line like $ ./tools/run-nm-test.sh -m src/libnm-client-impl/tests/test-nm-client -p /libnm/device-connection-compatibility or even alias it to a one character command `x`. Usually I want to do the rebuild, and as `make` is so slow, it adds noticeable time running the command. Thus, sometimes I want to modify the command, for which I have to edit the command from the history, or toggle two separate commands. Add a `-M` flag that can reverse the effect of an earlier `-m`. An "enable" flag in general should just also have a "disable" flag.
* core: rework IP configuration in NetworkManager using layer 3 configurationThomas Haller2021-11-181-1/+0
| | | | | | | | | | | | | | | | | Completely rework IP configuration in the daemon. Use NML3Cfg as layer 3 manager for the IP configuration of an interface. Use NML3ConfigData as pieces of configuration that the various components collect and configure. NMDevice is managing most of the IP configuration at a higher level, that is, it starts DHCP and other IP methods. Rework the state handling there. This is a huge rework of how NetworkManager daemon handles IP configuration. Some fallout is to be expected. It appears the patch deletes many lines of code. That is not accurate, because you also have to count the files `src/core/nm-l3*`, which were unused previously. Co-authored-by: Beniamino Galvani <bgalvani@redhat.com>
* build/tests: ignore all valgrind warnings about unhandled syscallsThomas Haller2021-10-081-27/+10
| | | | | | | | | | | | | | | | | | valgrind might log warnings about syscalls that it doesn't implement. When we run valgrind tests, we check that the command exits with success, but we also check that there is no unexpected content in the valgrind log. Those warnings are not relevant for us. We don't unit-tests valgrind, we unit tests NetworkManager. Let's always remove such warnings with `sed`. We already did that previously, but only for a explicit list of tests. Now do it for all tests. This is currently relevant on Fedora 35 and Ubuntu devel, where the "close_range" syscall is used by libc, but not supported by valgrind. While at it, rework the confusing logic of "HAS_ERRORS" variable.
* tools: use "is" to compare _DEFAULT_ARG in "test-networkmanager-service.py"Thomas Haller2021-07-291-4/+4
|
* tools: fix bogus code in "tools/generate-docs-nm-property-infos.py"Thomas Haller2021-07-061-4/+1
| | | | | | | | | | | Coverity warns about this: 2. NetworkManager-1.32.2/tools/generate-docs-nm-property-infos.py:117: identical_branches: The same code is executed regardless of whether "temp.index(subelement) < len(temp) - 1" is true, because the then and else branches are identical. Should one of the branches be modified, or the entire 'if' statement replaced? Fixes: c3504f7e624e ('Rewrite `./tools/generate-docs-nm-property-infos.py` with XML library')
* Support new attribute tag `description-docbook`Wen Liang2021-06-232-2/+31
| | | | | | | | `description-docbook` is the alternative tag to `description`, the difference is that `description-docbook` expects docbook XML but not plaintext. Signed-off-by: Wen Liang <liangwen12year@gmail.com>
* tools: correct NetworkManager top object set_state functionFrederic Martinsons2021-06-231-2/+2
| | | | Signed-off-by: Frederic Martinsons <frederic.martinsons@sigfox.com>
* tools: suppress duplicate state change in deactivation step of active connectionFrederic Martinsons2021-06-231-4/+0
| | | | Signed-off-by: Frederic Martinsons <frederic.martinsons@sigfox.com>
* tools: add debug printf statements to ↵al/1963854-bond-optionThomas Haller2021-06-091-0/+22
| | | | | | | | | "tools/generate-docs-nm-settings-docs-merge.py" It's hard to understand what "tools/generate-docs-nm-settings-docs-merge.py" does. Add dbg() statements that are all NOP by default. But the user can easily patch the code to print what is happening. This is only for debugging the script.
* python: remove unused importsThomas Haller2021-05-272-3/+3
| | | | | They are flagged by lgtm.com. Avoid the warning by dropping unused includes.