Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found

Target

Select target project
  • tests/common
  • andrunko/common
2 results
Show changes
Commits on Source (2)
  • Walter Lozano's avatar
    Fix journalctl cursor use · 2e59623a
    Walter Lozano authored
    
    Using --after-cursor in combination with -t audit does produces the expected
    output since the filtering logic is applied before and after that the cursor
    is moved to next valid entry. In this case, using --after-cursor will cause
    the output to miss the first entry in the log.
    
    Fix the issue by using --cursor instead.
    
    Signed-off-by: default avatarWalter Lozano <walter.lozano@collabora.com>
    2e59623a
  • Walter Lozano's avatar
    Better fixing of cursor use · b1b1ded8
    Walter Lozano authored
    
    In commit 2e59623a a fix to the cursor use was introduced. However, the fix
    tries to overcome the issue in a wrong way.
    
    The problem is caused by the fact that the cursor is saved before running the
    test and then it is used to check newer entries of a specific type (audit).
    Since when journalctl is used with -t the cursor is first moved to the first
    entry of the specific type the --after-cursor was changed for --cursor to
    make the test pass.
    
    However, a better approach would be to save the cursor also taking into
    account the type of entry we are interested on, so later when we use it we
    can safetly check entries with --after-crusor.
    
    The only tricky case would be if there are no previous entries of the
    specific case, which will lead to an empty cursor. So also handle that case.
    
    Signed-off-by: default avatarWalter Lozano <walter.lozano@collabora.com>
    b1b1ded8
......@@ -74,7 +74,7 @@ TMP_DIR=$(mktemp -d)
trap "rm -rf $TMP_DIR; exit" EXIT
# Log start cursor
START_CURSOR="$(journalctl --output-fields=__CURSOR --output=json -n1 | sed 's/.*\"__CURSOR\":\"\([^\"]*\)\".*/\1/')"
START_CURSOR="$(journalctl -t audit --output-fields=__CURSOR --output=json -n1 | sed 's/.*\"__CURSOR\":\"\([^\"]*\)\".*/\1/')"
if [ "${LAUNCH_DBUS}" = "True" ]; then
# Start a new D-Bus session for this test
......@@ -132,7 +132,13 @@ if [ "${UID}" != "0" ]
then
JOURNALCTL="sudo journalctl"
fi
${JOURNALCTL} --after-cursor "${START_CURSOR}" -t audit -o cat > ${AUDIT_FILE}
CURSOR_ARG=""
if [ "${START_CURSOR}" != "" ]; then
CURSOR_ARG="--after-cursor ${START_CURSOR}"
fi
${JOURNALCTL} ${CURSOR_ARG} -t audit -o cat > ${AUDIT_FILE}
echo "#=== ${TEST_TITLE} ==="
......