qa: check devproc start/stop ctl msg
This commit is contained in:
parent
b08218529d
commit
1263399c0b
@ -36,6 +36,7 @@
|
||||
"psx.c",
|
||||
"segattach.c",
|
||||
"sched0.c",
|
||||
"stop_start.c",
|
||||
"syscall.c",
|
||||
"sysstatread.c",
|
||||
"tsemacquire.c",
|
||||
|
41
qa/kern/stop_start.c
Normal file
41
qa/kern/stop_start.c
Normal file
@ -0,0 +1,41 @@
|
||||
/*
|
||||
* This file is part of Jehanne.
|
||||
*
|
||||
* Copyright (C) 2017 Giacomo Tesio <giacomo@tesio.it>
|
||||
*
|
||||
* Jehanne is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, version 2 of the License.
|
||||
*
|
||||
* Jehanne is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with Jehanne. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
#include <u.h>
|
||||
#include <lib9.h>
|
||||
|
||||
void
|
||||
main(int argc, char**argv)
|
||||
{
|
||||
int fd, n;
|
||||
char *path;
|
||||
|
||||
path = smprint("/proc/%d/ctl", getpid());
|
||||
fd = open(path, OWRITE);
|
||||
if(fd < 0){
|
||||
print("FAIL: open");
|
||||
exits("FAIL");
|
||||
}
|
||||
n = write(fd, "stop", 4);
|
||||
if(n < 0){
|
||||
print("FAIL: write");
|
||||
exits("FAIL");
|
||||
}
|
||||
close(fd);
|
||||
print("PASS\n");
|
||||
exits("PASS");
|
||||
}
|
29
qa/kern/stop_start.runner
Executable file
29
qa/kern/stop_start.runner
Executable file
@ -0,0 +1,29 @@
|
||||
#!/cmd/rc
|
||||
|
||||
runner=$0
|
||||
test = `{echo $runner|sed 's/.runner//'}
|
||||
test_output = /tmp/output-`{basename $test}
|
||||
|
||||
if ( test -e $test_output) rm $test_output
|
||||
|
||||
$test > $test_output &
|
||||
testpid=$apid
|
||||
sleep 5
|
||||
|
||||
if ( cat $test_output | grep 'PASS' > /dev/null ) {
|
||||
cat $test_output
|
||||
echo FAIL
|
||||
exit FAIL
|
||||
}
|
||||
|
||||
echo start > /proc/$testpid/ctl
|
||||
wait $testpid
|
||||
|
||||
if ( cat $test_output | grep 'PASS' > /dev/null ) {
|
||||
rm $test_output
|
||||
echo PASS
|
||||
exit PASS
|
||||
}
|
||||
cat $test_output
|
||||
echo FAIL
|
||||
exit FAIL
|
Loading…
Reference in New Issue
Block a user