#! /bin/bash
# SPDX-License-Identifier: GPL-2.0-or-later
# Copyright (c) 2021 Oracle.  All Rights Reserved.
#
# FS QA Test No. 159
#
# Check that the xfs_db timelimit command prints the ranges that we expect.
# This in combination with an xfs_ondisk.h build time check in the kernel
# ensures that the kernel agrees with userspace.

. ./common/preamble
_begin_fstest auto quick bigtime

# Override the default cleanup function.
_cleanup()
{
	cd /
}

# Import common functions.

_require_scratch
_require_xfs_db_command timelimit

# Format filesystem without bigtime support and populate it
_scratch_mkfs > $seqres.full
echo classic xfs timelimits
_scratch_xfs_db -c 'timelimit --classic'
echo bigtime xfs timelimits
_scratch_xfs_db -c 'timelimit --bigtime'

# success, all done
status=0
exit
