summaryrefslogtreecommitdiff
path: root/test
AgeCommit message (Collapse)AuthorFilesLines
2014-10-28benchmark: cache the kdbus msg and update only memfd item offset if neededDjalal Harouni1-31/+99
No need to create the kdbus msg every time, and if we are sending a memfd, then just store its item offset, patch it later with the right memfd fd+data, seal it, then send it. Signed-off-by: Djalal Harouni <tixxdz@opendz.org>
2014-10-28connection: block only normal fds allwo sending memfdsDjalal Harouni1-1/+1
Signed-off-by: Djalal Harouni <tixxdz@opendz.org>
2014-10-28test/test-sync: we accept SA_RESTART nowDaniel Mack1-13/+1
Tweak the test case accordingly. Signed-off-by: Daniel Mack <daniel@zonque.org>
2014-10-28test-fd: check if we did receive the right number of passed fdsDjalal Harouni1-1/+39
Signed-off-by: Djalal Harouni <tixxdz@opendz.org>
2014-10-27kdbus.h, metadata: factor out capabilities (ABI break)Daniel Mack1-8/+9
Move capabilites to its own struct inside kdbus_item. This also gives us the ability to inform userspace of the highest caps bit the kernel knows about. Hence, if the capabilites grow in either the number of sets or the number of rows, we can now detect and handle both from userspace. Signed-off-by: Daniel Mack <daniel@zonque.org>
2014-10-27test-fd: add more passfd+close tests to fdpassingDjalal Harouni1-9/+43
Signed-off-by: Djalal Harouni <tixxdz@opendz.org>
2014-10-27test-fd: test send fd operations on connection that do not accept fdsDjalal Harouni1-10/+48
Signed-off-by: Djalal Harouni <tixxdz@opendz.org>
2014-10-25policy: check if name is valid when updating policiesDjalal Harouni1-0/+16
Signed-off-by: Djalal Harouni <tixxdz@opendz.org>
2014-10-25test-monitor: add KDBUS_CMD_CONN_UPDATE tests for monitor connectionsDjalal Harouni1-0/+66
Signed-off-by: Djalal Harouni <tixxdz@opendz.org>
2014-10-24test-names: name validity tests for CMD_NAME_{ACQUIRE|RELEASE}Djalal Harouni1-1/+24
Signed-off-by: Djalal Harouni <tixxdz@opendz.org>
2014-10-23connection: keep SYNC messages alive on EINTRDavid Herrmann1-20/+19
If a SYNC-SEND is interrupted by a signal, there is no way we can restart the syscall. If we returned ERESTARTSYS, we'd queue the message again on restart. This is very irritating, therefore, we never support restarting syscalls. Instead, we return EINPROGRESS if the message was queued but no reply was received, yet. Internally, we turn the 'sync' reply_wait into an 'async' reply. This way, it will be treated the same way as any other asynchronous reply. Signed-off-by: David Herrmann <dh.herrmann@gmail.com>
2014-10-22test-fd: make sure that passed fds do not also allow fd queueingDjalal Harouni1-1/+12
Signed-off-by: Djalal Harouni <tixxdz@opendz.org>
2014-10-22kdbus.h: rename kdbus_{cmd,}_conn_info → kdbus_{cmd,}_infoDaniel Mack5-10/+10
As we now use kdbus_cmd_conn_info and kdbus_conn_info for bus creator information as well, rename the structs to a more generic term. Signed-off-by: Daniel Mack <daniel@zonque.org>
2014-10-22kdbus.h: add KDBUS_CMD_BUS_CREATOR_INFODaniel Mack3-77/+118
Add a call to return metadata on the task that created a bus, at the moment it did so. The call behaves similar to KDBUS_CMD_CONN_INFO, and shares the same dispatcher code in handle.c. While at it, factor out bus-related test functions to their own file, and also add some code test the new ioctl. Signed-off-by: Daniel Mack <daniel@zonque.org>
2014-10-22test-fd: add a bloom filter to broadcast messageDaniel Mack1-4/+12
Satisfy a kernel check so we can be sure we really bail out due to the check we're actually enforcing. Signed-off-by: Daniel Mack <daniel@zonque.org>
2014-10-22test: just define KDBUS_SYSNAME_MAX_LEN here in test-endpointDjalal Harouni2-1/+2
Signed-off-by: Djalal Harouni <tixxdz@opendz.org>
2014-10-22test: make sure that creating endpoint with long names will failDjalal Harouni2-5/+23
Signed-off-by: Djalal Harouni <tixxdz@opendz.org>
2014-10-22test-sync: do a second recv only when SA_RESTART was passedDjalal Harouni1-1/+1
The test was working for all cases, but fix it to only check for the SA_RESTART case. Signed-off-by: Djalal Harouni <tixxdz@opendz.org>
2014-10-22test: use kdbus_msg_dump() to check for message integrityDaniel Mack2-5/+15
Make kdbus_msg_dump() return an error in case there's anything wrong with the message. Return such errors from kdbus_msg_recv(). We currently fail with notifications. Signed-off-by: Daniel Mack <daniel@zonque.org>
2014-10-21connection: switch to absolute timeouts (API break)Daniel Mack1-1/+10
Make the timeouts in struct kdbus_msg.timeout_ns absolute. This is necessary in order to support blocking sync calls with SA_RESTART behavior. Signed-off-by: Daniel Mack <daniel@zonque.org>
2014-10-21test-sync: implement send_reply()Daniel Mack1-1/+48
Implement a new helper function to reply to pending messages. Formerly, the test abused the timeout parameter to respond, knowing that its value will eventually end up in the kdbus message in the same union as the cookie_reply field. In the process of switching to absolute timeouts, however, this bites us, so move this hack out of the way first. Signed-off-by: Daniel Mack <daniel@zonque.org>
2014-10-21kdbus.h: split in and out flags of ioctls (ABI break)Daniel Mack4-21/+8
Instead of negotating kernel flags via the same field for input and output, use two different bitfields for that, and call the returned flags 'kernel_flags'. The approach implemented before didn't turn out to work too well for more complex userspace programs that retain the same ioctl buffers for multiple calls, and which had to manually save and restore the flags before. While at it, rename conn_flags → flags in kdbus_cmd_hello to ease the internal helper functions and unify the API a bit more. Signed-off-by: Daniel Mack <daniel@zonque.org>
2014-10-21kdbus.h: factor out name info struct (ABI break)Daniel Mack2-2/+2
Introduce struct kdbus_name_info and report information on name lists with it, instead of (ab)using struct kdbus_cmd_name for it. That way, we can get rid of two fields in the latter. Signed-off-by: Daniel Mack <daniel@zonque.org>
2014-10-20test-fd: fix the fd passing test and use KDBUS_MSG_MAX_FDS for normal fdsDjalal Harouni1-2/+9
Signed-off-by: Djalal Harouni <tixxdz@opendz.org>
2014-10-20test-fd: add tests for fd and memfd accountingDjalal Harouni1-49/+213
Signed-off-by: Djalal Harouni <tixxdz@opendz.org>
2014-10-18tree-wide: rework flags negotiation (ABI break)Daniel Mack3-3/+17
We are obliged to reject all bits in flags fields that are not known to the kernel. In order to let userspace know which flags the kernel knowns about, we agreed to always write back to the flags field in the ioctl buffer, even if the call succeeded. The kernel will, however, will always set the KDBUS_FLAG_KERNEL bit, which consequently is always invalid when submitted by userspace. Move some checks from other place to handle.c, and update the testsuite and documentation accordingly. Signed-off-by: Daniel Mack <daniel@zonque.org>
2014-10-17Revert KDBUS_HELLO_ACCEPT_MEMFD support (ABI break)Kay Sievers2-6/+7
Memfds are a basic exchange mechanism not supposed to be optional per connection. A per-bus flag, instead of a per-connection one, would probably be acceptable, but its usefulness is questionable at this point. Broadcasts can contain memfds and we would silently messages for such connections, which is not the expected behavior. Receivers just need to make sure to be able to receive messages with memfd payload, otherwise they are just not fully supporting the common kdbus interface. Contracts of not supporting memfds on private buses are fine, but the general purpose communication will always require memfds to be supported by all clients.
2014-10-14test-activator: add more tests for the activation logicDjalal Harouni1-0/+226
Signed-off-by: Djalal Harouni <tixxdz@opendz.org>
2014-10-14test-util: add test_is_capable() to check for capabilities and use itDjalal Harouni4-21/+61
Signed-off-by: Djalal Harouni <tixxdz@opendz.org>
2014-10-14test-util: move RUN_UNPRIVILEGED definitions to kdbus-util.hDjalal Harouni2-49/+50
Will be used by other tests Signed-off-by: Djalal Harouni <tixxdz@opendz.org>
2014-10-14kdbus.h: add KDBUS_HELLO_ACCEPT_MEMFD (ABI break)Daniel Mack2-7/+6
Add another flags to the connection's flags to denote whether it want to receive memfds. Reject messages with -ECOMM if it contains a memfd if the receiver can't cope with it. Signed-off-by: Daniel Mack <daniel@zonque.org>
2014-10-14tests: strncpy() correctionsDaniel Mack2-4/+4
Use the correct maximum size with strncpy(), even though we're using small static strings as sources. Signed-off-by: Daniel Mack <daniel@zonque.org>
2014-10-13test-sync: ensure sync is interruptible and it ignors SA_RESTART flagDjalal Harouni1-0/+68
Signed-off-by: Djalal Harouni <tixxdz@opendz.org>
2014-10-12test: test monitor connections for broadcast messagesDjalal Harouni1-0/+27
Signed-off-by: Djalal Harouni <tixxdz@opendz.org>
2014-10-12test-fd: ensure that broadcasting fds and memfds will fail with -ENOTUNIQDjalal Harouni1-0/+59
Signed-off-by: Djalal Harouni <tixxdz@opendz.org>
2014-10-10handle: do not look at 'features' for nowDaniel Mack1-7/+1
We still need to decide how we wanna handle this. Signed-off-by: Daniel Mack <daniel@zonque.org>
2014-10-09Merge branch 'master' of https://code.google.com/p/d-busGreg Kroah-Hartman1-27/+602
2014-10-09Merge pull request #26 from michelecurti/masterGreg Kroah-Hartman1-1/+1
test: fix typo
2014-10-09test: test-policy-priv do broadcast tests after a policy holder is uploadedDjalal Harouni1-2/+340
Add more broadcast tests that will run after a policy holder is uploaded on the bus. Each test is documented. Currently we fail at these tests, next patches will fix this. Signed-off-by: Djalal Harouni <tixxdz@opendz.org>
2014-10-09test: test-policy-priv do broadcast tests before a policy holder is uploadedDjalal Harouni1-27/+264
Add broadcast tests, and modify RUN_UNPRIVILEGED() so we can specify the uid/gid of the user to drop in and run tests. Move all the tests that check the default behaviour of the bus and before a policy holder is uploaded to their function: test_priv_before_policy_upload(). Each test is documented. Signed-off-by: Djalal Harouni <tixxdz@opendz.org>
2014-10-09test: fix typoMichele Curti1-1/+1
fix typo in bybye test description
2014-10-08test: print filename in assertionDaniel Mack1-6/+6
Signed-off-by: Daniel Mack <daniel@zonque.org>
2014-10-08tree-wide: s/_EP_/_ENDPOINT_/g (API break)Daniel Mack2-3/+3
Avoid abbr. and rename EP → ENDPOINT. Signed-off-by: Daniel Mack <daniel@zonque.org>
2014-10-08kdbus.h: add features bitmask to cmd_make and cmd_hello (ABI BREAK)Daniel Mack1-1/+7
Add a new field called 'features' to struct kdbus_cmd_make and kdbus_cmd_hello. In these bitmasks, userspace can request features from the kernel, and the kernel can itself request features from userspace. For now, we check that this field is set to 0, and bail with -EOPNOTSUPP otherwise. Signed-off-by: Daniel Mack <daniel@zonque.org>
2014-10-07test: fix some 'dead assignment' errorsDaniel Mack2-3/+0
2014-10-07test-endpoint: fix nul-termination of stringDaniel Mack1-1/+1
Found by coverity. Signed-off-by: Daniel Mack <daniel@zonque.org>
2014-10-06kdbus.h: implement KDBUS_CMD_{MSG_CANCEL,FREE} with structs (ABI break)Daniel Mack2-5/+12
Rather than passing a pointer to a u64 with these ioctls, use a struct. That also allows us to pass (currently unused) flags around. Signed-off-by: Daniel Mack <daniel@zonque.org>
2014-10-02match: make KDBUS_CMD_MATCH_REMOVE return -ENOENT when cookie was not foundDaniel Mack1-2/+6
When the cookie specified in the command struct was not found in the match database, return -ENOENT. Signed-off-by: Daniel Mack <daniel@zonque.org>
2014-10-02kdbus.h: attach items[] to kdbus_cmd_conn_info, not name[] (ABI break!)Daniel Mack2-7/+18
Instead of directly attaching the string to kdbus_cmd_conn_info, use items as we do in all other commands. That allows for more flexibility later. Signed-off-by: Daniel Mack <daniel@zonque.org>
2014-10-02test: fix benchmark stats accountingDavid Herrmann1-4/+0
We should not reset stats before retying a test, otherwise, the test will file in batch mode as stats.count is 0. Signed-off-by: David Herrmann <dh.herrmann@gmail.com>