Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
1
1-tracer
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Issue analytics
Insights
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
SO2
1-tracer
Commits
bea36442
Commit
bea36442
authored
2 years ago
by
Baruta Daniel Mihail
Browse files
Options
Downloads
Patches
Plain Diff
General improvements
parent
4bb42f74
No related branches found
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
checker/checker.sh
+30
-18
30 additions, 18 deletions
checker/checker.sh
local.sh
+5
-4
5 additions, 4 deletions
local.sh
src/perfect
+0
-0
0 additions, 0 deletions
src/perfect
with
35 additions
and
22 deletions
checker/checker.sh
+
30
−
18
View file @
bea36442
...
...
@@ -7,6 +7,8 @@ cd "$(dirname "$0")" || exit 1
EXECUTABLE
=
"../src/perfect"
TIMEOUT_DURATION
=
10
SCORE
=
0
TOTAL_SCORE
=
0
test_err
()
{
...
...
@@ -52,7 +54,6 @@ test_edge()
return
$?
}
setup
()
{
pushd
../src
>
/dev/null
||
exit
1
...
...
@@ -68,31 +69,42 @@ cleanup()
}
test_fun_array
=(
\
test_err
"Name 1"
5
\
test_single
"Name 2"
5
\
test_multiple
"Name 3"
5
\
test_edge
"Name 4"
5
\
test_err
"Name 1"
2
5
\
test_single
"Name 2"
2
5
\
test_multiple
"Name 3"
2
5
\
test_edge
"Name 4"
2
5
\
)
test
_all
()
run_
test
()
{
local
score
=
0
test_index
=
"
$1
"
test_func_index
=
$((
test_index
*
3
))
description
=
${
test_fun_array
[
$((
test_func_index
+
1
))
]
}
points
=
${
test_fun_array
[
$((
test_func_index
+
2
))
]
}
TOTAL_SCORE
=
$((
TOTAL_SCORE
+
points
))
echo
-ne
"Testing
\t\t
$description
\t
"
if
${
test_fun_array
[
"
$test_func_index
"
]
}
;
then
SCORE
=
$((
SCORE
+
points
))
echo
"
$points
/
$points
"
else
echo
"0/
$points
"
fi
}
test_all
()
{
for
i
in
$(
seq
0
"
$((${#
test_fun_array
[@]
}
/
3
-
1
))
"
)
;
do
test_index
=
$((
i
*
3
))
description
=
${
test_fun_array
[
$((
test_index
+
1
))
]
}
points
=
${
test_fun_array
[
$((
test_index
+
2
))
]
}
echo
-e
"Testing
\t\t
$description
"
if
${
test_fun_array
[
"
$test_index
"
]
}
;
then
score
=
$((
score
+
points
))
fi
run_test
"
$i
"
done
echo
-e
"
\n
Total:
$
score
"
echo
-e
"
\n
Total:
$
SCORE
/
$TOTAL_SCORE
"
}
setup
test_all
if
[
-z
"
$1
"
]
;
then
test_all
else
run_test
"
$1
"
fi
cleanup
This diff is collapsed.
Click to expand it.
local.sh
+
5
−
4
View file @
bea36442
...
...
@@ -18,11 +18,11 @@ DEFAULT_REGISTRY='registry.gitlab.cs.pub.ro'
#=============================================================================
LOG_INFO
()
{
echo
-e
"[
$(
date
+%F
_
%T
)
] [INFO]
$1
"
echo
-e
"[
$(
date
+%F
T
%T
)
] [INFO]
$1
"
}
LOG_FATAL
()
{
echo
-e
"[
$(
date
+%F
_
%T
)
] [
${
RED
}
FATAL
${
NC
}
]
$1
"
echo
-e
"[
$(
date
+%F
T
%T
)
] [
${
RED
}
FATAL
${
NC
}
]
$1
"
exit
1
}
...
...
@@ -63,9 +63,10 @@ print_help() {
echo
" --full_image_name <full_image_name> - the full name of the image (default: registry.gitlab.cs.pub.ro/<current_directory_name>:latest)"
echo
" --use_executable <executable> - command to run inside the container (default: /bin/bash)"
echo
""
echo
"local.sh checker [--remove_image] [argumets_for_checker]"
echo
"local.sh checker [--remove_image]
[--use_existing_image <image_name>]
[argumets_for_checker]"
echo
""
echo
" --remove_image - remove the checker's docker image after the run"
echo
" --use_existing_image - user image_name instead of building the image from current directory"
echo
" argumets_for_checker - list of space separated arguments to be passed to the checker"
echo
""
}
...
...
@@ -232,7 +233,7 @@ checker_main() {
LOG_INFO
"Running checker..."
docker run
--rm
\
--mount
type
=
bind
,source
=
"
$tmpdir
"
,target
=
/build
\
"
$image_name
"
/bin/bash /build/checker/checker.sh
"
${
script_args
[@]
}
"
"
$image_name
"
/bin/bash
-c
"rm -rf /usr/local/bin/bash;
/build/checker/checker.sh
\
"
${
script_args
[@]
}
\"
"
# remove bash middleware script
if
[
-n
"
$remove_image
"
]
;
then
LOG_INFO
"Cleaning up..."
...
...
This diff is collapsed.
Click to expand it.
src/perfect
deleted
100755 → 0
+
0
−
0
View file @
4bb42f74
File deleted
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