test-cleancode: add more of vlib/v (#8882)
							parent
							
								
									7a35131721
								
							
						
					
					
						commit
						18e88d2fc8
					
				|  | @ -37,28 +37,26 @@ const ( | ||||||
| 		'vlib/v/checker/', | 		'vlib/v/checker/', | ||||||
| 		'vlib/v/depgraph/', | 		'vlib/v/depgraph/', | ||||||
| 		'vlib/v/doc/', | 		'vlib/v/doc/', | ||||||
|  | 		'vlib/v/embed_file/', | ||||||
| 		'vlib/v/errors/', | 		'vlib/v/errors/', | ||||||
| 		'vlib/v/eval/', | 		'vlib/v/eval/', | ||||||
| 		'vlib/v/fmt/', | 		'vlib/v/fmt/', | ||||||
| 		'vlib/v/gen/c/auto_str_methods.v', | 		'vlib/v/gen/c/', | ||||||
| 		'vlib/v/gen/c/cgen.v', | 		/* 'vlib/v/gen/js/', */ | ||||||
| 		'vlib/v/gen/c/cgen_test.v', | 		'vlib/v/gen/tests/', | ||||||
| 		'vlib/v/gen/c/cmain.v', | 		'vlib/v/gen/x64/', | ||||||
| 		'vlib/v/gen/c/comptime.v', | 		'vlib/v/live/', | ||||||
| 		'vlib/v/gen/c/fn.v', | 		'vlib/v/markused/', | ||||||
| 		'vlib/v/gen/c/json.v', |  | ||||||
| 		'vlib/v/gen/c/live.v', |  | ||||||
| 		'vlib/v/gen/c/profile.v', |  | ||||||
| 		'vlib/v/gen/c/sql.v', |  | ||||||
| 		'vlib/v/gen/c/str.v', |  | ||||||
| 		'vlib/v/gen/x64/elf.v', |  | ||||||
| 		'vlib/v/gen/x64/elf_obj.v', |  | ||||||
| 		'vlib/v/gen/x64/gen.v', |  | ||||||
| 		'vlib/v/parser/', | 		'vlib/v/parser/', | ||||||
|  | 		/* 'vlib/v/pkgconfig/', */ | ||||||
| 		'vlib/v/pref/', | 		'vlib/v/pref/', | ||||||
|  | 		'vlib/v/preludes', | ||||||
| 		'vlib/v/scanner/', | 		'vlib/v/scanner/', | ||||||
| 		'vlib/v/table/', | 		'vlib/v/table/', | ||||||
|  | 		/* 'vlib/v/tests/', */ | ||||||
|  | 		'vlib/v/token/', | ||||||
| 		'vlib/v/util/', | 		'vlib/v/util/', | ||||||
|  | 		'vlib/v/vcache/', | ||||||
| 		'vlib/v/vet/', | 		'vlib/v/vet/', | ||||||
| 		'vlib/v/vmod/', | 		'vlib/v/vmod/', | ||||||
| 		'vlib/cli/', | 		'vlib/cli/', | ||||||
|  |  | ||||||
|  | @ -10,19 +10,19 @@ pub type FNLiveReloadCB = fn (info &LiveReloadInfo) | ||||||
| 
 | 
 | ||||||
| pub struct LiveReloadInfo { | pub struct LiveReloadInfo { | ||||||
| pub: | pub: | ||||||
| 	vexe              string // full path to the v compiler
 | 	vexe             string  // full path to the v compiler
 | ||||||
| 	vopts             string // v compiler options for a live shared library
 | 	vopts            string  // v compiler options for a live shared library
 | ||||||
| 	original          string // full path to the original source file, compiled with -live
 | 	original         string  // full path to the original source file, compiled with -live
 | ||||||
| 	live_fn_mutex     voidptr // the address of the C mutex, that locks the [live] fns during reloads.
 | 	live_fn_mutex    voidptr // the address of the C mutex, that locks the [live] fns during reloads.
 | ||||||
| 	live_linkfn       FNLinkLiveSymbols // generated C callback; receives a dlopen handle
 | 	live_linkfn      FNLinkLiveSymbols // generated C callback; receives a dlopen handle
 | ||||||
| 	so_extension      string // .so or .dll
 | 	so_extension     string // .so or .dll
 | ||||||
| 	so_name_template  string // a sprintf template for the shared libraries location
 | 	so_name_template string // a sprintf template for the shared libraries location
 | ||||||
| pub mut: | pub mut: | ||||||
| 	live_lib          voidptr // the result of dl.open
 | 	live_lib          voidptr        // the result of dl.open
 | ||||||
| 	reloads           int // how many times a reloading was tried
 | 	reloads           int            // how many times a reloading was tried
 | ||||||
| 	reloads_ok        int // how many times the reloads succeeded
 | 	reloads_ok        int            // how many times the reloads succeeded
 | ||||||
| 	reload_time_ms    int // how much time the last reload took (compilation + loading)
 | 	reload_time_ms    int            // how much time the last reload took (compilation + loading)
 | ||||||
| 	last_mod_ts       int // a timestamp for when the original was last changed
 | 	last_mod_ts       int            // a timestamp for when the original was last changed
 | ||||||
| 	recheck_period_ms int = 100 // how often do you want to check for changes
 | 	recheck_period_ms int = 100 // how often do you want to check for changes
 | ||||||
| 	cb_recheck        FNLiveReloadCB = voidptr(0) // executed periodically
 | 	cb_recheck        FNLiveReloadCB = voidptr(0) // executed periodically
 | ||||||
| 	cb_compile_failed FNLiveReloadCB = voidptr(0) // executed when a reload compilation failed
 | 	cb_compile_failed FNLiveReloadCB = voidptr(0) // executed when a reload compilation failed
 | ||||||
|  | @ -30,7 +30,7 @@ pub mut: | ||||||
| 	cb_after          FNLiveReloadCB = voidptr(0) // executed after a reload try happened, even if failed
 | 	cb_after          FNLiveReloadCB = voidptr(0) // executed after a reload try happened, even if failed
 | ||||||
| 	cb_locked_before  FNLiveReloadCB = voidptr(0) // executed before lib reload, in the mutex section
 | 	cb_locked_before  FNLiveReloadCB = voidptr(0) // executed before lib reload, in the mutex section
 | ||||||
| 	cb_locked_after   FNLiveReloadCB = voidptr(0) // executed after lib reload, in the mutex section
 | 	cb_locked_after   FNLiveReloadCB = voidptr(0) // executed after lib reload, in the mutex section
 | ||||||
| 	user_ptr          voidptr = voidptr(0) // you can set it to anything, then retrieve it in the cb_ fns
 | 	user_ptr          voidptr        = voidptr(0) // you can set it to anything, then retrieve it in the cb_ fns
 | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| // LiveReloadInfo.live_linkfn should be called by the reloader
 | // LiveReloadInfo.live_linkfn should be called by the reloader
 | ||||||
|  | @ -52,7 +52,7 @@ pub mut: | ||||||
| // so that the user can set callbacks, read meta information, etc.
 | // so that the user can set callbacks, read meta information, etc.
 | ||||||
| pub fn info() &LiveReloadInfo { | pub fn info() &LiveReloadInfo { | ||||||
| 	if C.g_live_info != 0 { | 	if C.g_live_info != 0 { | ||||||
| 		return unsafe {&LiveReloadInfo(C.g_live_info)} | 		return unsafe { &LiveReloadInfo(C.g_live_info) } | ||||||
| 	} | 	} | ||||||
| 	// When the current program is not compiled with -live, simply
 | 	// When the current program is not compiled with -live, simply
 | ||||||
| 	// return a new empty struct LiveReloadInfo in order to prevent
 | 	// return a new empty struct LiveReloadInfo in order to prevent
 | ||||||
|  | @ -60,9 +60,9 @@ pub fn info() &LiveReloadInfo { | ||||||
| 	// started, and the structure LiveReloadInfo will not get updated.
 | 	// started, and the structure LiveReloadInfo will not get updated.
 | ||||||
| 	// All its fields will be 0, but still safe to access.
 | 	// All its fields will be 0, but still safe to access.
 | ||||||
| 	mut x := &LiveReloadInfo{} | 	mut x := &LiveReloadInfo{} | ||||||
| 	unsafe {  | 	unsafe { | ||||||
| 		mut p := &u64(&C.g_live_info) | 		mut p := &u64(&C.g_live_info) | ||||||
| 		*p = &u64(x)  | 		*p = &u64(x) | ||||||
| 	}         | 	} | ||||||
| 	return x | 	return x | ||||||
| } | } | ||||||
|  |  | ||||||
|  | @ -78,8 +78,8 @@ fn (b &BenchedTests) fn_name() string { | ||||||
| // Called at the end of the test program produced by `v -stats file_test.v`
 | // Called at the end of the test program produced by `v -stats file_test.v`
 | ||||||
| fn (mut b BenchedTests) end_testing() { | fn (mut b BenchedTests) end_testing() { | ||||||
| 	b.bench.stop() | 	b.bench.stop() | ||||||
| 	println(inner_indent + b.bench.total_message('running V tests in "' + os.file_name(b.test_suit_file) + | 	println(inner_indent + b.bench.total_message('running V tests in "' + | ||||||
| 		'"')) | 		os.file_name(b.test_suit_file) + '"')) | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| // ///////////////////////////////////////////////////////////////////
 | // ///////////////////////////////////////////////////////////////////
 | ||||||
|  |  | ||||||
		Loading…
	
		Reference in New Issue