Work around bug in AIX 7.1 awk in report card tool
[dejagnu.git] / lib / dmucs.exp
blob8d77ada7f70695c8ebceb6fa0221f0041d4bec66
1 # Copyright (C) 2016-2019, 2020 Free Software Foundation, Inc.
3 # This file is part of DejaGnu.
5 # DejaGnu is free software: you can redistribute it and/or modify it
6 # under the terms of the GNU General Public License as published by
7 # the Free Software Foundation, either version 3 of the License, or
8 # (at your option) any later version.
10 # DejaGnu is distributed in the hope that it will be useful, but
11 # WITHOUT ANY WARRANTY; without even the implied warranty of
12 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
13 # General Public License for more details.
15 # You should have received a copy of the GNU General Public License
16 # along with DejaGnu.  If not, see <http://www.gnu.org/licenses/>.
18 # This file requires a slightly modified dmucs, which has been
19 # modified to support multiple architectures for toolchain
20 # testing. DMUCS sends the CPU load to a server, which we can query
21 # using the 'gethost' command to get the next available slave for a
22 # remote test based on which one is the least busy. The code for this
23 # enhanced DMUCS is at: http://git.linaro.org/git/toolchain/dmucs.git
25 proc dmucs_gethost { server arch } {
26     # gethost in debug mode returns this output:
27     # --node and --arch are unique to the Linaro branch of DMUCS
28     #
29     # Writing -->host 127.0.1.1 <-- to the server
30     # Calling Sgets
31     # Got -->10.6.1.24<-- from the server
32     # tmp is -->DISTCC_HOSTS=10.6.1.24/100<--
33     set slave ""
34     spawn gethost -s $server --node --arch $arch
35     expect {
36         # This is the IP number we want.
37         "^\[0-9\]*\.\[0-9\]*\.\[0-9\]*\.\[0-9\]*" {
38             set pos [expr {[string first "/" $expect_out(buffer)] - 1}]
39             set slave [string range $expect_out(buffer) 0 $pos]
40         }
41         timeout {
42             perror "DMUCS gethost command timed out"
43         }
44         eof {
45             perror "Failed to connect to DMUCS server"
46         }
47     }
48     return $slave