diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 8dc8f3f3..a44fde1e 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -27,7 +27,7 @@ jobs: echo "adding '${PWD}' to PATH" echo "${PWD}" >> $GITHUB_PATH - name: Download uutils/coreutils - uses: engineerd/configurator@v0.0.8 + uses: engineerd/configurator@v0.0.10 with: name: 'coreutils.exe' url: 'https://github.com/uutils/coreutils/releases/download/0.0.17/coreutils-0.0.17-x86_64-pc-windows-msvc.zip' @@ -58,7 +58,7 @@ jobs: shell: bash run: | # Run tests - cd coreutils && v test . + cd coreutils && USE_MULTI_BINARY_TO_TEST=coreutils v test . ubuntu-fast-build: runs-on: ubuntu-latest @@ -74,7 +74,6 @@ jobs: uses: actions/checkout@v2 with: path: coreutils - - name: V doctor run: v doctor - name: Ensure everything is formatted @@ -100,7 +99,6 @@ jobs: uses: actions/checkout@v2 with: path: coreutils - - name: Build all with -prod run: cd coreutils && v run build.vsh -prod - name: Run tests @@ -120,10 +118,8 @@ jobs: uses: actions/checkout@v2 with: path: coreutils - - name: Build all run: cd coreutils && v run build.vsh - - name: Native utils diagnostics (before GNU coreutils) run: | sleep --version @@ -132,6 +128,5 @@ jobs: uses: ShenTengTu/setup-gnu-coreutils-action@v1 - name: Test GNU coreutils uptime run: uptime --version - - name: Run tests run: cd coreutils && GNU_COREUTILS_INSTALLED=1 make test diff --git a/common/testing/testing.v b/common/testing/testing.v index 343b0790..154f74be 100644 --- a/common/testing/testing.v +++ b/common/testing/testing.v @@ -109,6 +109,7 @@ pub fn command_fails(cmd string) !os.Result { } const gnu_coreutils_installed = os.getenv('GNU_COREUTILS_INSTALLED').int() == 1 +const use_multi_binary_to_test = os.getenv('USE_MULTI_BINARY_TO_TEST') // same_results/2 executes the given commands, and ensures that // their results are exactly the same, both for their exit codes, diff --git a/common/testing/testrig.v b/common/testing/testrig.v index fbc5b0ca..33ba494b 100644 --- a/common/testing/testrig.v +++ b/common/testing/testrig.v @@ -11,7 +11,7 @@ const small_diff_size = 64 pub struct TestRig { pub: util string - platform_util string + platform_util_call string platform_util_path string executable_under_test string temp_dir string @@ -30,18 +30,14 @@ pub fn (rig TestRig) call_for_test(args string) os.Result { } pub fn prepare_rig(config TestRigConfig) TestRig { - call_util := $if !windows { - config.util - } $else { - 'coreutils' - } + call_util := if use_multi_binary_to_test != '' { use_multi_binary_to_test } else { config.util } platform_util_path := os.find_abs_path_of_executable(call_util) or { eprintln("ERROR: Local platform util '${call_util}' not found!") exit(1) } - platform_util := if call_util == 'coreutils' { + platform_util := if use_multi_binary_to_test != '' { '${call_util} ${config.util}' } else { call_util @@ -53,7 +49,7 @@ pub fn prepare_rig(config TestRigConfig) TestRig { os.chdir(temp_dir) or { panic('Unable to set working directory: ${temp_dir}') } rig := TestRig{ util: config.util - platform_util: platform_util + platform_util_call: platform_util platform_util_path: platform_util_path cmd: new_paired_command(platform_util, exec_under_test) executable_under_test: exec_under_test @@ -70,13 +66,9 @@ pub fn (rig TestRig) clean_up() { } pub fn (rig TestRig) assert_platform_util() { - platform_ver := $if !windows { - os.execute('${rig.platform_util_path} --version') - } $else { - os.execute('${rig.platform_util_path} ${rig.util} --version') - } + platform_ver := os.execute('${rig.platform_util_call} --version') + eprintln('Platform util version: [${platform_ver.output}]') assert platform_ver.exit_code == 0 - eprintln('Platform util version: ${platform_ver.output}') if platform_ver.output.len > rig.util.len { assert platform_ver.output[..rig.util.len] == rig.util @@ -99,11 +91,7 @@ pub fn (rig TestRig) assert_platform_util() { } pub fn (rig TestRig) call_orig(args string) os.Result { - return $if !windows { - os.execute('${rig.platform_util_path} ${args}') - } $else { - os.execute('${rig.platform_util_path} ${rig.util} ${args}') - } + return os.execute('${rig.platform_util_call} ${args}') } pub fn (rig TestRig) call_new(args string) os.Result { @@ -127,18 +115,14 @@ pub fn (rig TestRig) assert_same_results(args string) { // If the name of the executable appears in the returned message, shorten it to the util // name because the paths are different for GNU coreutil and v-coreutil - cmd1_output := $if !windows { - cmd1_res.output.replace(rig.platform_util_path, rig.util) - } $else { - cmd1_res.output.replace('${rig.platform_util_path} ${rig.util}', '${rig.util}') - } + cmd1_output := cmd1_res.output.replace(rig.platform_util_call, rig.util) cmd2_output := cmd2_res.output.replace(rig.executable_under_test, rig.util) mut noutput1 := normalise(cmd1_output) mut noutput2 := normalise(cmd2_output) $if trace_same_results ? { eprintln('------------------------------------') - eprintln('>> same_results cmd1: "${rig.platform_util_path} ${args}"') + eprintln('>> same_results cmd1: "${rig.platform_util_call} ${args}"') eprintln('>> same_results cmd2: "${rig.executable_under_test} ${args}"') eprintln(' cmd1_res.exit_code: ${cmd1_res.exit_code}') eprintln(' cmd2_res.exit_code: ${cmd2_res.exit_code}') diff --git a/coreutils-8.32-x64-win.zip b/coreutils-8.32-x64-win.zip new file mode 100644 index 00000000..d1b9db39 Binary files /dev/null and b/coreutils-8.32-x64-win.zip differ