koffi 0.9.8 → 0.9.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CMakeLists.txt +111 -0
- package/build/koffi.node +0 -0
- package/package.json +7 -3
- package/src/ffi.cc +1 -1
- package/test/registry/machines.json +12 -6
- package/test/test.js +10 -2
- package/test/tests/sqlite.js +101 -0
- package/vendor/raylib/projects/VS2019/examples/audio_module_playing.vcxproj +0 -387
- package/vendor/raylib/projects/VS2019/examples/audio_multichannel_sound.vcxproj +0 -387
- package/vendor/raylib/projects/VS2019/examples/audio_music_stream.vcxproj +0 -387
- package/vendor/raylib/projects/VS2019/examples/audio_raw_stream.vcxproj +0 -387
- package/vendor/raylib/projects/VS2019/examples/audio_sound_loading.vcxproj +0 -387
- package/vendor/raylib/projects/VS2019/examples/core_2d_camera.vcxproj +0 -387
- package/vendor/raylib/projects/VS2019/examples/core_2d_camera_platformer.vcxproj +0 -387
- package/vendor/raylib/projects/VS2019/examples/core_3d_camera_first_person.vcxproj +0 -387
- package/vendor/raylib/projects/VS2019/examples/core_3d_camera_free.vcxproj +0 -387
- package/vendor/raylib/projects/VS2019/examples/core_3d_camera_mode.vcxproj +0 -387
- package/vendor/raylib/projects/VS2019/examples/core_3d_picking.vcxproj +0 -387
- package/vendor/raylib/projects/VS2019/examples/core_basic_window.vcxproj +0 -387
- package/vendor/raylib/projects/VS2019/examples/core_custom_logging.vcxproj +0 -387
- package/vendor/raylib/projects/VS2019/examples/core_drop_files.vcxproj +0 -387
- package/vendor/raylib/projects/VS2019/examples/core_input_gamepad.vcxproj +0 -387
- package/vendor/raylib/projects/VS2019/examples/core_input_gestures.vcxproj +0 -387
- package/vendor/raylib/projects/VS2019/examples/core_input_keys.vcxproj +0 -387
- package/vendor/raylib/projects/VS2019/examples/core_input_mouse.vcxproj +0 -387
- package/vendor/raylib/projects/VS2019/examples/core_input_mouse_wheel.vcxproj +0 -387
- package/vendor/raylib/projects/VS2019/examples/core_input_multitouch.vcxproj +0 -387
- package/vendor/raylib/projects/VS2019/examples/core_loading_thread.vcxproj +0 -387
- package/vendor/raylib/projects/VS2019/examples/core_quat_conversion.vcxproj +0 -387
- package/vendor/raylib/projects/VS2019/examples/core_random_values.vcxproj +0 -387
- package/vendor/raylib/projects/VS2019/examples/core_scissor_test.vcxproj +0 -387
- package/vendor/raylib/projects/VS2019/examples/core_split_screen.vcxproj +0 -387
- package/vendor/raylib/projects/VS2019/examples/core_storage_values.vcxproj +0 -387
- package/vendor/raylib/projects/VS2019/examples/core_vr_simulator.vcxproj +0 -387
- package/vendor/raylib/projects/VS2019/examples/core_window_flags.vcxproj +0 -387
- package/vendor/raylib/projects/VS2019/examples/core_window_letterbox.vcxproj +0 -387
- package/vendor/raylib/projects/VS2019/examples/core_world_screen.vcxproj +0 -387
- package/vendor/raylib/projects/VS2019/examples/easings_testbed.vcxproj +0 -387
- package/vendor/raylib/projects/VS2019/examples/embedded_files_loading.vcxproj +0 -387
- package/vendor/raylib/projects/VS2019/examples/models_animation.vcxproj +0 -387
- package/vendor/raylib/projects/VS2019/examples/models_billboard.vcxproj +0 -387
- package/vendor/raylib/projects/VS2019/examples/models_box_collisions.vcxproj +0 -387
- package/vendor/raylib/projects/VS2019/examples/models_cubicmap.vcxproj +0 -387
- package/vendor/raylib/projects/VS2019/examples/models_first_person_maze.vcxproj +0 -387
- package/vendor/raylib/projects/VS2019/examples/models_geometric_shapes.vcxproj +0 -387
- package/vendor/raylib/projects/VS2019/examples/models_heightmap.vcxproj +0 -387
- package/vendor/raylib/projects/VS2019/examples/models_loading.vcxproj +0 -387
- package/vendor/raylib/projects/VS2019/examples/models_loading_gltf.vcxproj +0 -387
- package/vendor/raylib/projects/VS2019/examples/models_loading_vox.vcxproj +0 -387
- package/vendor/raylib/projects/VS2019/examples/models_mesh_generation.vcxproj +0 -387
- package/vendor/raylib/projects/VS2019/examples/models_mesh_picking.vcxproj +0 -387
- package/vendor/raylib/projects/VS2019/examples/models_orthographic_projection.vcxproj +0 -387
- package/vendor/raylib/projects/VS2019/examples/models_rlgl_solar_system.vcxproj +0 -387
- package/vendor/raylib/projects/VS2019/examples/models_skybox.vcxproj +0 -387
- package/vendor/raylib/projects/VS2019/examples/models_waving_cubes.vcxproj +0 -387
- package/vendor/raylib/projects/VS2019/examples/models_yaw_pitch_roll.vcxproj +0 -387
- package/vendor/raylib/projects/VS2019/examples/physics_demo.vcxproj +0 -387
- package/vendor/raylib/projects/VS2019/examples/physics_friction.vcxproj +0 -387
- package/vendor/raylib/projects/VS2019/examples/physics_movement.vcxproj +0 -387
- package/vendor/raylib/projects/VS2019/examples/physics_restitution.vcxproj +0 -387
- package/vendor/raylib/projects/VS2019/examples/physics_shatter.vcxproj +0 -387
- package/vendor/raylib/projects/VS2019/examples/raudio_standalone.vcxproj +0 -387
- package/vendor/raylib/projects/VS2019/examples/rlgl_standalone.vcxproj +0 -391
- package/vendor/raylib/projects/VS2019/examples/shaders_basic_lighting.vcxproj +0 -387
- package/vendor/raylib/projects/VS2019/examples/shaders_custom_uniform.vcxproj +0 -387
- package/vendor/raylib/projects/VS2019/examples/shaders_eratosthenes.vcxproj +0 -387
- package/vendor/raylib/projects/VS2019/examples/shaders_fog.vcxproj +0 -387
- package/vendor/raylib/projects/VS2019/examples/shaders_hot_reloading.vcxproj +0 -387
- package/vendor/raylib/projects/VS2019/examples/shaders_julia_set.vcxproj +0 -387
- package/vendor/raylib/projects/VS2019/examples/shaders_mesh_instancing.vcxproj +0 -387
- package/vendor/raylib/projects/VS2019/examples/shaders_model_shader.vcxproj +0 -387
- package/vendor/raylib/projects/VS2019/examples/shaders_multi_sample2d.vcxproj +0 -387
- package/vendor/raylib/projects/VS2019/examples/shaders_palette_switch.vcxproj +0 -387
- package/vendor/raylib/projects/VS2019/examples/shaders_postprocessing.vcxproj +0 -387
- package/vendor/raylib/projects/VS2019/examples/shaders_raymarching.vcxproj +0 -387
- package/vendor/raylib/projects/VS2019/examples/shaders_shapes_textures.vcxproj +0 -387
- package/vendor/raylib/projects/VS2019/examples/shaders_simple_mask.vcxproj +0 -387
- package/vendor/raylib/projects/VS2019/examples/shaders_spotlight.vcxproj +0 -387
- package/vendor/raylib/projects/VS2019/examples/shaders_texture_drawing.vcxproj +0 -387
- package/vendor/raylib/projects/VS2019/examples/shaders_texture_waves.vcxproj +0 -387
- package/vendor/raylib/projects/VS2019/examples/shapes_basic_shapes.vcxproj +0 -387
- package/vendor/raylib/projects/VS2019/examples/shapes_bouncing_ball.vcxproj +0 -387
- package/vendor/raylib/projects/VS2019/examples/shapes_collision_area.vcxproj +0 -387
- package/vendor/raylib/projects/VS2019/examples/shapes_colors_palette.vcxproj +0 -387
- package/vendor/raylib/projects/VS2019/examples/shapes_draw_circle_sector.vcxproj +0 -387
- package/vendor/raylib/projects/VS2019/examples/shapes_draw_rectangle_rounded.vcxproj +0 -387
- package/vendor/raylib/projects/VS2019/examples/shapes_draw_ring.vcxproj +0 -387
- package/vendor/raylib/projects/VS2019/examples/shapes_easings_ball_anim.vcxproj +0 -387
- package/vendor/raylib/projects/VS2019/examples/shapes_easings_box_anim.vcxproj +0 -387
- package/vendor/raylib/projects/VS2019/examples/shapes_easings_rectangle_array.vcxproj +0 -387
- package/vendor/raylib/projects/VS2019/examples/shapes_following_eyes.vcxproj +0 -387
- package/vendor/raylib/projects/VS2019/examples/shapes_lines_bezier.vcxproj +0 -387
- package/vendor/raylib/projects/VS2019/examples/shapes_logo_raylib.vcxproj +0 -387
- package/vendor/raylib/projects/VS2019/examples/shapes_logo_raylib_anim.vcxproj +0 -387
- package/vendor/raylib/projects/VS2019/examples/shapes_rectangle_scaling.vcxproj +0 -387
- package/vendor/raylib/projects/VS2019/examples/text_font_filters.vcxproj +0 -387
- package/vendor/raylib/projects/VS2019/examples/text_font_loading.vcxproj +0 -387
- package/vendor/raylib/projects/VS2019/examples/text_font_sdf.vcxproj +0 -387
- package/vendor/raylib/projects/VS2019/examples/text_font_spritefont.vcxproj +0 -387
- package/vendor/raylib/projects/VS2019/examples/text_format_text.vcxproj +0 -387
- package/vendor/raylib/projects/VS2019/examples/text_input_box.vcxproj +0 -387
- package/vendor/raylib/projects/VS2019/examples/text_raylib_fonts.vcxproj +0 -387
- package/vendor/raylib/projects/VS2019/examples/text_rectangle_bounds.vcxproj +0 -387
- package/vendor/raylib/projects/VS2019/examples/text_unicode.vcxproj +0 -387
- package/vendor/raylib/projects/VS2019/examples/text_writing_anim.vcxproj +0 -387
- package/vendor/raylib/projects/VS2019/examples/textures_background_scrolling.vcxproj +0 -387
- package/vendor/raylib/projects/VS2019/examples/textures_blend_modes.vcxproj +0 -387
- package/vendor/raylib/projects/VS2019/examples/textures_bunnymark.vcxproj +0 -387
- package/vendor/raylib/projects/VS2019/examples/textures_draw_tiled.vcxproj +0 -387
- package/vendor/raylib/projects/VS2019/examples/textures_image_drawing.vcxproj +0 -387
- package/vendor/raylib/projects/VS2019/examples/textures_image_generation.vcxproj +0 -387
- package/vendor/raylib/projects/VS2019/examples/textures_image_loading.vcxproj +0 -387
- package/vendor/raylib/projects/VS2019/examples/textures_image_processing.vcxproj +0 -387
- package/vendor/raylib/projects/VS2019/examples/textures_image_text.vcxproj +0 -387
- package/vendor/raylib/projects/VS2019/examples/textures_logo_raylib.vcxproj +0 -387
- package/vendor/raylib/projects/VS2019/examples/textures_mouse_painting.vcxproj +0 -387
- package/vendor/raylib/projects/VS2019/examples/textures_npatch_drawing.vcxproj +0 -387
- package/vendor/raylib/projects/VS2019/examples/textures_particles_blending.vcxproj +0 -387
- package/vendor/raylib/projects/VS2019/examples/textures_raw_data.vcxproj +0 -387
- package/vendor/raylib/projects/VS2019/examples/textures_rectangle.vcxproj +0 -387
- package/vendor/raylib/projects/VS2019/examples/textures_sprite_button.vcxproj +0 -387
- package/vendor/raylib/projects/VS2019/examples/textures_sprite_explosion.vcxproj +0 -387
- package/vendor/raylib/projects/VS2019/examples/textures_srcrec_dstrec.vcxproj +0 -387
- package/vendor/raylib/projects/VS2019/examples/textures_to_image.vcxproj +0 -387
- package/vendor/raylib/projects/VS2019/raylib/raylib.vcxproj +0 -341
- package/vendor/raylib/projects/VS2019/raylib.sln +0 -2274
- package/vendor/raylib/projects/VS2019-Android/raylib_android/raylib_android.NativeActivity/raylib_android.NativeActivity.vcxproj +0 -226
- package/vendor/raylib/projects/VS2019-Android/raylib_android/raylib_android.NativeActivity/raylib_android.NativeActivity.vcxproj.filters +0 -10
- package/vendor/raylib/projects/VS2019-Android/raylib_android/raylib_android.NativeActivity/raylib_android.NativeActivity.vcxproj.user +0 -4
- package/vendor/raylib/projects/VS2019-Android/raylib_android.sln +0 -75
package/CMakeLists.txt
ADDED
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
# This program is free software: you can redistribute it and/or modify
|
|
2
|
+
# it under the terms of the GNU Affero General Public License as published by
|
|
3
|
+
# the Free Software Foundation, either version 3 of the License, or
|
|
4
|
+
# (at your option) any later version.
|
|
5
|
+
#
|
|
6
|
+
# This program is distributed in the hope that it will be useful,
|
|
7
|
+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
8
|
+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
9
|
+
# GNU Affero General Public License for more details.
|
|
10
|
+
#
|
|
11
|
+
# You should have received a copy of the GNU Affero General Public License
|
|
12
|
+
# along with this program. If not, see https://www.gnu.org/licenses/.
|
|
13
|
+
|
|
14
|
+
cmake_minimum_required(VERSION 3.11)
|
|
15
|
+
project(koffi C CXX ASM)
|
|
16
|
+
|
|
17
|
+
find_package(CNoke)
|
|
18
|
+
|
|
19
|
+
set(CMAKE_CXX_STANDARD 17)
|
|
20
|
+
if(MSVC)
|
|
21
|
+
enable_language(ASM_MASM)
|
|
22
|
+
endif()
|
|
23
|
+
|
|
24
|
+
# ---- Koffi ----
|
|
25
|
+
|
|
26
|
+
set(KOFFI_SRC
|
|
27
|
+
src/call_arm32.cc
|
|
28
|
+
src/call_arm64.cc
|
|
29
|
+
src/call_x64_sysv.cc
|
|
30
|
+
src/call_x64_win.cc
|
|
31
|
+
src/call_x86.cc
|
|
32
|
+
src/ffi.cc
|
|
33
|
+
src/util.cc
|
|
34
|
+
vendor/libcc/libcc.cc
|
|
35
|
+
)
|
|
36
|
+
if(CMAKE_SIZEOF_VOID_P EQUAL 8)
|
|
37
|
+
if(WIN32)
|
|
38
|
+
list(APPEND KOFFI_SRC src/call_x64_win_fwd.asm)
|
|
39
|
+
elseif(CMAKE_SYSTEM_PROCESSOR STREQUAL aarch64)
|
|
40
|
+
list(APPEND KOFFI_SRC src/call_arm64_fwd.S)
|
|
41
|
+
else()
|
|
42
|
+
list(APPEND KOFFI_SRC src/call_x64_sysv_fwd.S)
|
|
43
|
+
endif()
|
|
44
|
+
elseif(CMAKE_SIZEOF_VOID_P EQUAL 4)
|
|
45
|
+
if(WIN32)
|
|
46
|
+
list(APPEND KOFFI_SRC src/call_x86_fwd.asm)
|
|
47
|
+
elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "i[3456]86|x86|AMD64")
|
|
48
|
+
list(APPEND KOFFI_SRC src/call_x86_fwd.S)
|
|
49
|
+
elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "armv[678]l")
|
|
50
|
+
list(APPEND KOFFI_SRC src/call_arm32_fwd.S)
|
|
51
|
+
endif()
|
|
52
|
+
endif()
|
|
53
|
+
|
|
54
|
+
add_node_addon(NAME koffi SOURCES ${KOFFI_SRC})
|
|
55
|
+
target_include_directories(koffi PRIVATE . vendor/node-addon-api)
|
|
56
|
+
|
|
57
|
+
target_compile_definitions(koffi PRIVATE FELIX_TARGET=koffi NAPI_DISABLE_CPP_EXCEPTIONS)
|
|
58
|
+
if(WIN32)
|
|
59
|
+
target_compile_definitions(koffi PRIVATE _CRT_SECURE_NO_WARNINGS _CRT_NONSTDC_NO_DEPRECATE)
|
|
60
|
+
target_link_libraries(koffi PRIVATE ws2_32)
|
|
61
|
+
endif()
|
|
62
|
+
if(MSVC)
|
|
63
|
+
target_compile_options(koffi PRIVATE /wd4200)
|
|
64
|
+
else()
|
|
65
|
+
target_compile_options(koffi PRIVATE -fno-exceptions -Wno-missing-field-initializers
|
|
66
|
+
-fno-strict-aliasing)
|
|
67
|
+
endif()
|
|
68
|
+
|
|
69
|
+
# ---- Raylib ----
|
|
70
|
+
|
|
71
|
+
add_library(raylib SHARED
|
|
72
|
+
vendor/raylib/src/rcore.c
|
|
73
|
+
vendor/raylib/src/rshapes.c
|
|
74
|
+
vendor/raylib/src/rtextures.c
|
|
75
|
+
vendor/raylib/src/rtext.c
|
|
76
|
+
vendor/raylib/src/rmodels.c
|
|
77
|
+
vendor/raylib/src/utils.c
|
|
78
|
+
vendor/raylib/src/rglfw.c
|
|
79
|
+
vendor/raylib/src/raudio.c
|
|
80
|
+
)
|
|
81
|
+
set_target_properties(raylib PROPERTIES PREFIX "")
|
|
82
|
+
target_include_directories(raylib PRIVATE vendor/raylib/src/external/glfw/include)
|
|
83
|
+
target_compile_definitions(raylib PRIVATE PLATFORM_DESKTOP GRAPHICS_API_OPENGL_21
|
|
84
|
+
BUILD_LIBTYPE_SHARED NDEBUG)
|
|
85
|
+
|
|
86
|
+
if(WIN32)
|
|
87
|
+
target_compile_definitions(raylib PRIVATE _CRT_SECURE_NO_WARNINGS _CRT_NONSTDC_NO_DEPRECATE)
|
|
88
|
+
target_link_libraries(raylib PRIVATE winmm)
|
|
89
|
+
endif()
|
|
90
|
+
if(MSVC)
|
|
91
|
+
target_compile_options(raylib PRIVATE /wd4244 /wd4305)
|
|
92
|
+
else()
|
|
93
|
+
target_compile_options(raylib PRIVATE -Wno-sign-compare -Wno-old-style-declaration
|
|
94
|
+
-Wno-unused-function -Wno-missing-field-initializers
|
|
95
|
+
-Wno-unused-value -Wno-implicit-fallthrough -Wno-stringop-overflow
|
|
96
|
+
-Wno-unused-result)
|
|
97
|
+
endif()
|
|
98
|
+
|
|
99
|
+
# ---- SQLite ----
|
|
100
|
+
|
|
101
|
+
add_library(sqlite3 SHARED vendor/sqlite3/sqlite3.c)
|
|
102
|
+
set_target_properties(sqlite3 PROPERTIES PREFIX "")
|
|
103
|
+
|
|
104
|
+
if(WIN32)
|
|
105
|
+
target_compile_definitions(sqlite3 PRIVATE SQLITE_API=__declspec\(dllexport\))
|
|
106
|
+
endif()
|
|
107
|
+
|
|
108
|
+
# ---- Misc ----
|
|
109
|
+
|
|
110
|
+
add_library(misc SHARED test/tests/misc.c)
|
|
111
|
+
set_target_properties(misc PROPERTIES PREFIX "")
|
package/build/koffi.node
ADDED
|
Binary file
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "koffi",
|
|
3
|
-
"version": "0.9.
|
|
3
|
+
"version": "0.9.11",
|
|
4
4
|
"description": "Fast and simple FFI (foreign function interface) for Node.js",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"foreign",
|
|
@@ -18,10 +18,13 @@
|
|
|
18
18
|
"author": "Niels Martignène <niels.martignene@protonmail.com>",
|
|
19
19
|
"main": "build/koffi.node",
|
|
20
20
|
"scripts": {
|
|
21
|
-
"install": "
|
|
21
|
+
"install": "cnoke.js",
|
|
22
22
|
"test": "node test/test.js"
|
|
23
23
|
},
|
|
24
24
|
"license": "AGPL-3.0",
|
|
25
|
+
"dependencies": {
|
|
26
|
+
"cnoke": "^0.9.22"
|
|
27
|
+
},
|
|
25
28
|
"devDependencies": {
|
|
26
29
|
"chalk": "^4.1.2",
|
|
27
30
|
"node-ssh": "^12.0.3"
|
|
@@ -34,6 +37,7 @@
|
|
|
34
37
|
"test/test.js",
|
|
35
38
|
"vendor",
|
|
36
39
|
"LICENSE.txt",
|
|
37
|
-
"README.md"
|
|
40
|
+
"README.md",
|
|
41
|
+
"CMakeLists.txt"
|
|
38
42
|
]
|
|
39
43
|
}
|
package/src/ffi.cc
CHANGED
|
@@ -166,7 +166,7 @@ static Napi::Value CreateHandleType(const Napi::CallbackInfo &info)
|
|
|
166
166
|
{
|
|
167
167
|
RecordMember member = {};
|
|
168
168
|
|
|
169
|
-
member.name = "
|
|
169
|
+
member.name = "value";
|
|
170
170
|
member.type = instance->types_map.FindValue("void *", nullptr);
|
|
171
171
|
RG_ASSERT(member.type);
|
|
172
172
|
|
|
@@ -27,7 +27,8 @@
|
|
|
27
27
|
"build": "npm install --production",
|
|
28
28
|
"commands": {
|
|
29
29
|
"Test Raylib": "xvfb-run node test/tests/raylib.js",
|
|
30
|
-
"Test Misc": "node test/tests/misc.js"
|
|
30
|
+
"Test Misc": "node test/tests/misc.js",
|
|
31
|
+
"Test SQLite": "node test/tests/sqlite.js"
|
|
31
32
|
}
|
|
32
33
|
}
|
|
33
34
|
}
|
|
@@ -61,7 +62,8 @@
|
|
|
61
62
|
"build": "npm install --production",
|
|
62
63
|
"commands": {
|
|
63
64
|
"Test Raylib": "xvfb-run node test/tests/raylib.js",
|
|
64
|
-
"Test Misc": "node test/tests/misc.js"
|
|
65
|
+
"Test Misc": "node test/tests/misc.js",
|
|
66
|
+
"Test SQLite": "node test/tests/sqlite.js"
|
|
65
67
|
}
|
|
66
68
|
}
|
|
67
69
|
}
|
|
@@ -95,7 +97,8 @@
|
|
|
95
97
|
"build": "npm install --production",
|
|
96
98
|
"commands": {
|
|
97
99
|
"Test Raylib": "xvfb-run node test/tests/raylib.js",
|
|
98
|
-
"Test Misc": "node test/tests/misc.js"
|
|
100
|
+
"Test Misc": "node test/tests/misc.js",
|
|
101
|
+
"Test SQLite": "node test/tests/sqlite.js"
|
|
99
102
|
}
|
|
100
103
|
}
|
|
101
104
|
}
|
|
@@ -129,7 +132,8 @@
|
|
|
129
132
|
"build": "npm install --production",
|
|
130
133
|
"commands": {
|
|
131
134
|
"Test Raylib": "xvfb-run node test/tests/raylib.js",
|
|
132
|
-
"Test Misc": "node test/tests/misc.js"
|
|
135
|
+
"Test Misc": "node test/tests/misc.js",
|
|
136
|
+
"Test SQLite": "node test/tests/sqlite.js"
|
|
133
137
|
}
|
|
134
138
|
}
|
|
135
139
|
}
|
|
@@ -168,7 +172,8 @@
|
|
|
168
172
|
"build": "C:\\Node32\\node32.cmd npm install --production",
|
|
169
173
|
"commands": {
|
|
170
174
|
"Test Raylib": "seatsh C:\\Node32\\node32.cmd node test/tests/raylib.js",
|
|
171
|
-
"Test Misc": "C:\\Node32\\node32.cmd node test/tests/misc.js"
|
|
175
|
+
"Test Misc": "C:\\Node32\\node32.cmd node test/tests/misc.js",
|
|
176
|
+
"Test SQLite": "C:\\Node32\\node32.cmd node test/tests/sqlite.js"
|
|
172
177
|
}
|
|
173
178
|
},
|
|
174
179
|
|
|
@@ -177,7 +182,8 @@
|
|
|
177
182
|
"build": "C:\\Node64\\node64.cmd npm install --production",
|
|
178
183
|
"commands": {
|
|
179
184
|
"Test Raylib": "seatsh C:\\Node64\\node64.cmd node test/tests/raylib.js",
|
|
180
|
-
"Test Misc": "C:\\Node64\\node64.cmd node test/tests/misc.js"
|
|
185
|
+
"Test Misc": "C:\\Node64\\node64.cmd node test/tests/misc.js",
|
|
186
|
+
"Test SQLite": "C:\\Node64\\node64.cmd node test/tests/sqlite.js"
|
|
181
187
|
}
|
|
182
188
|
}
|
|
183
189
|
}
|
package/test/test.js
CHANGED
|
@@ -107,6 +107,14 @@ async function main() {
|
|
|
107
107
|
}
|
|
108
108
|
}
|
|
109
109
|
|
|
110
|
+
// Sanity checks
|
|
111
|
+
if (parseInt(process.versions.node, 10) < 16)
|
|
112
|
+
throw new Error('Please use Node version >= 16');
|
|
113
|
+
if (spawnSync('ssh', ['-V']).status !== 0)
|
|
114
|
+
throw new Error('Missing ssh binary in PATH');
|
|
115
|
+
if (spawnSync('sshpass', ['-V']).status !== 0)
|
|
116
|
+
throw new Error('Missing sshpass binary in PATH');
|
|
117
|
+
|
|
110
118
|
// Load machine registry
|
|
111
119
|
let machines_map;
|
|
112
120
|
{
|
|
@@ -414,7 +422,7 @@ async function ssh() {
|
|
|
414
422
|
let args = [
|
|
415
423
|
'-p' + machine.info.password,
|
|
416
424
|
'ssh', '-o', 'StrictHostKeyChecking=no',
|
|
417
|
-
'-o', 'UserKnownHostsFile=' + (process.platform == 'win32' ? 'NUL' : '/dev/null'),
|
|
425
|
+
'-o', 'UserKnownHostsFile=' + (process.platform == 'win32' ? '\\\\.\\NUL' : '/dev/null'),
|
|
418
426
|
'-p', machine.info.ssh_port, machine.info.username + '@127.0.0.1'
|
|
419
427
|
];
|
|
420
428
|
|
|
@@ -526,7 +534,7 @@ async function boot(machine, dirname, detach) {
|
|
|
526
534
|
|
|
527
535
|
if (machine.qemu.accelerate)
|
|
528
536
|
args.push('-accel', machine.qemu.accelerate);
|
|
529
|
-
args.push('-display', 'none');
|
|
537
|
+
// args.push('-display', 'none');
|
|
530
538
|
|
|
531
539
|
try {
|
|
532
540
|
let binary = qemu_prefix + machine.qemu.binary + (process.platform == 'win32' ? '.exe' : '');
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
// This program is free software: you can redistribute it and/or modify
|
|
4
|
+
// it under the terms of the GNU Affero General Public License as published by
|
|
5
|
+
// the Free Software Foundation, either version 3 of the License, or
|
|
6
|
+
// (at your option) any later version.
|
|
7
|
+
//
|
|
8
|
+
// This program is distributed in the hope that it will be useful,
|
|
9
|
+
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
10
|
+
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
11
|
+
// GNU Affero General Public License for more details.
|
|
12
|
+
//
|
|
13
|
+
// You should have received a copy of the GNU Affero General Public License
|
|
14
|
+
// along with this program. If not, see https://www.gnu.org/licenses/.
|
|
15
|
+
|
|
16
|
+
const crypto = require('crypto');
|
|
17
|
+
const koffi = require('../../build/koffi.node');
|
|
18
|
+
const assert = require('assert');
|
|
19
|
+
const fs = require('fs');
|
|
20
|
+
const os = require('os');
|
|
21
|
+
const path = require('path');
|
|
22
|
+
|
|
23
|
+
const sqlite3_db = koffi.handle('sqlite3_db');
|
|
24
|
+
const sqlite3_stmt = koffi.handle('sqlite3_stmt');
|
|
25
|
+
|
|
26
|
+
main();
|
|
27
|
+
|
|
28
|
+
async function main() {
|
|
29
|
+
try {
|
|
30
|
+
await test();
|
|
31
|
+
console.log('Success!');
|
|
32
|
+
} catch (err) {
|
|
33
|
+
console.error(err);
|
|
34
|
+
process.exit(1);
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
async function test() {
|
|
39
|
+
let lib_filename = path.dirname(__filename) + '/../../build/sqlite3' +
|
|
40
|
+
(process.platform == 'win32' ? '.dll' : '.so');
|
|
41
|
+
|
|
42
|
+
let sqlite3 = koffi.load(lib_filename, {
|
|
43
|
+
sqlite3_open_v2: ['int', ['string', koffi.out(koffi.pointer(sqlite3_db)), 'int', 'string']],
|
|
44
|
+
sqlite3_exec: ['int', [sqlite3_db, 'string', 'void *', 'void *', 'void *']],
|
|
45
|
+
sqlite3_prepare_v2: ['int', [sqlite3_db, 'string', 'int', koffi.out(koffi.pointer(sqlite3_stmt)), 'string']],
|
|
46
|
+
sqlite3_reset: ['int', [sqlite3_stmt]],
|
|
47
|
+
sqlite3_bind_text: ['int', [sqlite3_stmt, 'int', 'string', 'int', 'void *']],
|
|
48
|
+
sqlite3_bind_int: ['int', [sqlite3_stmt, 'int', 'int']],
|
|
49
|
+
sqlite3_step: ['int', [sqlite3_stmt]],
|
|
50
|
+
sqlite3_finalize: ['int', [sqlite3_stmt]],
|
|
51
|
+
sqlite3_close_v2: ['int', [sqlite3_db]]
|
|
52
|
+
});
|
|
53
|
+
|
|
54
|
+
let filename = create_temporary_file(path.join(os.tmpdir(), 'test_sqlite'));
|
|
55
|
+
let db = {};
|
|
56
|
+
|
|
57
|
+
try {
|
|
58
|
+
if (sqlite3.sqlite3_open_v2(filename, db, 0x2 | 0x4, null) != 0)
|
|
59
|
+
throw new Error('Failed to open database');
|
|
60
|
+
if (sqlite3.sqlite3_exec(db, 'CREATE TABLE foo (id INTEGER PRIMARY KEY, bar TEXT, value INT);', null, null, null) != 0)
|
|
61
|
+
throw new Error('Failed to create table');
|
|
62
|
+
|
|
63
|
+
let stmt = {};
|
|
64
|
+
if (sqlite3.sqlite3_prepare_v2(db, "INSERT INTO foo (bar, value) VALUES (?1, ?2)", -1, stmt, null) != 0)
|
|
65
|
+
throw new Error('Failed to prepare insert statement for table foo');
|
|
66
|
+
for (let i = 0; i < 200; i++) {
|
|
67
|
+
sqlite3.sqlite3_reset(stmt);
|
|
68
|
+
|
|
69
|
+
sqlite3.sqlite3_bind_text(stmt, 1, `TXT ${i}`, -1, null);
|
|
70
|
+
sqlite3.sqlite3_bind_int(stmt, 2, i * 2);
|
|
71
|
+
|
|
72
|
+
if (sqlite3.sqlite3_step(stmt) != 101)
|
|
73
|
+
throw new Erorr('Failed to insert new test row');
|
|
74
|
+
}
|
|
75
|
+
sqlite3.sqlite3_finalize(stmt);
|
|
76
|
+
} finally {
|
|
77
|
+
sqlite3.sqlite3_close_v2(db);
|
|
78
|
+
fs.unlinkSync(filename);
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
function create_temporary_file(prefix) {
|
|
83
|
+
let buf = Buffer.allocUnsafe(4);
|
|
84
|
+
|
|
85
|
+
for (;;) {
|
|
86
|
+
try {
|
|
87
|
+
crypto.randomFillSync(buf);
|
|
88
|
+
|
|
89
|
+
let suffix = buf.toString('hex').padStart(8, '0');
|
|
90
|
+
let filename = `${prefix}.${suffix}`;
|
|
91
|
+
|
|
92
|
+
let file = fs.createWriteStream(filename, { flags: 'wx', mode: 0o644 });
|
|
93
|
+
file.close();
|
|
94
|
+
|
|
95
|
+
return filename;
|
|
96
|
+
} catch (err) {
|
|
97
|
+
if (err.code != 'EEXIST')
|
|
98
|
+
throw err;
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
}
|