The Samba-Bugzilla – Attachment 10173 Details for
Bug 10652
Samba 4 consuming a lot of CPU when re-reading printcap info
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
printcap update correctness test
smbd_cups_pcap_test.sh (text/plain), 2.40 KB, created by
David Disseldorp
on 2014-08-04 13:03:33 UTC
(
hide
)
Description:
printcap update correctness test
Filename:
MIME Type:
Creator:
David Disseldorp
Created:
2014-08-04 13:03:33 UTC
Size:
2.40 KB
patch
obsolete
>#!/bin/bash > >PRINTER_NUM=5 >PRINTER_PREFIX=dummy >PRINTER_DEV=/dev/null > >_fatal() >{ > local str=$* > > echo "fatal: $str" > exit 1 >} > >_smb_printers_check() >{ > local prefix=$1 > local count_ex=$2 > > perl -e ' > $count_got = 0; > > @shares = `smbclient -N -L localhost 2>/dev/null`; > for ($i = 1; $i <= '"$count_ex"'; $i++) { > $printer_name = "'"$prefix"'" . "-$i"; > @res = grep(/${printer_name}\s+Printer/, @shares); > $count_got += scalar(@res); > } > > print $count_got; > ' >} > >_lp_printers_check() >{ > local prefix=$1 > local count_ex=$2 > > perl -e ' > $count_got = 0; > > @lps = `lpstat -a 2>/dev/null`; > for ($i = 1; $i <= '"$count_ex"'; $i++) { > $printer_name = "'"$prefix"'" . "-$i"; > @res = grep(/^${printer_name}\s+/, @lps); > $count_got += scalar(@res); > } > > print $count_got; > ' >} > >_printers_add() >{ > local prefix=$1 > local count=$2 > local dev=$3 > local printer_name="" > > local i=`_lp_printers_check $prefix $count` > (( $i == 0 )) || _fatal "$i printers already exist, cleanup needed" > > for i in `seq 1 $count`; do > printer_name=${prefix}-${i} > lpadmin -p $printer_name -E -v $dev \ > || _fatal "failed to add printer $printer_name" > done >} > > >_printers_rm() >{ > local prefix=$1 > local count=$2 > local printer_name="" > local i=0 > > for i in `seq 1 $count`; do > printer_name=${prefix}-${i} > lpadmin -x $printer_name \ > || _fatal "failed to remove printer $printer_name" > done >} > >_test_add_remove() >{ > local reload_action=$1 > local num_found=0 > > echo "testing printer addition with reload action: $reload_action..." > _printers_add $PRINTER_PREFIX $PRINTER_NUM $PRINTER_DEV > > `$reload_action &> /dev/null` || _fatal "$reload_action failed" > > sleep 5 # allow 5s for printer to appear > > num_found=`_smb_printers_check $PRINTER_PREFIX $PRINTER_NUM` > (( $num_found == $PRINTER_NUM )) \ > || _fatal "$num_found of $PRINTER_NUM printer(s) after reload" > echo "- passed" > > echo "testing printer removal with reload action: $reload_action" > _printers_rm $PRINTER_PREFIX $PRINTER_NUM > > `$reload_action &> /dev/null` || _fatal "$reload_action failed" > > sleep 5 > > num_found=`_smb_printers_check $PRINTER_PREFIX $PRINTER_NUM` > (( $num_found == 0 )) \ > || _fatal "$num_found printer(s) did not disappear after reload" > echo "- passed" >} > >PCAP_CACHE_TIME=`testparm -s --parameter-name="printcap cache time" 2>/dev/null` >[ $? -eq 0 ] || _fatal "failed to get printcap cache time" > >_test_add_remove "killall -HUP smbd" >_test_add_remove "sleep $PCAP_CACHE_TIME" >
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Raw
Actions:
View
Attachments on
bug 10652
:
10008
|
10009
|
10010
|
10026
|
10027
|
10028
|
10029
|
10097
|
10098
|
10149
|
10150
| 10173 |
10174
|
10187
|
10190
|
10191
|
10295