Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
C
CS425-MP0
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
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
siruiw4
CS425-MP0
Commits
ed13a3dc
Commit
ed13a3dc
authored
3 years ago
by
Stranger3333
Browse files
Options
Downloads
Patches
Plain Diff
sanity check passed
parent
19ff56f6
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
MP0/logger
+3
-0
3 additions, 0 deletions
MP0/logger
MP0/logger.py
+1
-3
1 addition, 3 deletions
MP0/logger.py
MP0/node
+3
-0
3 additions, 0 deletions
MP0/node
MP0/sanity_check.py
+72
-0
72 additions, 0 deletions
MP0/sanity_check.py
with
79 additions
and
3 deletions
MP0/logger
0 → 100755
+
3
−
0
View file @
ed13a3dc
#!/bin/bash
python3
-u
logger.py
$@
\ No newline at end of file
This diff is collapsed.
Click to expand it.
MP0/logger.py
+
1
−
3
View file @
ed13a3dc
...
...
@@ -15,15 +15,13 @@ if len(sys.argv) > 2:
print
(
'
Incorrect input arguments
'
)
sys
.
exit
(
0
)
def
nodenum
():
print
(
'
abc
'
)
class
server
:
def
storedata
(
self
,
data
,
width
):
recv_time
=
time
.
time
()
gen_time
=
float
(
data
.
split
()[
0
])
delay
=
recv_time
-
gen_time
newline
=
data
+
'
'
+
str
(
delay
)
+
'
'
+
str
(
width
)
print
(
newline
)
#
print(newline)
return
newline
.
split
()
def
multinode
(
self
,
connection
,
addr
,
Threadnum
):
...
...
This diff is collapsed.
Click to expand it.
MP0/node
0 → 100755
+
3
−
0
View file @
ed13a3dc
#!/bin/bash
python3
-u
node.py
$@
\ No newline at end of file
This diff is collapsed.
Click to expand it.
MP0/sanity_check.py
0 → 100644
+
72
−
0
View file @
ed13a3dc
import
os
import
subprocess
import
time
import
sys
import
signal
from
hashlib
import
sha256
import
psutil
def
kill
(
proc_pid
):
process
=
psutil
.
Process
(
proc_pid
)
for
proc
in
process
.
children
(
recursive
=
True
):
proc
.
kill
()
process
.
kill
()
rstring
=
sha256
(
os
.
urandom
(
20
)).
hexdigest
()
event
=
f
'
{
time
.
time
()
}
{
rstring
}
\n
'
.
encode
()
## check for logger and node executable in curdir
if
not
os
.
path
.
exists
(
"
node
"
)
or
not
os
.
access
(
"
node
"
,
os
.
X_OK
):
print
(
"
No node executable found
"
)
sys
.
exit
(
1
)
if
not
os
.
path
.
exists
(
"
logger
"
)
or
not
os
.
access
(
"
logger
"
,
os
.
X_OK
):
print
(
"
No logger executable found
"
)
sys
.
exit
(
1
)
# run logger and node on port 2222
try
:
logger_p
=
subprocess
.
Popen
([
"
./logger
"
,
"
2222
"
],
stdout
=
subprocess
.
PIPE
)
except
:
print
(
"
Unable to execute logger process
"
)
sys
.
exit
(
1
)
# wait for logger to spin up before launching node
time
.
sleep
(
1
)
try
:
node_p
=
subprocess
.
Popen
([
"
./node
"
,
"
test
"
,
"
127.0.0.1
"
,
"
2222
"
],
stdin
=
subprocess
.
PIPE
,
stdout
=
subprocess
.
DEVNULL
)
except
:
print
(
"
Unable to execute node process
"
)
kill
(
logger_p
.
pid
)
sys
.
exit
(
1
)
try
:
node_p
.
communicate
(
event
,
timeout
=
1
)
except
:
pass
try
:
kill
(
node_p
.
pid
)
except
:
pass
time
.
sleep
(
1
)
try
:
kill
(
logger_p
.
pid
)
except
:
pass
# check connect + disconnect message in logger
stdout
,
stderr
=
logger_p
.
communicate
()
stdout
=
stdout
.
decode
()
print
(
stdout
)
if
stdout
.
find
(
"
test connected
"
)
>=
0
and
stdout
.
find
(
"
test disconnected
"
)
>=
0
and
stdout
.
find
(
rstring
):
print
(
"
Sanity Check: Passed!
"
)
else
:
print
(
"
Output incorrect
"
)
\ No newline at end of file
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