mirror of
https://github.com/Ed94/Odin.git
synced 2026-08-07 08:08:50 +00:00
getting tests to run
This commit is contained in:
@@ -1,8 +1,8 @@
|
|||||||
//+private
|
//+private
|
||||||
package os2
|
package os2
|
||||||
|
|
||||||
import "core:runtime"
|
//import "core:runtime"
|
||||||
import "core:mem"
|
//import "core:mem"
|
||||||
import win32 "core:sys/windows"
|
import win32 "core:sys/windows"
|
||||||
|
|
||||||
_get_env :: proc(key: string, allocator := context.allocator) -> (value: string, found: bool) {
|
_get_env :: proc(key: string, allocator := context.allocator) -> (value: string, found: bool) {
|
||||||
|
|||||||
@@ -36,11 +36,6 @@ _std_handle :: proc(kind: Std_Handle_Kind) -> Handle {
|
|||||||
unreachable()
|
unreachable()
|
||||||
}
|
}
|
||||||
|
|
||||||
_opendir :: proc(path: string) -> (handle: Handle, err: Error) {
|
|
||||||
return INVALID_HANDLE, .Invalid_Argument
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
_open :: proc(path: string, flags: File_Flags, perm: File_Mode) -> (handle: Handle, err: Error) {
|
_open :: proc(path: string, flags: File_Flags, perm: File_Mode) -> (handle: Handle, err: Error) {
|
||||||
handle = INVALID_HANDLE
|
handle = INVALID_HANDLE
|
||||||
if len(path) == 0 {
|
if len(path) == 0 {
|
||||||
|
|||||||
@@ -0,0 +1,32 @@
|
|||||||
|
ODIN=../../odin
|
||||||
|
PYTHON=$(shell which python3)
|
||||||
|
|
||||||
|
all: download_test_assets image_test compress_test strings_test hash_test crypto_test noise_test encoding_test os2_test
|
||||||
|
|
||||||
|
download_test_assets:
|
||||||
|
$(PYTHON) download_assets.py
|
||||||
|
|
||||||
|
image_test:
|
||||||
|
$(ODIN) run image/test_core_image.odin
|
||||||
|
|
||||||
|
compress_test:
|
||||||
|
$(ODIN) run compress/test_core_compress.odin
|
||||||
|
|
||||||
|
strings_test:
|
||||||
|
$(ODIN) run strings/test_core_strings.odin
|
||||||
|
|
||||||
|
hash_test:
|
||||||
|
$(ODIN) run hash -out=test_hash -o:speed -no-bounds-check
|
||||||
|
|
||||||
|
crypto_test:
|
||||||
|
$(ODIN) run crypto -out=crypto_hash -o:speed -no-bounds-check
|
||||||
|
|
||||||
|
noise_test:
|
||||||
|
$(ODIN) run math/noise -out=test_noise
|
||||||
|
|
||||||
|
os2_test:
|
||||||
|
$(ODIN) run os2/test_os2.odin -out=test_os2
|
||||||
|
|
||||||
|
encoding_test:
|
||||||
|
$(ODIN) run encoding/json -out=test_json
|
||||||
|
$(ODIN) run encoding/varint -out=test_varint
|
||||||
@@ -42,3 +42,8 @@ echo ---
|
|||||||
echo Running core:math/noise tests
|
echo Running core:math/noise tests
|
||||||
echo ---
|
echo ---
|
||||||
%PATH_TO_ODIN% run math/noise %COMMON%
|
%PATH_TO_ODIN% run math/noise %COMMON%
|
||||||
|
|
||||||
|
echo ---
|
||||||
|
echo Running core:os/os2 tests
|
||||||
|
echo ---
|
||||||
|
%PATH_TO_ODIN% run os2 %COMMON%
|
||||||
|
|||||||
@@ -2,10 +2,14 @@ package test_os2
|
|||||||
|
|
||||||
import "core:fmt"
|
import "core:fmt"
|
||||||
import "core:os/os2"
|
import "core:os/os2"
|
||||||
import "core:sys/unix"
|
|
||||||
import "core:testing"
|
import "core:testing"
|
||||||
import "core:intrinsics"
|
import "core:intrinsics"
|
||||||
|
|
||||||
|
// really only want sys_access for more finite testing
|
||||||
|
when ODIN_OS == .Linux {
|
||||||
|
import "core:sys/unix"
|
||||||
|
}
|
||||||
|
|
||||||
TEST_count := 0
|
TEST_count := 0
|
||||||
TEST_fail := 0
|
TEST_fail := 0
|
||||||
|
|
||||||
@@ -140,12 +144,16 @@ path_test :: proc(t: ^testing.T) {
|
|||||||
err = os2.close(fd)
|
err = os2.close(fd)
|
||||||
_expect_no_error(t, err)
|
_expect_no_error(t, err)
|
||||||
|
|
||||||
expect(t, unix.sys_access("a/b/c/file.txt", X_OK) < 0, "unexpected exec permission")
|
when ODIN_OS == .Linux {
|
||||||
|
expect(t, unix.sys_access("a/b/c/file.txt", X_OK) < 0, "unexpected exec permission")
|
||||||
|
}
|
||||||
|
|
||||||
err = os2.rename("a/b/c/file.txt", "a/b/file.txt")
|
err = os2.rename("a/b/c/file.txt", "a/b/file.txt")
|
||||||
_expect_no_error(t, err)
|
_expect_no_error(t, err)
|
||||||
|
|
||||||
expect(t, unix.sys_access("a/b/c/file.txt", F_OK) < 0, "unexpected exec permission")
|
when ODIN_OS == .Linux {
|
||||||
|
expect(t, unix.sys_access("a/b/c/file.txt", F_OK) < 0, "unexpected exec permission")
|
||||||
|
}
|
||||||
|
|
||||||
err = os2.symlink("b/c/d", "a/symlink_to_d")
|
err = os2.symlink("b/c/d", "a/symlink_to_d")
|
||||||
_expect_no_error(t, err)
|
_expect_no_error(t, err)
|
||||||
@@ -161,7 +169,9 @@ path_test :: proc(t: ^testing.T) {
|
|||||||
err = os2.close(fd)
|
err = os2.close(fd)
|
||||||
_expect_no_error(t, err)
|
_expect_no_error(t, err)
|
||||||
|
|
||||||
expect_value(t, unix.sys_access("a/b/c/d/shnt.txt", X_OK | R_OK | W_OK), 0)
|
when ODIN_OS == .Linux {
|
||||||
|
expect_value(t, unix.sys_access("a/b/c/d/shnt.txt", X_OK | R_OK | W_OK), 0)
|
||||||
|
}
|
||||||
|
|
||||||
err = os2.remove_all("a")
|
err = os2.remove_all("a")
|
||||||
_expect_no_error(t, err)
|
_expect_no_error(t, err)
|
||||||
|
|||||||
Reference in New Issue
Block a user