Skip to content
GitLab
Explore
Sign in
Register
Commits on Source (2)
tests/touch: Tidy tests
· fb34e619
Chris Lamb
authored
Oct 23, 2018
fb34e619
tests/touch: Failing an XFail test should be a failure.
· 80402ea8
Chris Lamb
authored
Oct 23, 2018
80402ea8
Hide whitespace changes
Inline
Side-by-side
tests/touch
View file @
80402ea8
...
...
@@ -4,20 +4,37 @@
.
./common
Mount
f
=
target/a
exmtime
=
12345678
touch
$f
touch
-d
@
$exmtime
$f
mtime
=
$(
stat
--format
=
%X-%Y
$f
)
[
"
$mtime
"
=
"
$exmtime
-
$exmtime
"
]
||
Fail
"test1: Got=
$mtime
Expected=
$exmtime
"
touch
$f
EXPECTED
=
"12345678"
FILENAME
=
"target/a"
touch
${
FILENAME
}
touch
-d
@
${
EXPECTED
}
${
FILENAME
}
RESULT
=
"
$(
stat
--format
=
%X-%Y
${
FILENAME
}
)
"
if
[
"
${
RESULT
}
"
!=
"
${
EXPECTED
}
-
${
EXPECTED
}
"
]
then
Fail
"test1: Got=
${
RESULT
}
Expected=
${
EXPECTED
}
"
fi
# This is what tar xf does for extracted files via futimens(2)
touch
-m
-d
@
$exmtime
$f
mtime
=
$(
stat
--format
=
%Y
$f
)
[
"
$mtime
"
=
"
$exmtime
"
]
||
XFail
"test2: Got=
$mtime
Expected=
$exmtime
"
# FIXME
touch
$f
touch
-a
-d
@
$exmtime
$f
atime
=
$(
stat
--format
=
%X
$f
)
[
"
$atime
"
=
"
$exmtime
"
]
||
XFail
"test3: Got=
$atime
Expected=
$exmtime
"
# FIXME
touch
$f
touch
${
FILENAME
}
touch
-m
-d
@
${
EXPECTED
}
${
FILENAME
}
RESULT
=
"
$(
stat
--format
=
%Y
${
FILENAME
}
)
"
if
[
"
${
RESULT
}
"
=
"
${
EXPECTED
}
"
]
then
Fail
"test2: Did not XFail"
else
XFail
"test2: Got=
${
RESULT
}
Expected=
${
EXPECTED
}
"
fi
touch
${
FILENAME
}
touch
-a
-d
@
${
EXPECTED
}
${
FILENAME
}
RESULT
=
"
$(
stat
--format
=
%X
${
FILENAME
}
)
"
if
[
"
${
RESULT
}
"
=
"
${
EXPECTED
}
"
]
then
Fail
"test3: Did not XFail"
else
XFail
"test3: Got=
${
RESULT
}
Expected=
${
EXPECTED
}
"
fi
Unmount