Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
P
picodata
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Container Registry
Model registry
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
core
picodata
Commits
c600e325
Commit
c600e325
authored
5 months ago
by
Georgy Moshkin
Browse files
Options
Downloads
Patches
Plain Diff
fix: `picodata tarantool -- file.lua` was broken after refactoring
parent
0a5bc5c3
No related branches found
Branches containing commit
No related tags found
Tags containing commit
1 merge request
!1450
fix: `picodata tarantool -- file.lua` was broken after refactoring
Pipeline
#56228
failed
5 months ago
Stage: test
Stage: pack
Stage: docker
Stage: stress-test
Stage: front-deploy
Changes
2
Pipelines
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/cli/tarantool.rs
+21
-5
21 additions, 5 deletions
src/cli/tarantool.rs
test/int/test_cli_ux.py
+27
-0
27 additions, 0 deletions
test/int/test_cli_ux.py
with
48 additions
and
5 deletions
src/cli/tarantool.rs
+
21
−
5
View file @
c600e325
...
...
@@ -41,8 +41,8 @@ where
let
trampoline
=
trampoline
::
<
E
,
F
>
;
let
trampoline_arg
=
Box
::
<
F
>
::
into_raw
(
Box
::
new
(
f
))
.cast
();
// XXX: `argv` is a vec of pointers to data owned by `
tt_
args`, so
// make sure `
tt_
args` outlives `argv`, because the compiler is not
// XXX: `argv` is a vec of pointers to data owned by `args`, so
// make sure `args` outlives `argv`, because the compiler is not
// gonna do that for you
let
argv
:
Vec
<
_
>
=
args
.iter
()
.map
(|
a
|
a
.as_ref
()
.as_ptr
())
.collect
();
...
...
@@ -59,7 +59,23 @@ where
/// Run tarantool's main entry point with cmdline args.
/// See `tarantool_main` and [`crate::tarantool::main`].
pub
fn
main
(
args
:
args
::
Tarantool
)
->
!
{
main_cb
(
&
args
.tt_args
()
.unwrap
(),
||
{
Ok
::
<
_
,
std
::
convert
::
Infallible
>
(())
})
let
tt_args
=
args
.tt_args
()
.unwrap
();
// XXX: `argv` is a vec of pointers to data owned by `tt_args`, so
// make sure `tt_args` outlives `argv`, because the compiler is not
// gonna do that for you
let
argv
:
Vec
<
_
>
=
tt_args
.iter
()
.map
(|
a
|
a
.as_ref
()
.as_ptr
())
.collect
();
let
rc
=
unsafe
{
crate
::
tarantool
::
main
(
argv
.len
()
as
_
,
argv
.as_ptr
()
as
_
,
// This is needed because of a special hack in our tarantool fork.
// Without it executing a lua file would not work.
None
,
std
::
ptr
::
null_mut
(),
)
};
std
::
process
::
exit
(
rc
);
}
This diff is collapsed.
Click to expand it.
test/int/test_cli_ux.py
+
27
−
0
View file @
c600e325
...
...
@@ -574,3 +574,30 @@ def test_do_not_ban_admin_via_unix_socket(cluster: Cluster):
cli
.
expect_exact
(
'
Connected to admin console by socket path
"
./admin.sock
"'
)
cli
.
expect_exact
(
"
type
'
\\
help;
'
for interactive help
"
)
cli
.
expect_exact
(
"
picodata>
"
)
def
test_picodata_tarantool
(
cluster
:
Cluster
):
test_lua
=
os
.
path
.
join
(
cluster
.
data_dir
,
"
test.lua
"
)
with
open
(
test_lua
,
"
w
"
)
as
f
:
print
(
"""
print(
'
stdout check
'
)
file, err = io.open(
'
output.txt
'
,
'
w
'
)
assert(err == nil)
assert(file:write(
'
it worked!
'
))
assert(file:close())
"""
,
file
=
f
,
)
stdout
=
subprocess
.
check_output
(
[
cluster
.
binary_path
,
"
tarantool
"
,
"
--
"
,
test_lua
],
cwd
=
cluster
.
data_dir
,
)
assert
stdout
==
b
"
stdout check
\n
"
output_txt
=
os
.
path
.
join
(
cluster
.
data_dir
,
"
output.txt
"
)
with
open
(
output_txt
,
"
r
"
)
as
f
:
result
=
f
.
read
()
assert
result
==
"
it worked!
"
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment