all: more chdir/chmod fixes

pull/11327/head
Alexander Medvednikov 2021-08-28 12:51:37 +03:00
parent 2b92ccecb5
commit cf4081e2dd
12 changed files with 14 additions and 14 deletions

View File

@ -12,7 +12,7 @@ fn test_syscallwrappers() {
dot_checks := vdir + '/.checks'
assert os.is_dir(dot_checks)
os.chdir(dot_checks)
os.chdir(dot_checks) or {}
checks_v := 'checks.v'
assert os.exists(checks_v)
rc := os.execute_or_exit('v run $checks_v')

View File

@ -886,7 +886,7 @@ pub fn flush() {
// chmod change file access attributes of `path` to `mode`.
// Octals like `0o600` can be used.
pub fn chmod(path string, mode int)? {
pub fn chmod(path string, mode int) ? {
if C.chmod(&char(path.str), mode) != 0 {
return error_with_code('chmod failed: ' + posix_get_error_msg(C.errno), C.errno)
}

View File

@ -9,7 +9,7 @@ import runtime
import benchmark
const skip_files = [
'non_existing.vv' /* minimize commit diff churn, do not remove */,
'non_existing.vv', // minimize commit diff churn, do not remove
]
const skip_on_ubuntu_musl = [
@ -51,7 +51,7 @@ mut:
fn test_all() {
vexe := os.getenv('VEXE')
vroot := os.dir(vexe)
os.chdir(vroot)
os.chdir(vroot) or {}
checker_dir := 'vlib/v/checker/tests'
parser_dir := 'vlib/v/parser/tests'
scanner_dir := 'vlib/v/scanner/tests'

View File

@ -3,7 +3,7 @@ module doc
import os
fn testsuite_begin() {
os.chdir(@VMODROOT)
os.chdir(@VMODROOT) or {}
eprintln('>> @VMODROOT: ' + @VMODROOT)
}

View File

@ -29,7 +29,7 @@ fn test_fmt() {
exit(error_missing_vexe)
}
vroot := os.dir(vexe)
os.chdir(vroot)
os.chdir(vroot) or {}
basepath := os.join_path(vroot, '')
tmpfolder := os.temp_dir()
diff_cmd := diff.find_working_diff_command() or { '' }

View File

@ -33,7 +33,7 @@ fn test_vlib_fmt() {
tmpfolder := os.temp_dir()
diff_cmd := diff.find_working_diff_command() or { '' }
mut fmt_bench := benchmark.new_benchmark()
os.chdir(vroot)
os.chdir(vroot) or {}
input_files := os.walk_ext('vlib/v/', '.v').filter(!it.contains('/tests/'))
fmt_bench.set_total_expected_steps(input_files.len)
for istep, ipath in input_files {

View File

@ -17,7 +17,7 @@ const there_is_grep_available = is_grep_working()
fn test_example_compilation() {
vexe := os.getenv('VEXE')
os.chdir(os.dir(vexe))
os.chdir(os.dir(vexe)) or {}
os.mkdir_all(output_dir) or { panic(err) }
files := find_test_files()
for file in files {

View File

@ -37,7 +37,7 @@ fn test_node_exists() {
fn test_running_programs_compiled_with_the_js_backend() ? {
os.setenv('VCOLORS', 'never', true)
os.chdir(vroot)
os.chdir(vroot) or {}
test_dir := 'vlib/v/gen/js/tests/testdata'
main_files := get_main_files_in_dir(test_dir)
fails := check_path(test_dir, main_files) ?

View File

@ -22,7 +22,7 @@ fn test_native() {
//
wrkdir := os.join_path(os.temp_dir(), 'vtests', 'native')
os.mkdir_all(wrkdir) or { panic(err) }
os.chdir(wrkdir)
os.chdir(wrkdir) or {}
tests := files.filter(it.ends_with('.vv'))
if tests.len == 0 {
println('no native tests found')

View File

@ -16,7 +16,7 @@ fn test_vexe_is_set() {
}
fn test_compiling_without_vmodules_fails() {
os.chdir(vroot)
os.chdir(vroot) or {}
os.setenv('VMODULES', '', true)
res := os.execute('"$vexe" run "$mainvv"')
assert res.exit_code == 1
@ -24,7 +24,7 @@ fn test_compiling_without_vmodules_fails() {
}
fn test_compiling_with_vmodules_works() {
os.chdir(vroot)
os.chdir(vroot) or {}
vmpaths := ['path1', 'path2', 'path3'].map(os.join_path(basepath, it))
os.setenv('VMODULES', vmpaths.join(os.path_delimiter), true)
res := os.execute('"$vexe" run "$mainvv"')

View File

@ -11,7 +11,7 @@ fn test_vexe_exists() {
}
fn test_v_profile_works() ? {
os.chdir(vroot)
os.chdir(vroot) or {}
folders_root := os.join_path(vroot, 'vlib/v/tests/run_project_folders')
folder_names := os.ls(folders_root) ?
mut folder_paths := []string{}

View File

@ -57,7 +57,7 @@ fn test_all() {
//
wrkdir := os.join_path(os.temp_dir(), 'vtests', 'valgrind')
os.mkdir_all(wrkdir) or { panic(err) }
os.chdir(wrkdir)
os.chdir(wrkdir) or {}
//
only_ordinary_v_files := files.filter(it.ends_with('.v') && !it.ends_with('_test.v'))
tests := vtest.filter_vtest_only(only_ordinary_v_files, basepath: valgrind_test_path)