Skip to content

GitLab

  • Menu
Projects Groups Snippets
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
  • xserver xserver
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 933
    • Issues 933
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 99
    • Merge requests 99
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Monitor
    • Monitor
    • Incidents
  • Packages & Registries
    • Packages & Registries
    • Container Registry
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Repository
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • xorg
  • xserverxserver
  • Issues
  • #1262

Closed
Open
Created Nov 30, 2021 by Matt Turner@mattst88Developer

xserver / unit - test hangs when compiled with -Db_ndebug=true (asserts enabled)

When compiled with -Db_ndebug=true (enabling asserts), the xserver / unit test hangs in the cmp_attr_fields function. Without asserts enabled it passes.

This is because the *tags2++ increment happens inside an assert macro:

static void
cmp_attr_fields(InputAttributes * attr1, InputAttributes * attr2)
{
    [...]
    /* check for not sharing memory */
    tags1 = attr1->tags;
    while (*tags1) {
        tags2 = attr2->tags;
        while (*tags2)
            assert(*tags1 != *tags2++);

        tags1++;
    }
}

static void
dix_input_attributes(void)
{
  [...]
  orig->tags = xstrtokenize("tag1 tag2 tag3", " ");
  new = DuplicateInputAttributes(orig);
  cmp_attr_fields(orig, new);
  FreeInputAttributes(new);

  FreeInputAttributes(orig);
}

The test used g_assert until commit 196d679b. I don't know the behavior of g_assert.

Moving the increment outside of the assert causes the test to fail when asserts are disabled:

diff --git a/test/input.c b/test/input.c
index f092bb46d..5e394d2d3 100644
--- a/test/input.c
+++ b/test/input.c
@@ -1173,8 +1173,10 @@ cmp_attr_fields(InputAttributes * attr1, InputAttributes * attr2)
     tags1 = attr1->tags;
     while (*tags1) {
         tags2 = attr2->tags;
-        while (*tags2)
-            assert(*tags1 != *tags2++);
+        while (*tags2) {
+            assert(*tags1 != *tags2);
+            tags2++;
+        }
 
         tags1++;
     }

But I don't know really what the test is doing to debug the failure.

cc: @whot

To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information
Assignee
Assign to
Time tracking