commandline session
$cat test4.pl #!/usr/bin/perl use strict; use warnings; system "echo 1 > 1"; print "n"; system "echo 2 > 2"; print "n"; system "echo hello"; print "n"; $perl test4.pl hello $cat 1 1 $cat 2 2 $
BEAUTY AND PLAY
$cat test4.pl #!/usr/bin/perl use strict; use warnings; system "echo 1 > 1"; print "n"; system "echo 2 > 2"; print "n"; system "echo hello"; print "n"; $perl test4.pl hello $cat 1 1 $cat 2 2 $
$cat test3.pl
#!/usr/bin/perl -w
use Test::Simple tests => 2;
use Date::ICal;
my $ical = Date::ICal->new; # create an object
ok( defined $ical ); # check that we got something
ok( $ical->isa('Date::ICal') ); # and it's the right class
$perl test3.pl
1..2
ok 1
ok 2
$
$perl test1.pl 1..1 ok 1 $cat test1.pl #!/usr/bin/perl -w print "1..1n"; print 1 + 1 == 2 ? "ok 1n" : "not ok 1n"; $perl 1+1 $perl -e No code specified for -e. $perl -d Loading DB routines from perl5db.pl version 1.33 Editor support available. Enter h or `h h' for help, or `man perldebug' for more help. Debugged program terminated. Use q to quit or R to restart, use o inhibit_exit to avoid stopping after program termination, h q, h R or h o to get additional info. DB quit DB exit $perl -d -e 1 Loading DB routines from perl5db.pl version 1.33 Editor support available. Enter h or `h h' for help, or `man perldebug' for more help. main::(-e:1): 1 DB 1+1 DB print 1+1 2 DB print 1 + 1 == 2 1 DB print 1 + 1 == 3 DB print 2 + 2 == 3 DB print 2 + 2 == 4 1 DB
$python
Python 2.7.3 (default, Jun 15 2012, 15:26:07)
[GCC 4.7.0] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> from autotest.client import utils, test
>>> x = utils.AsyncJob("sleep 1 && echo hi && sleep 1 && echo hi && sleep 1 && echo hi && sleep 1")
DEBUG:root:Running 'sleep 1 && echo hi && sleep 1 && echo hi && sleep 1 && echo hi && sleep 1'
>>> x.wait_for()
* Command:
sleep 1 && echo hi && sleep 1 && echo hi && sleep 1 && echo hi && sleep 1
Exit status: 0
Duration: 28.2366471291
stdout:
hi
hi
hi
>>> y = utils.AsyncJob("sleep 100")
DEBUG:root:Running 'sleep 100'
>>> y.wait_for()
* Command:
sleep 100
Exit status: 0
Duration: 100.024924994
>>> x.wait_for()
* Command:
sleep 1 && echo hi && sleep 1 && echo hi && sleep 1 && echo hi && sleep 1
Exit status: 0
Duration: 441.024215937
stdout:
hi
hi
hi
>>> y.wait_for()
* Command:
sleep 100
Exit status: 0
Duration: 121.19008112
>>> print "Process 2 took %d to be killed" % (time.time()-t)
Traceback (most recent call last):
File "", line 1, in
NameError: name 'time' is not defined
>>> y = utils.AsyncJob("sleep 100")
DEBUG:root:Running 'sleep 100'
>>> print "Process 2 took %d to be killed" % (time.time()-t)
Traceback (most recent call last):
File "", line 1, in
NameError: name 'time' is not defined
>>> y.wait_for()
* Command:
sleep 100
Exit status: 0
Duration: 100.026224852
>>>
$sudo autotest-local run asynctest/ 18:58:57 INFO | Writing results to /usr/local/lib/python2.7/dist-packages/autotest/client/results/default 18:58:58 INFO | START ---- ---- timestamp=13625710038 localtime=Mar 06 18:58:58 18:58:58 INFO | START asynctest asynctest timestamp=13625710038 localtime=Mar 06 18:58:58 18:59:00 INFO | Process 1 stdout is now hi 18:59:00 INFO | hi 18:59:00 INFO | 18:59:02 INFO | Process 1 result object is: * Command: 18:59:02 INFO | sleep 1 && echo hi && sleep 1 && echo hi && sleep 1 && echo hi && sleep 1 18:59:02 INFO | Exit status: 0 18:59:02 INFO | Duration: 4.03056716919 18:59:02 INFO | 18:59:02 INFO | stdout: 18:59:02 INFO | hi 18:59:02 INFO | hi 18:59:02 INFO | hi 18:59:03 INFO | Process 2 took 1 to be killed 18:59:03 INFO | GOOD asynctest asynctest timestamp=13625710043 localtime=Mar 06 18:59:03 completed successfully 18:59:03 INFO | END GOOD asynctest asynctest timestamp=13625710043 localtime=Mar 06 18:59:03 18:59:03 INFO | END GOOD ---- ---- timestamp=13625710043 localtime=Mar 06 18:59:03 $
> curve(x^3 - 5*x, from=-4, to=4)
> png(file="RcurveA.png")
> curve(x^3 - 5*x, from=-4, to=4)
> dev.off()
null device
1
> png(file="RcurveB.png")
> curve(x^3 - 5*x, from=-4, to=0)
> dev.off()
null device
1
> png(file="RcurveC.png")
> curve(x^3 - 5*x, from=10, to=50)
> dev.off()
null device
1
>
ABOUT Signal(IPC)
Signals are a limited form of inter-process communication (IPC), typically used in Unix, Unix-like, and other POSIX-compliant operating systems. A signal is an asynchronous notification sent to a process or to a specific thread within the same process in order to notify it of an event that occurred. Signals originated in 1970s Bell Labs Unix and have been more recently specified in the POSIX standard. When a signal is sent, the operating system interrupts the target process' normal flow of execution to deliver the signal. Execution can be interrupted during any non-atomic instruction. If the process has previously registered a signal handler, that routine is executed. Otherwise, the default signal handler is executed.
TYPICAL COMMANDLINE SESSION
[bash]
$sudo ./signaltest –help
signaltest V 0.85
Usage:
signaltest <options>
-b USEC –breaktrace=USEC send break trace command when latency > USEC
-l LOOPS –loops=LOOPS number of loops: default=0(endless)
-p PRIO –prio=PRIO priority of highest prio thread
-q –quiet print only a summary on exit
-t NUM –threads=NUM number of threads: default=2
-m –mlockall lock current and future memory allocations
-v –verbose output values on stdout for statistics
format: n:c:v n=tasknum c=count v=value in us
$sudo ./signaltest -v -t 10 -l 10
0: 0: 0
0: 1: 118
0: 2: 91
0: 3: 83
0: 4: 80
0: 5: 78
0: 6: 78
0: 7: 80
0: 8: 78
0: 9: 79
$
[/bash]
LINK
https://en.wikipedia.org/wiki/Signal_(IPC)
https://www.ibm.com/developerworks/community/blogs/aimsupport/entry/Finding_the_source_of_signals_on_Linux_with_strace_auditd_or_Systemtap?lang=en
ABOUT SOFTWARE TESTING
Software testing is an investigation conducted to provide stakeholders with information about the quality of the software product or service under test.[1] Software testing can also provide an objective, independent view of the software to allow the business to appreciate and understand the risks of software implementation. Test techniques include the process of executing a program or application with the intent of finding software bugs (errors or other defects), and verifying that the software product is fit for use.
TYPICAL COMMANDLINE RELATED EXPOSURE
[bash]
$sudo ./cyclictest –smp -p95 -f -b 200
# /dev/cpu_dma_latency set to 0us
INFO: debugfs mountpoint: /sys/kernel/debug/tracing/
could not set ftrace_enabled to 1
Requested tracer ” not available
could not set tracing_max_latency to 0
policy: fifo: loadavg: 0.16 0.24 0.17 1/364 16976
T: 0 (16976) P:95 I:1000 C: 2902 Min: 7 Act: 15 Avg: 20 Max: 169
# Thread Ids: 16976
# Break thread: 16976
# Break value: 246
could not set ftrace_enabled to 0
[/bash]
[bash]
$sudo ./cyclictest –smp -p95 -f -b 100
# /dev/cpu_dma_latency set to 0us
INFO: debugfs mountpoint: /sys/kernel/debug/tracing/
could not set ftrace_enabled to 1
Requested tracer ” not available
could not set tracing_max_latency to 0
policy: fifo: loadavg: 0.27 0.15 0.14 2/361 16999
T: 0 ( 0) P:95 I:1000 C: 0 Min:1000000 Act: 0 Avg: 0 Max: 0
# Thread Ids: 16999
# Break thread: 16999
# Break value: 161
could not set ftrace_enabled to 0
[/bash]
[bash]
$sudo ./cyclictest –smp -p95 -f -b 1000
# /dev/cpu_dma_latency set to 0us
INFO: debugfs mountpoint: /sys/kernel/debug/tracing/
could not set ftrace_enabled to 1
Requested tracer ” not available
could not set tracing_max_latency to 0
policy: fifo: loadavg: 0.17 0.14 0.14 3/361 17002
T: 0 (17002) P:95 I:1000 C: 35587 Min: 7 Act: 32 Avg: 20 Max: 264
^C# Thread Ids: 17002
could not set ftrace_enabled to 0
$
[/bash]
LINKS
https://events.static.linuxfound.org/sites/events/files/slides/cyclictest.pdf
https://en.wikipedia.org/wiki/Software_testing
> chown creat dread dwrite fdata fdatasync fsync getdents link mkdir mknod read readlink rename link mkdir mknod read readlink rmdir stat symlink sync truncate unlink write boxplot(chown,creat,dread,dwrite,fdatasync,fsync,getdents,link,mkdir,mknod,read,readlink,rename,rmdir,stat,symlink,sync,truncate,unlink,write)
> boxplot(chown,creat,dread,dwrite,fdatasync,fsync,getdents,link,mkdir,mknod,read,readlink,rename,rmdir,stat,symlink,sync,truncate,unlink,write)
> png(file="Rfsstress.png")
> boxplot(chown,creat,dread,dwrite,fdatasync,fsync,getdents,link,mkdir,mknod,read,readlink,rename,rmdir,stat,symlink,sync,truncate,unlink,write)
> dev.off
function (which = dev.cur())
{
if (which == 1)
stop("cannot shut down device 1 (the null device)")
.Internal(dev.off(as.integer(which)))
dev.cur()
}
> dev.off
function (which = dev.cur())
{
if (which == 1)
stop("cannot shut down device 1 (the null device)")
.Internal(dev.off(as.integer(which)))
dev.cur()
}
> dev.off()
null device
1
> png(file="Rfsstress.png")
> boxplot(chown,creat,dread,dwrite,fdatasync,fsync,getdents,link,mkdir,mknod,read,readlink,rename,rmdir,stat,symlink,sync,truncate,unlink,write)
> dev.off()
null device
1
>
$sudo ./fsstress -z -c -S -d /home/jeffrin/fs/ -p 100 -n 100
chown 0/0 write op
creat 0/0 write op
dread 0/0
dwrite 0/0 write op
fdatasync 0/0 write op
fsync 0/0 write op
getdents 0/0
link 0/0 write op
mkdir 0/0 write op
mknod 0/0 write op
read 0/0
readlink 0/0
rename 0/0 write op
rmdir 0/0 write op
stat 0/0
symlink 0/0 write op
sync 0/0
truncate 0/0 write op
unlink 0/0 write op
write 0/0 write op
seed = 1362490240
$