From 30b4eda196e090aa820d312e6a9435a4ae84c303 Mon Sep 17 00:00:00 2001 From: Karen Arutyunov Date: Fri, 5 Jul 2019 12:53:38 +0300 Subject: Fix failing testscript cp builtin test --- tests/test/script/builtin/cp.testscript | 25 ++++++++++--------------- 1 file changed, 10 insertions(+), 15 deletions(-) (limited to 'tests/test/script') diff --git a/tests/test/script/builtin/cp.testscript b/tests/test/script/builtin/cp.testscript index aa16465..0d465e4 100644 --- a/tests/test/script/builtin/cp.testscript +++ b/tests/test/script/builtin/cp.testscript @@ -358,32 +358,27 @@ if ($cxx.target.class != 'windows') EOE } - # @@ Temporary disable the test as it may fail if the package is fetched - # from the git repository location. Note that the used `ls -l` command - # displays the filesystem entry modification time with the minute - # resolution and the build2 dist meta-operation doesn't preserve the - # directory modification time. That's why the test command may - # unexpectedly succeed. - # - # One way to fix it is to instruct ls to show time with at least the - # second resolution. There is no portable way for that across different - # OSes but all of them seems to provide some option to achieve that. - # -#\ : dir : + : Note that the `ls -l` command by default displays the filesystem entry + : modification time with the minute resolution and the build2 dist + : meta-operation (involved when we fetch from the git repository + : location) doesn't preserve the directory modification time. That's why + : we also pass --full-time and enable the test for only platforms where ls + : supports this option. + : + if ($cxx.target.class == 'linux') { $c <<"EOI" && $b 2>>~%EOE% != 0 - ls -l $src_base | sed -n -e '$ds' | \ + ls -l --full-time $src_base | sed -n -e '$ds' | \ set t; cp -r $src_base/cp-dir ./; - ls -l | sed -n -e '$ds' >"\$t" + ls -l --full-time | sed -n -e '$ds' >"\$t" EOI %.+ error: sed stdout doesn't match expected% %.+ EOE } -#\ } } -- cgit v1.1