├── Docs
├── FAQ.html
├── about.html
├── background.html
├── catalog.html
├── cclientAPI.html
├── clientAPI.html
├── clientAPINonBlock.html
├── commands.html
├── configuration.html
├── cserviceAPI.html
├── design.html
├── fault.html
├── future.html
├── howToStructureService.html
├── howToTestService.html
├── images
│ ├── overview_client_service.jpg
│ ├── pluto-charon.jpg
│ ├── pluto-symbol.jpg
│ ├── pluton.graffle
│ ├── plutonOverview1.jpg
│ ├── plutonRemoteProxy.jpg
│ ├── plutonThreads1.jpg
│ ├── responseTimes.jpg
│ └── responseTimes2.jpg
├── index.html
├── javaClientAPI.html
├── javaServiceAPI.html
├── logs.html
├── overview.html
├── performance.html
├── perlAPI.html
├── phpAPI.html
├── plutonManager.html
├── sampleClient.cc.txt
├── sampleClient.html
├── sampleEventClient.cc.txt
├── sampleProxyClient.cc.txt
├── sampleService.cc.txt
├── serialization.html
├── serviceAPI.html
├── serviceKey.html
└── threading.html
├── HOWTO.build.txt
├── HOWTO.run.txt
├── LICENSE.txt
├── Makefile.am
├── README.markdown
├── clientServiceLibrary
├── Makefile.am
├── client.cc
├── clientEvent.cc
├── clientEventImpl.cc
├── clientImpl.cc
├── clientImpl.h
├── clientRequest.cc
├── clientRequestImpl.cc
├── clientRequestImpl.h
├── client_C.cc
├── decodePacket.cc
├── decodePacket.h
├── fault.cc
├── faultImpl.cc
├── faultImpl.h
├── generate_FaultEnglish.pl
├── generate_FaultEnglish.sh
├── perCallerClient.cc
├── perCallerClient.h
├── requestImpl.cc
├── requestImpl.h
├── requestQueue.cc
├── requestQueue.h
├── service.cc
├── serviceImpl.cc
├── serviceImpl.h
├── service_C.cc
├── shmLookupReader.cc
├── timeoutClock.cc
└── timeoutClock.h
├── commands
├── Makefile.am
├── plBatch.cc
├── plKillOldServices
├── plLookup.cc
├── plNetStringGrep.cc
├── plPing.cc
├── plReceiver.cc
├── plReloadManager
├── plSend.cc
├── plTest.cc
├── plTransmitter.cc
└── plVersion.cc
├── commonLibrary
├── Makefile.am
├── lineToArgv.cc
├── misc.cc
├── netString.cc
├── rateLimit.cc
├── serviceKey.cc
├── shmLookupCommon.cc
├── shmServiceCommon.cc
├── splitInterface.cc
└── util.cc
├── configure
├── configure.ac
├── include
├── global.h
├── hashPointer.h
├── hashString.h
├── hash_mapWrapper.h
├── istreamWrapper.h
├── lineToArgv.h
├── localeWrapper.h
├── misc.h
├── netString.h
├── ostreamWrapper.h
├── pluton
│ ├── client.h
│ ├── clientEvent.h
│ ├── clientRequest.h
│ ├── client_C.h
│ ├── common.h
│ ├── fault.h
│ ├── service.h
│ └── service_C.h
├── processExitReason.h
├── rateLimit.h
├── reportingChannel.h
├── serviceAttributes.h
├── serviceKey.h
├── shmLookup.h
├── shmLookupPrivate.h
├── shmService.h
├── stdintWrapper.h
├── streambufWrapper.h
└── util.h
├── manager
├── Makefile.am
├── bitmask.cc
├── bitmask.h
├── calibrateProcesses.cc
├── commandPort.cc
├── commandPort.h
├── configParser.cc
├── configParser.h
├── debug.cc
├── debug.h
├── listenBacklog.cc
├── listenBacklog.h
├── listenBacklog_kqueue.cc
├── listenBacklog_st.cc
├── listenInterface.cc
├── listenInterface.h
├── loadConfigurations.cc
├── logging.cc
├── logging.h
├── manager.cc
├── manager.h
├── periodicReports.cc
├── pidMap.cc
├── pidMap.h
├── plutonManager.cc
├── process.cc
├── process.h
├── service.cc
├── service.h
├── serviceConfig.h
├── shmLookupWriter.cc
├── shmServiceWriter.cc
├── startProcess.cc
├── startService.cc
├── threadedObject.cc
└── threadedObject.h
├── regressionTests
├── hup_manager
├── runall.sh
├── start_manager
├── start_manager_wrapper
├── stop_manager
├── t.05.misc
│ ├── rateLimit.sh
│ ├── shmAlign.sh
│ └── shmservice.sh
├── t.10.netstrings
│ ├── encapsulated.sh
│ ├── factory.sh
│ ├── generate.sh
│ ├── managed.sh
│ ├── nsfactory.data
│ └── nsfactorymanaged.data
├── t.15.tools
│ ├── echoConfig
│ │ └── system.echo.0.raw
│ └── ping1.sh
├── t.20.commandline
│ ├── badRendezvous.sh
│ ├── commandPort1.sh
│ ├── commandPort2.sh
│ ├── goodRendezvous.sh
│ ├── noConfig.sh
│ ├── noLookup.sh
│ └── noRendezvous.sh
├── t.25.bugs
│ ├── 1412403.conf
│ │ └── system.echo.0.raw
│ ├── 1412403.sh
│ ├── 1448050.conf
│ │ └── system.echo.0.raw
│ ├── 1448050.sh
│ ├── 1448050.testfile
│ ├── 1552859.conf
│ │ └── system.echo.0.raw
│ ├── 1552859.sh
│ ├── 2179686.conf
│ │ └── system.echo.0.raw
│ ├── 2179686.sh
│ ├── 2499645.conf
│ │ └── system.echo.0.raw
│ ├── 2499645a.sh
│ ├── 2499645b.sh
│ ├── 2997358.conf
│ │ └── system.echo.0.raw
│ └── 2997358.sh
├── t.30.config
│ ├── allErrors.sh
│ ├── allErrorsConfig
│ │ ├── badbool.param.0.raw
│ │ ├── badmultiplier.param.0.raw
│ │ ├── badnumber.param.0.raw
│ │ ├── badtype.param.0.yoo
│ │ ├── duplicate.param.0.raw
│ │ ├── greaterthan.param.0.raw
│ │ ├── invalid.type
│ │ ├── lessthan.param.0.raw
│ │ ├── minimumgreater.param.0.raw
│ │ ├── multiplieroverflow.param.0.raw
│ │ ├── noexec.param.0.raw
│ │ ├── processgtcc.param.0.raw
│ │ └── unknown.param.0.raw
│ ├── allNoErrors.sh
│ ├── allNoErrorsConfig
│ │ ├── cd.good.0.raw
│ │ ├── enable-leak-ramping.good.0.raw
│ │ ├── exec-failure-backoff.good.0.raw
│ │ ├── exec.good.0.raw
│ │ ├── exit.good.0.raw
│ │ ├── idle-timeout.good.0.raw
│ │ ├── maximum-processes.good.0.raw
│ │ ├── maximum-requests.good.0.raw
│ │ ├── maximum-retries.good.0.raw
│ │ ├── maximum-threads.good.0.raw
│ │ ├── minimum-processes.good.0.raw
│ │ ├── occupancy-percent.good.0.raw
│ │ ├── prestart-processes.good.0.raw
│ │ ├── recorder-cycle.good.0.raw
│ │ ├── recorder-prefix.good.0.raw
│ │ ├── ulimit-cpu-milliseconds.good.0.raw
│ │ ├── ulimit-data-memory.good.0.raw
│ │ ├── ulimit-open-files.good.0.raw
│ │ └── unresponsive-timeout.good.0.raw
│ ├── oneConfig
│ │ └── one.config.0.raw
│ ├── oneEntry.sh
│ ├── replace.sh
│ ├── replaceConfig
│ │ ├── one.config.0.raw
│ │ ├── three.config.0.raw
│ │ └── two.config.0.raw
│ ├── warningConfig
│ │ ├── exec-warning.good.0.raw
│ │ └── ignore.this.txt
│ ├── warnings.sh
│ ├── zeroConfig
│ │ └── README
│ └── zeroEntries.sh
├── t.35.lookup
│ ├── bad.sh
│ ├── config
│ │ ├── normal.func1.1.COBOL
│ │ ├── normal.func1.1.HTML
│ │ ├── normal.func1.1.JMS
│ │ ├── normal.func1.1.JSON
│ │ ├── normal.func1.1.NETSTRING
│ │ ├── normal.func1.1.PHP
│ │ ├── normal.func1.1.SOAP
│ │ ├── normal.func1.1.XML
│ │ ├── normal.func1.1.raw
│ │ ├── twild..1.COBOL
│ │ ├── twild..1.HTML
│ │ ├── twild..1.JMS
│ │ ├── twild..1.JSON
│ │ ├── twild..1.NETSTRING
│ │ ├── twild..1.PHP
│ │ ├── twild..1.SOAP
│ │ ├── twild..1.XML
│ │ └── twild..1.raw
│ └── good.sh
├── t.40.client
│ ├── affinity.sh
│ ├── clientErrors.sh
│ ├── clientFaults.sh
│ ├── echoConfig
│ │ └── system.echo.0.raw
│ ├── echoConfig3
│ │ └── system.echo.0.raw
│ ├── echoConfigAffinity
│ │ └── system.echo.0.raw
│ ├── executeAndWait1.sh
│ ├── executeAndWait2.sh
│ ├── executeAndWaitBlocked.sh
│ ├── executeBlockedFDs.sh
│ ├── faultReturn.sh
│ ├── inProgress1.sh
│ ├── largeRequests.sh
│ ├── partialIO.sh
│ ├── resourceLeaks.sh
│ ├── retryConfig
│ │ └── test.retry.0.raw
│ ├── retryFail.sh
│ ├── retryGood.sh
│ ├── singleEchoConfig
│ │ └── system.echo.0.raw
│ ├── smallRequests.sh
│ ├── timeoutReset.sh
│ └── waitOneBug.sh
├── t.42.perlSwig
│ ├── client1.sh
│ ├── echoConfig
│ │ ├── perl.echo.0.raw
│ │ └── system.echo.0.raw
│ └── service1.sh
├── t.43.C
│ ├── client1.sh
│ ├── client2.sh
│ ├── service1.sh
│ └── wrapper1Config
│ │ ├── system.echo.0.raw
│ │ └── wrapper.one.0.raw
├── t.44.java
│ ├── client1.sh
│ ├── echoConfig
│ │ ├── system.echo.0.raw
│ │ ├── system.java.0.raw
│ │ └── system.java.1.raw
│ ├── service1.sh
│ ├── service2.sh
│ └── thread1.sh
├── t.45.clientProxy
│ ├── echoConfig
│ │ └── system.echo.0.raw
│ ├── globals1.sh
│ ├── globals2.sh
│ ├── pollProxy.sh
│ └── pollProxyBad.sh
├── t.46.clientMutex
│ ├── echoConfig
│ │ └── system.echo.0.raw
│ ├── mutexStateThreads.sh
│ └── mutexpthreads.sh
├── t.47.clientThreads
│ ├── assert1.sh
│ ├── echoConfig
│ │ └── system.echo.0.raw
│ ├── posixThread1.sh
│ └── stThread2.sh
├── t.48.clientEvents
│ ├── config
│ │ └── system.echo.0.raw
│ ├── filter1.sh
│ └── good1.sh
├── t.50.service
│ ├── config
│ │ ├── nobackoff.exit.0.raw
│ │ ├── system.exit.0.raw
│ │ ├── test..3.JSON
│ │ └── test.service1.3.HTML
│ ├── getParameters.sh
│ └── serviceExit.sh
├── t.60.recorder
│ ├── configLimit
│ │ └── system.echo.0.raw
│ ├── configRecord
│ │ └── system.echo.0.raw
│ ├── limit.sh
│ └── record.sh
├── t.70.limits
│ ├── config
│ │ ├── cpu.echo.0.raw
│ │ ├── files.echo.0.raw
│ │ └── memory.echo.0.raw
│ ├── cpu.sh
│ └── ulimits.sh
├── t.80.protocol
│ └── decode.sh
├── t.90.dataExchange
│ └── dexFauxSTDIO1.sh
└── term_manager
├── replace
├── .deps
│ └── dummy.Po
└── Makefile.am
├── run_manager.sh
├── services
├── Makefile.am
├── cpuLoop.cc
├── curl.cc
├── echo.cc
├── echo_st.cc
├── exit.cc
├── fopenLoop.cc
├── gdb.sh
├── loadSimulator.cc
└── mallocLoop.cc
├── testPrograms
├── Makefile.am
├── bug1552859.cc
├── sampleClient.cc
├── sampleProxyClient.cc
├── sampleService.cc
├── shmAlign.cc
├── shmInvalidate.cc
├── tCclient1.c
├── tCclient2.c
├── tClientAffinity.cc
├── tClientBlockedFDs.cc
├── tClientErrors.cc
├── tClientEvent.cc
├── tClientEvent2.cc
├── tClientEventFilter.cc
├── tClientExecute1.cc
├── tClientExecute2.cc
├── tClientExecuteBlocked.cc
├── tClientFault1.cc
├── tClientGlobals1.cc
├── tClientGlobals2.cc
├── tClientMultiPerCaller.cc
├── tClientPollProxy.cc
├── tClientPollProxyBad.cc
├── tClientReset.cc
├── tClientResourceLeaks.cc
├── tClientStateThreads.cc
├── tClientpthreads.cc
├── tCwrapper1.c
├── tInProgress.cc
├── tJavaClient1.java
├── tJavaService0.java
├── tJavaService1.java
├── tJavaThreads1.java
├── tLineToArgv.cc
├── tNetStringFactory.cc
├── tNetStringFactoryManaged.cc
├── tNetStringGenerate.cc
├── tNetStringGenerateEncapsulated.cc
├── tPartialIO.cc
├── tPerlSwig1.pl
├── tPerlSwig2.pl
├── tPhpWrapper1.php
├── tRateLimit.cc
├── tRetry.cc
├── tService1.cc
├── tServiceExit.cc
├── tShmService.cc
├── tThread1.cc
├── tThread2.cc
├── tThread3.cc
├── tThread4.cc
├── tThread5.cc
├── tc.cc
└── ts.cc
└── wrappers
├── README
├── java.old
├── Makefile.Yahoo
├── README
├── com
│ └── yahoo
│ │ └── pluton
│ │ ├── Client.java
│ │ ├── ClientRequest.java
│ │ └── Service.java
├── jar
│ └── Makefile.Yahoo
├── jni
│ ├── Makefile.Yahoo
│ ├── client.c
│ ├── generate_FaultExceptions.pl
│ ├── initThreads.cc
│ └── service.c
└── pluton.c
├── java
├── Makefile
├── Makefile.am
└── README
├── perl.old
├── Makefile.Yahoo
├── Makefile.am
├── README
├── pluton.i
├── swigClient.cc
├── swigClient.h
├── swigService.cc
├── swigService.h
├── tc.pl
└── ts.pl
├── perl
├── Makefile
├── Makefile.am
├── README
├── tc.pl
└── ts.pl
├── php.old
├── Makefile.Yahoo
├── Makefile.am
├── README
├── php_pluton.h
├── php_pluton_structures.h
├── pluton.cc
├── unit_tests
│ ├── 05-client-simple.expected.stdout
│ ├── 05-client-simple.php
│ ├── 10-client-fault.expected.stdout
│ ├── 10-client-fault.php
│ ├── 12-client-timeout.expected.stdout
│ ├── 12-client-timeout.php
│ ├── 15-client-execute.expected.stdout
│ ├── 15-client-execute.php
│ ├── 50-clientrequest-attributes.php
│ ├── 55-clientrequest-context.php
│ ├── 60-clientrequest-inprogress.php
│ ├── 65-clientrequest-fault.php
│ ├── 71-client-leak.expected.stdout
│ ├── 71-client-leak.php
│ ├── 72-clientrequest-leak.php
│ ├── 80-service-simple.1.data
│ ├── 80-service-simple.1.expected.dataout
│ ├── 80-service-simple.php
│ ├── 82-service-sendfault.1.data
│ ├── 82-service-sendfault.1.expected.stderr
│ ├── 82-service-sendfault.php
│ ├── 84-service-getstuff.1.data
│ ├── 84-service-getstuff.1.expected.dataout
│ ├── 84-service-getstuff.php
│ ├── 86-service-context.1.context
│ ├── 86-service-context.1.data
│ ├── 86-service-context.1.expected.dataout
│ ├── 86-service-context.php
│ ├── 90-service-getfault.1.php
│ ├── 90-service-getfault.php
│ ├── 91-service-leak.php
│ ├── 95-other-leak1.sh
│ ├── run_client_tests.sh
│ ├── run_other_tests.sh
│ ├── run_service_tests.sh
│ └── runall.sh
└── yahoo_pluton.ini
├── php
├── Makefile
├── Makefile.am
├── README
└── yahoo_pluton.ini
└── pluton.i
/Docs/about.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | About the Pluto-Charon Image
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 | About the Pluto-Charon Image
18 |
19 | This NASA image
21 | of Pluto and Charon was taken with the Hubble Space Telescope using
22 | the European Space Agency's Faint Object Camera or FOC. It is
23 | currently one of the best images available and is unlikely to be
24 | substantially supplanted until 2015 when the New Horizons probe , launched in
26 | January 2006, is expected to fly by Pluto en-route to the Kuiper Belt.
27 |
28 | Pluton was the proposed name for trans-Nepturian objects -
29 | though geologists have long used this word to mean a body of igneous
30 | rock. The notion of a gaggle of small planetoids revolving around a
31 | set of central applications seems to fit with the application model
32 | described here-in.
33 |
34 |
36 |
37 |
39 |
40 | "New Horizons is now 1.19 billion miles (nearly 1.92 billion
41 | kilometers) from Earth, speeding away from the Sun at just over 10
42 | miles per second. At that distance, radio signals (traveling at light
43 | speed) from home need an hour and 46 minutes to reach the
44 | spacecraft."
45 |
46 |
47 |
48 |
49 |
50 | $Id: about.html 263341 2009-11-26 17:35:13Z markd $
51 | © Copyright Yahoo! Inc, 2007, 2009
52 |
53 |
54 |
55 |
--------------------------------------------------------------------------------
/Docs/catalog.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | The Pluton Framework: Service Catalog
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 | The Pluton Framework: Service Catalog
18 |
19 |
20 | system.
21 |
22 |
27 |
28 | Mail.
29 |
30 | AddressBook.
31 |
32 |
33 |
34 |
35 | Name system.echo.0.raw
36 |
37 | Description
38 | Echo the exact contexts of the request data back as response data. The
39 | contents are not examined by this service.
40 |
41 |
42 | Context Variables
43 |
44 | echo.sleepMS - if a positive integer, sleep for this many milliseconds
45 | echo.log - if present, log activity to clog
46 |
47 |
48 |
49 | Request Data any
50 | Response Data Copy of Request Data
51 |
52 |
53 |
54 |
55 |
56 |
57 | Name system.curl.0.raw
58 |
59 | Description
60 | Fetch a URL, much as the curl
command does.
61 |
62 |
63 | Context Variables *none*
64 |
65 | Request Data getopt syntax. This service
66 | supports a subset of getopt options provided by curl
to
67 | perform header insertion and similar. In
68 | particular,
69 |
70 | [-ihL] [-A UserAgent] [-b cookieValue] [-e referrer] [-H header] [-U UserPass] URL
71 |
72 | See the curl
command for a description of these options.
73 |
74 | Response Data Raw data returned from URL fetch
75 |
76 |
77 |
78 |
79 |
80 |
81 | $Id: catalog.html 260483 2009-10-16 18:47:56Z markd $
82 | © Copyright Yahoo! Inc, 2007
83 |
84 |
85 |
86 |
--------------------------------------------------------------------------------
/Docs/images/overview_client_service.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/YahooArchive/Pluton/82bbab17c0013d87063b398ec777d5977f353d0a/Docs/images/overview_client_service.jpg
--------------------------------------------------------------------------------
/Docs/images/pluto-charon.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/YahooArchive/Pluton/82bbab17c0013d87063b398ec777d5977f353d0a/Docs/images/pluto-charon.jpg
--------------------------------------------------------------------------------
/Docs/images/pluto-symbol.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/YahooArchive/Pluton/82bbab17c0013d87063b398ec777d5977f353d0a/Docs/images/pluto-symbol.jpg
--------------------------------------------------------------------------------
/Docs/images/plutonOverview1.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/YahooArchive/Pluton/82bbab17c0013d87063b398ec777d5977f353d0a/Docs/images/plutonOverview1.jpg
--------------------------------------------------------------------------------
/Docs/images/plutonRemoteProxy.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/YahooArchive/Pluton/82bbab17c0013d87063b398ec777d5977f353d0a/Docs/images/plutonRemoteProxy.jpg
--------------------------------------------------------------------------------
/Docs/images/plutonThreads1.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/YahooArchive/Pluton/82bbab17c0013d87063b398ec777d5977f353d0a/Docs/images/plutonThreads1.jpg
--------------------------------------------------------------------------------
/Docs/images/responseTimes.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/YahooArchive/Pluton/82bbab17c0013d87063b398ec777d5977f353d0a/Docs/images/responseTimes.jpg
--------------------------------------------------------------------------------
/Docs/images/responseTimes2.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/YahooArchive/Pluton/82bbab17c0013d87063b398ec777d5977f353d0a/Docs/images/responseTimes2.jpg
--------------------------------------------------------------------------------
/Docs/sampleService.cc.txt:
--------------------------------------------------------------------------------
1 | #include
2 | #include
3 |
4 | using namespace std;
5 |
6 | #include "pluton/service.h"
7 |
8 | //////////////////////////////////////////////////////////////////////
9 | // This is a sample pluton service that demonstrates the common parts
10 | // of the interface and uses them in various different ways for
11 | // demonstration purposes. This program compiles and runs as a service
12 | // which simply echos the request back to the client with some leading
13 | // text to show that the request was exchanged.
14 | //
15 | // Generally speaking, this is a well-coded pluton service from the
16 | // perspective that it assiduously checks all return codes and logs
17 | // all unexpected results.
18 | //////////////////////////////////////////////////////////////////////
19 |
20 | int
21 | main(int argc, char** argv)
22 | {
23 | pluton::service S("sampleService");
24 |
25 | if (!S.initialize()) {
26 | clog << S.getFault().getMessage("Fatal: initialize() failed in sampleService") << endl;
27 | exit(1);
28 | }
29 |
30 | // Simply iterate on requests
31 |
32 | while (S.getRequest()) {
33 |
34 | string request; // Be in-efficient and slurp the request
35 | S.getRequestData(request); // into a string.
36 |
37 | string response = "testService got: ";
38 | response += request;
39 |
40 | if (!S.sendResponse(response)) {
41 | clog << S.getFault().getMessage("Fatal: sendResponse() failed in sampleService") << endl;
42 | exit(1);
43 | }
44 | }
45 |
46 | //////////////////////////////////////////////////////////////////////
47 | // Check to see if getRequest faulted or we're just being
48 | // told terminated.
49 | //////////////////////////////////////////////////////////////////////
50 |
51 | if (S.hasFault()) {
52 | clog << S.getFault().getMessage("Fatal: getRequest() failed in sampleService") << endl;
53 | exit(2);
54 | }
55 |
56 | return 0; // Cause destructor to be called
57 | }
58 |
--------------------------------------------------------------------------------
/HOWTO.run.txt:
--------------------------------------------------------------------------------
1 | 1. sudo make install
2 |
3 | 2. Start the manager - from one shell
4 |
5 | $ export LD_LIBRARY_PATH=/usr/local/lib
6 | $ sh run_manager.sh
7 |
8 | 3. Send a service request with plSend/plPing - from another shell
9 |
10 | $ export LD_LIBRARY_PATH=/usr/local/lib
11 | $
12 | $ plSend -n system.echo.0.raw "echo me"
13 | $ plPing -c 5
14 |
15 |
16 | Notes:
17 |
18 | o Sending a SIGINT (typically ctrl-C) from the manager terminal causes
19 | a configuration reload
20 |
21 | o Sending a SIGTERM (typically ctrl-\) from the manager terminal
22 | causes the manager to shutdown
23 |
24 |
25 | In a production environment, the plutonManager is designed to run as a
26 | supervised process (see http://cr.yp.to/daemontools.html)
27 |
--------------------------------------------------------------------------------
/LICENSE.txt:
--------------------------------------------------------------------------------
1 | /**
2 | * Yahoo! Pluton
3 | *
4 | * Hosted on GitHub: http://github.com/yahoo/pluton
5 | *
6 | * @package pluton
7 | *
8 | * @author Mark Delany
9 | *
10 | * @copyright Copyrights for code authored by Yahoo! Inc. is licensed under the following terms:
11 | * @license BSD Open Source License
12 | *
13 | * Permission is hereby granted, free of charge, to any person obtaining a copy
14 | * of this software and associated documentation files (the "Software"), to deal
15 | * in the Software without restriction, including without limitation the rights
16 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
17 | * copies of the Software, and to permit persons to whom the Software is
18 | * furnished to do so, subject to the following conditions:
19 | *
20 | * The above copyright notice and this permission notice shall be included in
21 | * all copies or substantial portions of the Software.
22 | *
23 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
24 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
25 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
26 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
27 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
28 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
29 | * THE SOFTWARE.
30 | **/
31 |
--------------------------------------------------------------------------------
/Makefile.am:
--------------------------------------------------------------------------------
1 | if BUILDPHPWRAPPER
2 | PHPWRAPPER = wrappers/php
3 | endif
4 | if BUILDPERLWRAPPER
5 | PERLWRAPPER = wrappers/perl
6 | endif
7 | if BUILDJAVAWRAPPER
8 | JAVAWRAPPER = wrappers/java
9 | endif
10 |
11 |
12 | SUBDIRS = commonLibrary clientServiceLibrary manager commands services testPrograms \
13 | $(PHPWRAPPER) $(PERLWRAPPER) $(JAVAWRAPPER)
14 |
15 | ACLOCAL_AMFLAGS = -I m4
16 |
17 | include_HEADERS = include/pluton/client.h include/pluton/clientEvent.h \
18 | include/pluton/clientRequest.h include/pluton/client_C.h \
19 | include/pluton/common.h include/pluton/fault.h include/pluton/service.h \
20 | include/pluton/service_C.h
21 |
--------------------------------------------------------------------------------
/clientServiceLibrary/Makefile.am:
--------------------------------------------------------------------------------
1 | AM_CPPFLAGS = -I$(top_srcdir)/include @WARN_CXXFLAGS@
2 | lib_LTLIBRARIES = libpluton.la
3 |
4 | libpluton_la_SOURCES = client.cc clientRequestImpl.cc perCallerClient.cc \
5 | service_C.cc clientEvent.cc client_C.cc requestImpl.cc \
6 | shmLookupReader.cc clientEventImpl.cc decodePacket.cc \
7 | requestQueue.cc timeoutClock.cc clientImpl.cc fault.cc \
8 | service.cc clientRequest.cc faultImpl.cc serviceImpl.cc
9 |
10 | libpluton_la_LIBADD = $(top_builddir)/commonLibrary/libcommon.a
11 |
12 | libpluton_la_LDFLAGS = -version-info 0:0:0
13 |
14 | faultEnglish.cc.txt: $(top_srcdir)/include/pluton/fault.h
15 | $(SHELL) ./generate_FaultEnglish.sh <$? >$@
16 |
17 | faultImpl.lo: faultEnglish.cc.txt
18 |
19 | clean-local:
20 | -rm -f faultEnglish.cc.txt
--------------------------------------------------------------------------------
/clientServiceLibrary/generate_FaultEnglish.pl:
--------------------------------------------------------------------------------
1 | #! /usr/bin/perl -w
2 |
3 | # Feed fault.h via stdin and generate a C array on stdout
4 |
5 | print <) {
19 | next unless /\s+(\S+) \=\s+\S+\s+\/\/ E: (.*)/;
20 | printf("\tcase pluton::%-30s: return \"%s:%s\";\n", $1, $1, $2);
21 | }
22 |
23 | print "\tdefault: break;\n";
24 |
25 | print <
35 |
36 | namespace pluton {
37 |
38 | class timeoutClock {
39 | public:
40 | timeoutClock();
41 |
42 | bool isRunning() const { return _isRunningFlag; }
43 | void start(const struct timeval* now, int setTimeoutMS);
44 | int getMSremaining(const struct timeval* now, struct timeval* remainingPtr=0);
45 | void stop() { _isRunningFlag = false; }
46 |
47 | private:
48 | bool _isRunningFlag;
49 | struct timeval _startTime;
50 | int _timeoutMS;
51 | };
52 | }
53 |
54 | #endif
55 |
--------------------------------------------------------------------------------
/commands/Makefile.am:
--------------------------------------------------------------------------------
1 | AM_CXXFLAGS = -I$(top_srcdir)/include -I$(top_srcdir)/clientServiceLibrary @WARN_CXXFLAGS@
2 | LDADD = $(top_builddir)/clientServiceLibrary/libpluton.la $(top_builddir)/commonLibrary/libcommon.a
3 | bin_PROGRAMS = plPing plLookup plSend plBatch plVersion plNetStringGrep plTest
4 | dist_bin_SCRIPTS = plReloadManager
5 |
6 | plPing_SOURCES = plPing.cc
7 |
8 | plLookup_SOURCES = plLookup.cc
9 |
10 | plSend_SOURCES = plSend.cc
11 |
12 | plBatch_SOURCES = plBatch.cc
13 |
14 | plVersion_SOURCES = plVersion.cc
15 |
16 | plNetStringGrep_SOURCES = plNetStringGrep.cc
17 |
18 | plTest_SOURCES = plTest.cc
19 |
--------------------------------------------------------------------------------
/commands/plKillOldServices:
--------------------------------------------------------------------------------
1 | #! /bin/sh
2 |
3 | # This script attempts to kill all processes attached to unix
4 | # sockets in the pluton rendezvous directory.
5 |
6 | RendezvourDIR=${1:-.}
7 |
8 | if [ -z "$RendezvourDIR" ]; then
9 | echo Error: Must supplied a Rendezvous Directory as argument one
10 | exit 1
11 | fi
12 |
13 | if [ ! -d "$RendezvourDIR" ]; then
14 | echo Error: $RendezvourDIR is not a valid Rendezvous directory
15 | exit 1
16 | fi
17 |
18 | # If the directory is empty, we're done
19 |
20 | flist=`find $RendezvourDIR -name '*.mmap' -print`
21 | [ -z "$flist" ] && exit 0
22 |
23 | # Get the process list just once
24 |
25 | plist=`lsof -t $flist 2>/dev/null| sort -u`
26 | [ -z "$plist" ] && exit 0
27 |
28 | echo Process target count: `echo $plist | wc -l`
29 |
30 |
31 | # Do the same thing the manager does, escalate the signals
32 |
33 | for sig in URG INT TERM KILL
34 | do
35 |
36 | echo $plist | xargs kill -s $sig
37 |
38 | sleep 1
39 |
40 | done
41 |
42 | exit 0
43 |
--------------------------------------------------------------------------------
/commonLibrary/Makefile.am:
--------------------------------------------------------------------------------
1 | AM_CPPFLAGS = -I$(top_srcdir)/include -fPIC @WARN_CXXFLAGS@
2 | noinst_LIBRARIES = libcommon.a
3 | libcommon_a_SOURCES = lineToArgv.cc misc.cc netString.cc rateLimit.cc serviceKey.cc \
4 | shmLookupCommon.cc shmServiceCommon.cc splitInterface.cc util.cc
5 |
--------------------------------------------------------------------------------
/commonLibrary/shmLookupCommon.cc:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright (c) 2010, Yahoo! Inc. All rights reserved.
3 |
4 | Redistribution and use of this software in source and binary forms, with or
5 | without modification, are permitted provided that the following conditions are
6 | met:
7 |
8 | * Redistributions of source code must retain the above copyright notice, this
9 | list of conditions and the following disclaimer.
10 |
11 | * Redistributions in binary form must reproduce the above copyright notice,
12 | this list of conditions and the following disclaimer in the documentation and/or
13 | other materials provided with the distribution.
14 |
15 | * Neither the name of Yahoo! Inc. nor the names of its contributors may be used
16 | to endorse or promote products derived from this software without specific prior
17 | written permission of Yahoo! Inc.
18 |
19 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
20 | ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
21 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
22 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
23 | ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
24 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
25 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
26 | ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
27 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
28 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29 | */
30 |
31 | #include "config.h"
32 |
33 | #include
34 | #include
35 |
36 | #include "shmLookup.h"
37 |
38 |
39 | shmLookup::shmLookup() : _mapSize(0), _baseAddress(0)
40 | {
41 | }
42 |
43 |
44 | shmLookup::~shmLookup()
45 | {
46 | if (_baseAddress) munmap(_baseAddress, _mapSize);
47 | }
48 |
49 |
50 | unsigned int
51 | shmLookup::hashData(const char* cp, int len)
52 | {
53 | unsigned int hash = 0;
54 | while (len-- > 0) {
55 | hash += (hash << 5);
56 | hash ^= (unsigned char) *cp++;
57 | }
58 | return hash;
59 | }
60 |
--------------------------------------------------------------------------------
/include/hashPointer.h:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright (c) 2010, Yahoo! Inc. All rights reserved.
3 |
4 | Redistribution and use of this software in source and binary forms, with or
5 | without modification, are permitted provided that the following conditions are
6 | met:
7 |
8 | * Redistributions of source code must retain the above copyright notice, this
9 | list of conditions and the following disclaimer.
10 |
11 | * Redistributions in binary form must reproduce the above copyright notice,
12 | this list of conditions and the following disclaimer in the documentation and/or
13 | other materials provided with the distribution.
14 |
15 | * Neither the name of Yahoo! Inc. nor the names of its contributors may be used
16 | to endorse or promote products derived from this software without specific prior
17 | written permission of Yahoo! Inc.
18 |
19 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
20 | ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
21 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
22 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
23 | ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
24 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
25 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
26 | ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
27 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
28 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29 | */
30 |
31 | #ifndef P_HASHPOINTER_H
32 | #define P_HASHPOINTER_H
33 |
34 | //////////////////////////////////////////////////////////////////////
35 | // Define a common hash function for hash_maps using void* pointers as
36 | // their key.
37 | //////////////////////////////////////////////////////////////////////
38 |
39 | struct hashPointer
40 | {
41 | size_t operator()(const void* p) const
42 | {
43 | size_t hash = (size_t) p;
44 |
45 | return hash;
46 | }
47 | };
48 |
49 | #endif
50 |
--------------------------------------------------------------------------------
/include/istreamWrapper.h:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright (c) 2010, Yahoo! Inc. All rights reserved.
3 |
4 | Redistribution and use of this software in source and binary forms, with or
5 | without modification, are permitted provided that the following conditions are
6 | met:
7 |
8 | * Redistributions of source code must retain the above copyright notice, this
9 | list of conditions and the following disclaimer.
10 |
11 | * Redistributions in binary form must reproduce the above copyright notice,
12 | this list of conditions and the following disclaimer in the documentation and/or
13 | other materials provided with the distribution.
14 |
15 | * Neither the name of Yahoo! Inc. nor the names of its contributors may be used
16 | to endorse or promote products derived from this software without specific prior
17 | written permission of Yahoo! Inc.
18 |
19 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
20 | ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
21 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
22 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
23 | ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
24 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
25 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
26 | ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
27 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
28 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29 | */
30 |
31 | #ifndef P_ISTREAMWRAPPER_H
32 | #define P_ISTREAMWRAPPER_H
33 |
34 | //////////////////////////////////////////////////////////////////////
35 | // Encapsulate OS differences for defining an STL istream.
36 | //////////////////////////////////////////////////////////////////////
37 |
38 | #if defined(__FreeBSD__) && (__FreeBSD__ < 6)
39 | #include
40 | #else
41 | #include
42 | #endif
43 |
44 | #endif
45 |
--------------------------------------------------------------------------------
/include/lineToArgv.h:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright (c) 2010, Yahoo! Inc. All rights reserved.
3 |
4 | Redistribution and use of this software in source and binary forms, with or
5 | without modification, are permitted provided that the following conditions are
6 | met:
7 |
8 | * Redistributions of source code must retain the above copyright notice, this
9 | list of conditions and the following disclaimer.
10 |
11 | * Redistributions in binary form must reproduce the above copyright notice,
12 | this list of conditions and the following disclaimer in the documentation and/or
13 | other materials provided with the distribution.
14 |
15 | * Neither the name of Yahoo! Inc. nor the names of its contributors may be used
16 | to endorse or promote products derived from this software without specific prior
17 | written permission of Yahoo! Inc.
18 |
19 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
20 | ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
21 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
22 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
23 | ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
24 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
25 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
26 | ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
27 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
28 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29 | */
30 |
31 | #ifndef P_LINETOARGV_H
32 | #define P_LINETOARGV_H
33 |
34 | //////////////////////////////////////////////////////////////////////
35 | // Tokenize a line of tokens into an argv. Return # argv entries of
36 | // -ve column at which the error was detected.
37 | //////////////////////////////////////////////////////////////////////
38 |
39 | namespace util {
40 | extern int lineToArgv(const char* inputLine, int len, char* buffer, char** argv, int maxArgv,
41 | const char*& err);
42 | }
43 |
44 | #endif
45 |
--------------------------------------------------------------------------------
/include/localeWrapper.h:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright (c) 2010, Yahoo! Inc. All rights reserved.
3 |
4 | Redistribution and use of this software in source and binary forms, with or
5 | without modification, are permitted provided that the following conditions are
6 | met:
7 |
8 | * Redistributions of source code must retain the above copyright notice, this
9 | list of conditions and the following disclaimer.
10 |
11 | * Redistributions in binary form must reproduce the above copyright notice,
12 | this list of conditions and the following disclaimer in the documentation and/or
13 | other materials provided with the distribution.
14 |
15 | * Neither the name of Yahoo! Inc. nor the names of its contributors may be used
16 | to endorse or promote products derived from this software without specific prior
17 | written permission of Yahoo! Inc.
18 |
19 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
20 | ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
21 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
22 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
23 | ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
24 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
25 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
26 | ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
27 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
28 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29 | */
30 |
31 | #ifndef P_LOCALEWRAPPER_H
32 | #define P_LOCALEWRAPPER_H
33 |
34 | //////////////////////////////////////////////////////////////////////
35 | // Encapsulate OS differences for defining access to locale.
36 | //////////////////////////////////////////////////////////////////////
37 |
38 | #if defined(__FreeBSD__) && (__FreeBSD__ < 6)
39 | #include
40 | typedef int_int type;
41 | #else
42 | #include
43 | #endif
44 |
45 |
46 | #endif
47 |
--------------------------------------------------------------------------------
/include/ostreamWrapper.h:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright (c) 2010, Yahoo! Inc. All rights reserved.
3 |
4 | Redistribution and use of this software in source and binary forms, with or
5 | without modification, are permitted provided that the following conditions are
6 | met:
7 |
8 | * Redistributions of source code must retain the above copyright notice, this
9 | list of conditions and the following disclaimer.
10 |
11 | * Redistributions in binary form must reproduce the above copyright notice,
12 | this list of conditions and the following disclaimer in the documentation and/or
13 | other materials provided with the distribution.
14 |
15 | * Neither the name of Yahoo! Inc. nor the names of its contributors may be used
16 | to endorse or promote products derived from this software without specific prior
17 | written permission of Yahoo! Inc.
18 |
19 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
20 | ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
21 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
22 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
23 | ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
24 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
25 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
26 | ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
27 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
28 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29 | */
30 |
31 | #ifndef P_OSTREAMWRAPPER_H
32 | #define P_OSTREAMWRAPPER_H
33 |
34 | //////////////////////////////////////////////////////////////////////
35 | // Encapsulate OS differences for defining an STL ostream.
36 | //////////////////////////////////////////////////////////////////////
37 |
38 | #if defined(__FreeBSD__) && (__FreeBSD__ < 6)
39 | #include
40 | #else
41 | #include
42 | #endif
43 |
44 | #endif
45 |
--------------------------------------------------------------------------------
/include/processExitReason.h:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright (c) 2010, Yahoo! Inc. All rights reserved.
3 |
4 | Redistribution and use of this software in source and binary forms, with or
5 | without modification, are permitted provided that the following conditions are
6 | met:
7 |
8 | * Redistributions of source code must retain the above copyright notice, this
9 | list of conditions and the following disclaimer.
10 |
11 | * Redistributions in binary form must reproduce the above copyright notice,
12 | this list of conditions and the following disclaimer in the documentation and/or
13 | other materials provided with the distribution.
14 |
15 | * Neither the name of Yahoo! Inc. nor the names of its contributors may be used
16 | to endorse or promote products derived from this software without specific prior
17 | written permission of Yahoo! Inc.
18 |
19 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
20 | ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
21 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
22 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
23 | ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
24 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
25 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
26 | ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
27 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
28 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29 | */
30 |
31 | #ifndef P_PROCESSEXITREASON_H
32 | #define P_PROCESSEXITREASON_H
33 |
34 | //////////////////////////////////////////////////////////////////////
35 | // Services and the manager use a common set of exit reasons to
36 | // communicate to each other.
37 | //////////////////////////////////////////////////////////////////////
38 |
39 | namespace processExit {
40 | enum reason { noReason=0,
41 | serviceShutdown, unresponsive, abnormalExit, lostIO, runawayChild,
42 | maxRequests, excessProcesses, idleTimeout, acceptFailed,
43 | maxReasonCount };
44 | }
45 |
46 | #endif
47 |
--------------------------------------------------------------------------------
/include/serviceAttributes.h:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright (c) 2010, Yahoo! Inc. All rights reserved.
3 |
4 | Redistribution and use of this software in source and binary forms, with or
5 | without modification, are permitted provided that the following conditions are
6 | met:
7 |
8 | * Redistributions of source code must retain the above copyright notice, this
9 | list of conditions and the following disclaimer.
10 |
11 | * Redistributions in binary form must reproduce the above copyright notice,
12 | this list of conditions and the following disclaimer in the documentation and/or
13 | other materials provided with the distribution.
14 |
15 | * Neither the name of Yahoo! Inc. nor the names of its contributors may be used
16 | to endorse or promote products derived from this software without specific prior
17 | written permission of Yahoo! Inc.
18 |
19 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
20 | ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
21 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
22 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
23 | ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
24 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
25 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
26 | ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
27 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
28 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29 | */
30 |
31 | #ifndef P_SERVICE_ATTRIBUTES_H
32 | #define P_SERVICE_ATTRIBUTES_H
33 |
34 | namespace pluton {
35 | class serviceAttributes {
36 | public:
37 | static const int insideLinuxJVM = 1;
38 | };
39 | }
40 |
41 | #endif
42 |
43 |
--------------------------------------------------------------------------------
/include/stdintWrapper.h:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright (c) 2010, Yahoo! Inc. All rights reserved.
3 |
4 | Redistribution and use of this software in source and binary forms, with or
5 | without modification, are permitted provided that the following conditions are
6 | met:
7 |
8 | * Redistributions of source code must retain the above copyright notice, this
9 | list of conditions and the following disclaimer.
10 |
11 | * Redistributions in binary form must reproduce the above copyright notice,
12 | this list of conditions and the following disclaimer in the documentation and/or
13 | other materials provided with the distribution.
14 |
15 | * Neither the name of Yahoo! Inc. nor the names of its contributors may be used
16 | to endorse or promote products derived from this software without specific prior
17 | written permission of Yahoo! Inc.
18 |
19 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
20 | ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
21 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
22 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
23 | ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
24 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
25 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
26 | ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
27 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
28 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29 | */
30 |
31 | #ifndef P_STDINTWRAPPER_H
32 | #define P_STDINTWRAPPER_H
33 |
34 | //////////////////////////////////////////////////////////////////////
35 | // Encapsulate OS differences for the include that defines fixed sized
36 | // types such as uint32_t.
37 | //////////////////////////////////////////////////////////////////////
38 |
39 | #if defined(__FreeBSD__) && (__FreeBSD__ < 6)
40 | #include
41 | #else
42 | #include
43 | #endif
44 |
45 | #endif
46 |
--------------------------------------------------------------------------------
/include/streambufWrapper.h:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright (c) 2010, Yahoo! Inc. All rights reserved.
3 |
4 | Redistribution and use of this software in source and binary forms, with or
5 | without modification, are permitted provided that the following conditions are
6 | met:
7 |
8 | * Redistributions of source code must retain the above copyright notice, this
9 | list of conditions and the following disclaimer.
10 |
11 | * Redistributions in binary form must reproduce the above copyright notice,
12 | this list of conditions and the following disclaimer in the documentation and/or
13 | other materials provided with the distribution.
14 |
15 | * Neither the name of Yahoo! Inc. nor the names of its contributors may be used
16 | to endorse or promote products derived from this software without specific prior
17 | written permission of Yahoo! Inc.
18 |
19 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
20 | ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
21 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
22 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
23 | ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
24 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
25 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
26 | ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
27 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
28 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29 | */
30 |
31 | #ifndef P_STREAMBUFWRAPPER_H
32 | #define P_STREAMBUFWRAPPER_H
33 |
34 | //////////////////////////////////////////////////////////////////////
35 | // Because this code has to work on new and legacy systems, some of
36 | // the OS dependent stuff - particularly STL related - is moved to a
37 | // seperate module so that #ifdef testing doesn't proliferate.
38 | //////////////////////////////////////////////////////////////////////
39 |
40 | #if defined(__FreeBSD__) && (__FreeBSD__ < 6)
41 | #include
42 | #else
43 | #include
44 | #endif
45 |
46 | #endif
47 |
--------------------------------------------------------------------------------
/manager/Makefile.am:
--------------------------------------------------------------------------------
1 | AM_CPPFLAGS = -I$(top_srcdir)/include @WARN_CXXFLAGS@ @STATETHREADS_CFLAGS@
2 | LDADD = @STATETHREADS_LIBS@ \
3 | $(top_builddir)/clientServiceLibrary/libpluton.la \
4 | $(top_builddir)/commonLibrary/libcommon.a
5 | bin_PROGRAMS = plutonManager
6 |
7 | plutonManager_SOURCES = plutonManager.cc bitmask.cc calibrateProcesses.cc commandPort.cc \
8 | configParser.cc debug.cc listenBacklog.cc listenInterface.cc loadConfigurations.cc \
9 | logging.cc manager.cc periodicReports.cc pidMap.cc process.cc service.cc \
10 | shmLookupWriter.cc shmServiceWriter.cc startProcess.cc startService.cc threadedObject.cc
11 |
--------------------------------------------------------------------------------
/manager/bitmask.h:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright (c) 2010, Yahoo! Inc. All rights reserved.
3 |
4 | Redistribution and use of this software in source and binary forms, with or
5 | without modification, are permitted provided that the following conditions are
6 | met:
7 |
8 | * Redistributions of source code must retain the above copyright notice, this
9 | list of conditions and the following disclaimer.
10 |
11 | * Redistributions in binary form must reproduce the above copyright notice,
12 | this list of conditions and the following disclaimer in the documentation and/or
13 | other materials provided with the distribution.
14 |
15 | * Neither the name of Yahoo! Inc. nor the names of its contributors may be used
16 | to endorse or promote products derived from this software without specific prior
17 | written permission of Yahoo! Inc.
18 |
19 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
20 | ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
21 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
22 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
23 | ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
24 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
25 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
26 | ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
27 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
28 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29 | */
30 |
31 | #ifndef P_BITMASK_H
32 | #define P_BITMASK_H 1
33 |
34 | class bitmask {
35 | public:
36 | bitmask() : bits(0) {};
37 | void set(unsigned int newBit) { bits |= newBit; }
38 | void clear(unsigned int newBit) { bits &= ~newBit; }
39 | bool isSet(unsigned int newBit) const { return bits & newBit; }
40 | bool isAny() const { return bits != 0; }
41 |
42 | typedef struct {
43 | const char* name;
44 | unsigned int bitNumber;
45 | } nameBitMap;
46 |
47 | bool setByName(const char *, nameBitMap*);
48 | bool clearByName(const char *, nameBitMap*);
49 |
50 | private:
51 | unsigned long bits;
52 | };
53 |
54 | #endif
55 |
--------------------------------------------------------------------------------
/manager/listenBacklog.cc:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright (c) 2010, Yahoo! Inc. All rights reserved.
3 |
4 | Redistribution and use of this software in source and binary forms, with or
5 | without modification, are permitted provided that the following conditions are
6 | met:
7 |
8 | * Redistributions of source code must retain the above copyright notice, this
9 | list of conditions and the following disclaimer.
10 |
11 | * Redistributions in binary form must reproduce the above copyright notice,
12 | this list of conditions and the following disclaimer in the documentation and/or
13 | other materials provided with the distribution.
14 |
15 | * Neither the name of Yahoo! Inc. nor the names of its contributors may be used
16 | to endorse or promote products derived from this software without specific prior
17 | written permission of Yahoo! Inc.
18 |
19 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
20 | ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
21 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
22 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
23 | ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
24 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
25 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
26 | ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
27 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
28 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29 | */
30 |
31 | #if defined(__linux__)
32 | #include "listenBacklog_st.cc"
33 |
34 | #elif defined(__FreeBSD__)
35 | #include "listenBacklog_kqueue.cc"
36 |
37 | #elif defined(__APPLE__)
38 | #include "listenBacklog_kqueue.cc"
39 |
40 | #else
41 | #include "listenBacklog_st.cc"
42 | #endif
43 |
--------------------------------------------------------------------------------
/manager/pidMap.h:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright (c) 2010, Yahoo! Inc. All rights reserved.
3 |
4 | Redistribution and use of this software in source and binary forms, with or
5 | without modification, are permitted provided that the following conditions are
6 | met:
7 |
8 | * Redistributions of source code must retain the above copyright notice, this
9 | list of conditions and the following disclaimer.
10 |
11 | * Redistributions in binary form must reproduce the above copyright notice,
12 | this list of conditions and the following disclaimer in the documentation and/or
13 | other materials provided with the distribution.
14 |
15 | * Neither the name of Yahoo! Inc. nor the names of its contributors may be used
16 | to endorse or promote products derived from this software without specific prior
17 | written permission of Yahoo! Inc.
18 |
19 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
20 | ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
21 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
22 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
23 | ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
24 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
25 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
26 | ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
27 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
28 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29 | */
30 |
31 | #ifndef P_PIDMAP_H
32 | #define P_PIDMAP_H 1
33 |
34 | //////////////////////////////////////////////////////////////////////
35 | // Track pid to process mappings so that the child reaper can find the
36 | // associated process.
37 | //////////////////////////////////////////////////////////////////////
38 |
39 | #include
40 |
41 | class process;
42 |
43 |
44 | class pidMap {
45 | public:
46 | static void reapChildren(const char* who);
47 |
48 | static bool add(pid_t pid, process* sp);
49 | static void remove(pid_t pid);
50 | static process* find(pid_t);
51 | };
52 |
53 | #endif
54 |
--------------------------------------------------------------------------------
/regressionTests/hup_manager:
--------------------------------------------------------------------------------
1 | #! /bin/sh
2 |
3 | kill -HUP `cat data/manager.pid` 2>/dev/null 1>&2
4 |
5 |
6 |
--------------------------------------------------------------------------------
/regressionTests/start_manager:
--------------------------------------------------------------------------------
1 | #! /bin/sh
2 |
3 | options=$*
4 | [ -z "$rgMANAGEROut" ] && exit 8
5 | [ -z "$rgMANAGERErr" ] && exit 9
6 |
7 | killall -9 plutonManager 2>/dev/null 1>&2
8 | ./start_manager_wrapper $options >$rgMANAGEROut 2>$rgMANAGERErr &
9 |
10 | for ticktock in 1 2 3 4 5 6 7 8 9 10
11 | do
12 | grep -q 'Manager ready:' $rgMANAGEROut && exit 0
13 | grep -q 'FATAL:' $rgMANAGEROut && exit 1
14 | sleep 1
15 | done
16 |
--------------------------------------------------------------------------------
/regressionTests/start_manager_wrapper:
--------------------------------------------------------------------------------
1 | #! /bin/sh
2 |
3 | echo Starting Manager at `pwd`
4 | echo CMDLine=$*
5 |
6 | $rgBinPath/plutonManager $* &
7 | pid=$!
8 | echo $pid >data/manager.pid
9 |
10 | wait
11 | echo Manager Exit Status for $pid: $?
12 |
--------------------------------------------------------------------------------
/regressionTests/stop_manager:
--------------------------------------------------------------------------------
1 | #! /bin/sh
2 |
3 | kill `cat data/manager.pid` 2>/dev/null 1>&2
4 |
5 | printf "stop_manager ..."
6 | for ticktock in 1 2 3 4 5 6 7 8 9 10
7 | do
8 | kill -0 `cat data/manager.pid` 2>/dev/null 1>&2
9 | if [ $? != 0 ]; then
10 | echo `cat data/manager.pid` is gone $?
11 | exit 0
12 | fi
13 | sleep 1
14 | printf "."
15 | done
16 | echo ' force -9'
17 | kill -9 `cat data/manager.pid` 2>/dev/null 1>&2
18 |
19 |
--------------------------------------------------------------------------------
/regressionTests/t.05.misc/rateLimit.sh:
--------------------------------------------------------------------------------
1 | #! /bin/sh
2 |
3 | $rgTestPath/tRateLimit
4 |
--------------------------------------------------------------------------------
/regressionTests/t.05.misc/shmAlign.sh:
--------------------------------------------------------------------------------
1 | #! /bin/sh
2 |
3 | $rgTestPath/shmAlign
4 |
5 |
--------------------------------------------------------------------------------
/regressionTests/t.05.misc/shmservice.sh:
--------------------------------------------------------------------------------
1 | #! /bin/sh
2 |
3 | $rgTestPath/tShmService
4 |
--------------------------------------------------------------------------------
/regressionTests/t.10.netstrings/encapsulated.sh:
--------------------------------------------------------------------------------
1 | #! /bin/sh
2 |
3 | $rgTestPath/tNetStringGenerateEncapsulated
4 |
--------------------------------------------------------------------------------
/regressionTests/t.10.netstrings/factory.sh:
--------------------------------------------------------------------------------
1 | #! /bin/sh
2 |
3 | $rgTestPath/tNetStringFactory <$1/nsfactory.data
4 |
--------------------------------------------------------------------------------
/regressionTests/t.10.netstrings/generate.sh:
--------------------------------------------------------------------------------
1 | #! /bin/sh
2 |
3 | $rgTestPath/tNetStringGenerate
4 |
--------------------------------------------------------------------------------
/regressionTests/t.10.netstrings/managed.sh:
--------------------------------------------------------------------------------
1 | #! /bin/sh
2 |
3 | $rgTestPath/tNetStringFactoryManaged <$1/nsfactorymanaged.data
4 |
--------------------------------------------------------------------------------
/regressionTests/t.10.netstrings/nsfactory.data:
--------------------------------------------------------------------------------
1 | # 1a Simple two-part slurp
2 |
3 | 1a1 20 2Aa 0 0 20 . .
4 | 1a2 0 a, 0 3 17 A aa
5 |
6 | # 1b multipart slurp of single chars
7 |
8 | 1b1 20 3 0 0 20 . .
9 | 1b2 0 B 0 1 19 . .
10 | 1b3 0 b 0 2 18 . .
11 | 1b4 0 b 0 3 17 . .
12 | 1b5 0 b 0 4 16 . .
13 | 1b6 0 , 0 5 15 B bbb
14 |
15 | # 1c multipart slurp of multiple characters
16 |
17 | 1c1 20 3 0 0 20 . .
18 | 1c2 0 Cccc, 0 1 19 C ccc
19 |
20 | # 1d Single slurp
21 |
22 | 1d1 20 4Ddddd, 0 0 20 D dddd
23 |
--------------------------------------------------------------------------------
/regressionTests/t.10.netstrings/nsfactorymanaged.data:
--------------------------------------------------------------------------------
1 | # ID Prealloc readdata maxToRead NSType NSValue
2 | # 1a Simple two-part slurp
3 |
4 | 1a 20 2Aa 3 . .
5 | 1b 0 a, 2 A aa
6 |
7 | # 1b multipart slurp of single chars
8 |
9 | 2a 20 3 3 . .
10 | 2b 0 B 5 . .
11 | 2c 0 b 4 . .
12 | 2d 0 b 3 . .
13 | 2e 0 b 2 . .
14 | 2e 0 , 1 B bbb
15 |
16 | # 1c multipart slurp of multiple characters
17 |
18 | 3a 20 3 3 . .
19 | 3b 0 Cccc, 5 C ccc
20 |
21 | # 1d Single slurp
22 |
23 | 4a 20 4Ddddd, 3 D dddd
24 |
25 | # 2 Grow the Managed factory
26 |
27 | 5a 20 80affffffffff 3 . .
28 | 5b 0 fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffa, 3 a fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffa
29 |
30 | 6a 0 100bgggggggggg 3 . .
31 | 6b 0 gggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggh, 3 b gggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggh
32 |
33 | # 7 Force a relocation internal to netStringFactory
34 |
35 | 7a 10 3aAAA,11B 3 a AAA
36 | 7b 0 a 1 . .
37 | 7c 0 bbbbbbbbbc, 1 B abbbbbbbbbc
38 |
--------------------------------------------------------------------------------
/regressionTests/t.15.tools/echoConfig/system.echo.0.raw:
--------------------------------------------------------------------------------
1 | exec platform-services/echo
2 |
--------------------------------------------------------------------------------
/regressionTests/t.15.tools/ping1.sh:
--------------------------------------------------------------------------------
1 | #! /bin/sh
2 |
3 | good=/tmp/goodlookup.map
4 | ./start_manager -C $1/echoConfig -R/tmp -L$good -lservice -lprocess
5 |
6 | $rgBinPath/plPing -KoN -c4 -L$good -i0
7 |
8 | res=$?
9 | ./stop_manager
10 |
11 | exit $res
12 |
--------------------------------------------------------------------------------
/regressionTests/t.20.commandline/badRendezvous.sh:
--------------------------------------------------------------------------------
1 | #! /bin/sh
2 |
3 | # Fail due to not being able to write to rendezvous
4 |
5 | ./start_manager -C . -R /dev -L/tmp/lookup.map
6 | res=$?
7 | ./stop_manager
8 |
9 | [ $res -eq 0 ] && exit 1
10 | exit 0
11 |
--------------------------------------------------------------------------------
/regressionTests/t.20.commandline/commandPort1.sh:
--------------------------------------------------------------------------------
1 | #! /bin/sh
2 |
3 | # Command port fail due to priviledged
4 |
5 | ./start_manager -L/tmp/lookup.map -c localhost:22
6 | ./stop_manager
7 |
8 | grep -q 'Warning: Cannot open Command Port' $rgMANAGEROut || exit 1
9 |
10 | exit 0
11 |
--------------------------------------------------------------------------------
/regressionTests/t.20.commandline/commandPort2.sh:
--------------------------------------------------------------------------------
1 | #! /bin/sh
2 |
3 | # Command port listening
4 |
5 | ./start_manager -L/tmp/lookup.map -c 127.0.0.1:9991
6 |
7 | netstat -an | grep LISTEN | grep 127.0.0.1.9991
8 | res=$?
9 |
10 | ./stop_manager
11 |
12 | exit $res
13 |
14 |
--------------------------------------------------------------------------------
/regressionTests/t.20.commandline/goodRendezvous.sh:
--------------------------------------------------------------------------------
1 | #! /bin/sh
2 |
3 | # Make sure relative RV is set to real
4 |
5 | rm -f /tmp/lookup.map
6 | ./start_manager -L/tmp/lookup.map -C . -R.
7 | ./stop_manager
8 |
9 | rp=`grep 'Manager Rendezvous realpath' $rgMANAGEROut |cut -d' ' -f4`
10 |
11 | echo Real Path returned = $rp
12 | echo Current Path = `pwd -P`
13 |
14 | [ "$rp" = `pwd -P` ] && exit 0
15 |
16 | exit 1
17 |
--------------------------------------------------------------------------------
/regressionTests/t.20.commandline/noConfig.sh:
--------------------------------------------------------------------------------
1 | #! /bin/sh
2 |
3 | # Fail due to no config directory
4 |
5 | ./start_manager -L/tmp/lookup.map -C nothere
6 | res=$?
7 | ./stop_manager
8 |
9 | [ $res -eq 0 ] && exit 1
10 | exit 0
11 |
--------------------------------------------------------------------------------
/regressionTests/t.20.commandline/noLookup.sh:
--------------------------------------------------------------------------------
1 | #! /bin/sh
2 |
3 | # Fail due to no lookupmap Path
4 |
5 | ./start_manager -C . -L nopath/ffff
6 | res=$?
7 | ./stop_manager
8 |
9 | [ $res -eq 0 ] && exit 1
10 | exit 0
11 |
--------------------------------------------------------------------------------
/regressionTests/t.20.commandline/noRendezvous.sh:
--------------------------------------------------------------------------------
1 | #! /bin/sh
2 |
3 | # Fail due to no rendezvous directory
4 |
5 | ./start_manager -L/tmp/lookup.map -C . -R nopath
6 | res=$?
7 | ./stop_manager
8 |
9 | [ $res -eq 0 ] && exit 1
10 | exit 0
11 |
--------------------------------------------------------------------------------
/regressionTests/t.25.bugs/1412403.conf/system.echo.0.raw:
--------------------------------------------------------------------------------
1 | exec platform-services/echo
2 |
--------------------------------------------------------------------------------
/regressionTests/t.25.bugs/1412403.sh:
--------------------------------------------------------------------------------
1 | #! /bin/sh
2 |
3 | echo Bug 1412403
4 |
5 | # [ bug 1412403 ] A service reload can mis-count remaining processes
6 |
7 | lup=/tmp/lookup.map
8 | conf=$1/1412403.conf
9 | echo conf = $conf
10 |
11 | ./start_manager -L $lup -C $conf -R/tmp -lall
12 |
13 | echo Manager started
14 | date
15 | sleep 2
16 |
17 | # Make sure the service is active by pinging it
18 |
19 | $rgBinPath/plPing -L $lup -c1 -Cecho.sleepMS=40000 -t 1
20 | res=$?
21 | if [ $res -ne 0 ]; then
22 | echo Initial ping failed - giving up
23 | ./stop_manager
24 | exit 1
25 | fi
26 |
27 | # Now change the config and cause a reload
28 |
29 | touch $conf/*
30 |
31 | ./hup_manager
32 |
33 | sleep 2
34 |
35 | # Ping again to get the new service
36 |
37 | $rgBinPath/plPing -L $lup -c1
38 | res=$?
39 | if [ $res -ne 0 ]; then
40 | ./stop_manager
41 | exit 2
42 | fi
43 |
44 | ./stop_manager
45 |
46 | # Count how many times the manager started. One is good, more than one is bad
47 |
48 | rp=`grep 'Manager ready' $rgMANAGEROut |wc -l`
49 |
50 | [ $rp -ne 1 ] && exit 3
51 |
52 | grep -q 'Segmentation fault' $rgMANAGEROut && exit 4
53 |
54 | grep -q 'Final Objects: Map=0 Services=0 Process=0 Children=0 Zombies=0' $rgMANAGEROut && exit 0
55 |
56 | exit 5
57 |
--------------------------------------------------------------------------------
/regressionTests/t.25.bugs/1448050.conf/system.echo.0.raw:
--------------------------------------------------------------------------------
1 | exec platform-services/echo
2 |
--------------------------------------------------------------------------------
/regressionTests/t.25.bugs/1448050.sh:
--------------------------------------------------------------------------------
1 | #! /bin/sh
2 |
3 | echo Bug 1448050
4 |
5 | # [ bug 1448050 ] Truncated data returned from service on certain size boundaries
6 |
7 | pwd
8 | testDir=$1
9 | testFile=$testDir/1448050.testfile
10 |
11 | lup=/tmp/lookup.map
12 | conf=$testDir/1448050.conf
13 | ./start_manager -L $lup -C $conf -R/tmp -lall
14 |
15 | $rgBinPath/plSend -L $lup <$testFile >$rgData/1448050.result system.echo.0.raw
16 | res=$?
17 |
18 | ./stop_manager
19 |
20 | if [ $res != 0 ]; then
21 | echo plSend Failed
22 | exit $res
23 | fi
24 |
25 | echo cmp -s $testFile $rgData/1448050.result
26 | cmp -s $testFile $rgData/1448050.result
27 |
28 | if [ $? != 0 ]; then
29 | echo compare fails
30 | exit 1
31 | fi
32 |
33 |
--------------------------------------------------------------------------------
/regressionTests/t.25.bugs/1552859.conf/system.echo.0.raw:
--------------------------------------------------------------------------------
1 | exec platform-services/echo
2 |
--------------------------------------------------------------------------------
/regressionTests/t.25.bugs/1552859.sh:
--------------------------------------------------------------------------------
1 | #! /bin/sh
2 |
3 | echo Bug 1552859
4 |
5 | # [ bug 1552859 ] "Mutex lock" not cleared on waitAndSend() when request queue is empty
6 |
7 | pwd
8 |
9 | lup=/tmp/lookup.map
10 | conf=$1/1552859.conf
11 | ./start_manager -L $lup -C $conf -R/tmp -lall
12 |
13 | $rgTestPath/bug1552859 $lup
14 | res=$?
15 |
16 | ./stop_manager
17 |
18 | if [ $res != 0 ]; then
19 | echo bug1552859 Failed
20 | exit $res
21 | fi
22 |
23 | exit 0
24 |
25 |
--------------------------------------------------------------------------------
/regressionTests/t.25.bugs/2179686.conf/system.echo.0.raw:
--------------------------------------------------------------------------------
1 | exec platform-services/echo
2 | unresponsive-timeout 5
3 | maximum-processes 1
4 |
--------------------------------------------------------------------------------
/regressionTests/t.25.bugs/2179686.sh:
--------------------------------------------------------------------------------
1 | #! /bin/sh
2 |
3 | echo Bug 2179686
4 |
5 | # [ bug 2179686 ] The unresponsive-timeout config parameter doesn't work
6 |
7 | lup=/tmp/lookup.map
8 | conf=$1/2179686.conf
9 | echo conf = $conf
10 |
11 | ./start_manager -L $lup -C $conf -R/tmp -lall -dprocess
12 |
13 | echo Make sure the service is active by pinging it
14 | $rgBinPath/plPing -L $lup -c1 -t1
15 | res=$?
16 | echo First ping exit code $res
17 | if [ $res -ne 0 ]; then
18 | ./stop_manager
19 | exit 1
20 | fi
21 |
22 | echo Now make plPing sleep for longer than the unresponsive-timeout value
23 |
24 | date
25 | $rgBinPath/plPing -L $lup -c1 -t1 -C10000
26 | res=$?
27 | sleep 3 # Make sure manager notices before we shut it down
28 | date
29 | echo Results from second ping is $res
30 | if [ $res -eq 0 ]; then
31 | ./stop_manager
32 | exit 2
33 | fi
34 |
35 | sleep 10
36 | echo Make sure the service is active by pinging it
37 | $rgBinPath/plPing -L $lup -c1 -t1
38 | res=$?
39 | echo Results from third ping is $res
40 | if [ $res -ne 0 ]; then
41 | ./stop_manager
42 | exit 3
43 | fi
44 |
45 | ./stop_manager
46 |
47 | echo Check that the manager noticed and killed the service.
48 |
49 | grep -q 'unresponsive' $rgMANAGEROut && exit 0
50 |
51 | exit 5
52 |
53 |
--------------------------------------------------------------------------------
/regressionTests/t.25.bugs/2499645.conf/system.echo.0.raw:
--------------------------------------------------------------------------------
1 | exec platform-services/echo
2 | maximum-processes 1
3 | unresponsive-timeout 40
4 |
--------------------------------------------------------------------------------
/regressionTests/t.25.bugs/2499645a.sh:
--------------------------------------------------------------------------------
1 | #! /bin/sh
2 |
3 | echo Bug 2499645a
4 |
5 | # [ bug 2499645 ] Service stall on shutdown with request pending
6 |
7 | # To create this scenario:
8 | #
9 | # 1. Service must wedge between sendResponse() and getRequest()
10 | #
11 | # 2. Client must send a request with a large timeout so that it sits
12 | # on the accept queue for the duration of the Manager orderly
13 | # shutdown limit.
14 | #
15 | # 3. Shutdown Manager and see if it exists prior to the end of the client
16 | # request.
17 | #
18 | # The fix is for the manager to give up after a certain time.
19 |
20 | lup=/tmp/lookup.map
21 | conf=$1/2499645.conf
22 | echo conf = $conf
23 |
24 | ./start_manager -L $lup -C $conf -R/tmp -lall
25 |
26 | echo Manager started
27 | date
28 | sleep 2
29 |
30 | # Get the service to wedge after the next request
31 |
32 | $rgBinPath/plSend -L $lup -Cecho.sleepAfter=35 -Cecho.log=1 system.echo.0.raw ""
33 | res=$?
34 | if [ $res -ne 0 ]; then
35 | echo Initial ping failed - giving up. ec=$res
36 | ./stop_manager
37 | exit 1
38 | fi
39 |
40 | $rgBinPath/plSend -L $lup -t35 -Cecho.log=1 system.echo.0.raw "" &
41 | pingPid=$!
42 |
43 | if [ $res -ne 0 ]; then
44 | echo Wedge ping failed - giving up. ec=$res
45 | ./stop_manager
46 | kill $pingPid
47 | exit 2
48 | fi
49 |
50 | ./term_manager
51 | sleep 33 # Manager default emergency exit is 30 seconds
52 |
53 | ee=`grep 'Emergency Exit' $rgMANAGEROut |wc -l`
54 |
55 | [ $ee -ne 1 ] && exit 3
56 |
57 | wait $pingPid
58 |
59 | exit 0
60 |
--------------------------------------------------------------------------------
/regressionTests/t.25.bugs/2499645b.sh:
--------------------------------------------------------------------------------
1 | #! /bin/sh
2 |
3 | echo Bug 2499645b
4 |
5 | # [ bug 2499645 ] unresponsiveness test not working if service wedged after response
6 | # but before request
7 | # To create this scenario:
8 | #
9 | # 1. Service must wedge between sendResponse() and getRequest()
10 | #
11 | # The fix is to disassociate the response timers from the "ready to
12 | # accept" flag in shm.
13 |
14 | lup=/tmp/lookup.map
15 | conf=$1/2499645.conf
16 | echo conf = $conf
17 |
18 | ./start_manager -L $lup -C $conf -R/tmp -lall
19 |
20 | echo Manager started
21 | date
22 | sleep 2
23 |
24 | # Get the service to wedge on this request for longer than unresponsive-timeout
25 |
26 |
27 | $rgBinPath/plSend -L $lup -Cecho.sleepMS=10000 -t15 -Cecho.sleepAfter=55 -Cecho.log=1 system.echo.0.raw ""
28 | res=$?
29 | if [ $res -ne 0 ]; then
30 | echo Initial ping failed - giving up. ec=$res
31 | ./stop_manager
32 | exit 1
33 | fi
34 |
35 | sleep 60 # Wait for unresponseness to be detected by the Manager
36 |
37 | echo `date` Stopping Manager
38 | ./stop_manager
39 |
40 | echo `date` Checking logs
41 |
42 | ee=`grep 'unresponsive' $rgMANAGEROut |wc -l`
43 |
44 | [ $ee -ne 1 ] && exit 3
45 |
46 | wait $pingPid
47 |
48 | exit 0
49 |
--------------------------------------------------------------------------------
/regressionTests/t.25.bugs/2997358.conf/system.echo.0.raw:
--------------------------------------------------------------------------------
1 | exec platform-services/echo
2 |
--------------------------------------------------------------------------------
/regressionTests/t.25.bugs/2997358.sh:
--------------------------------------------------------------------------------
1 | #! /bin/sh
2 |
3 | bug=2997358
4 | echo Bug $bug
5 |
6 | # [ bug 2997358 ] clientRequest::reset() needs to reset internal state
7 |
8 | lup=/tmp/lookup.map
9 | conf=$1/$bug.conf
10 | echo conf = $conf
11 |
12 | ./start_manager -L $lup -C $conf -R/tmp -lall
13 |
14 | $rgTestPath/tClientReset $lup
15 | res=$?
16 | ./stop_manager
17 |
18 | exit $res
19 |
--------------------------------------------------------------------------------
/regressionTests/t.30.config/allErrors.sh:
--------------------------------------------------------------------------------
1 | #! /bin/sh
2 |
3 | # Test every config error
4 |
5 | ./start_manager -L/tmp/lookup.map -C $1/allErrorsConfig -R/tmp -lservice
6 | ./stop_manager
7 |
8 | grep 'Invalid boolean' $rgMANAGEROut || exit 1
9 | grep 'Invalid multiplier' $rgMANAGEROut || exit 2
10 | grep 'Invalid number' $rgMANAGEROut || exit 3
11 | grep 'Duplicate parameter' $rgMANAGEROut || exit 4
12 | grep 'Multiplier causes overflow' $rgMANAGEROut || exit 5
13 | grep 'Unknown configuration parameter' $rgMANAGEROut || exit 6
14 | grep 'must not be less than lower limit' $rgMANAGEROut || exit 7
15 | grep 'must not be greater than upper limit' $rgMANAGEROut || exit 8
16 | grep 'minimum-processes must not be greater than maximum-processes' $rgMANAGEROut || exit 9
17 | grep "Must include an 'exec'" $rgMANAGEROut || exit 10
18 | grep 'serialization type is unrecognized' $rgMANAGEROut || exit 11
19 | grep 'Config Warning: Ignoring file' $rgMANAGEROut || exit 12
20 |
21 | # Make sure we didn't miss any
22 |
23 | ec=`grep 'Config Error:' $rgMANAGEROut|wc -l`
24 | [ $ec -ne 11 ] && exit `expr 100 + $ec` # Communicate count back to failure tester
25 |
26 | exit 0
27 |
--------------------------------------------------------------------------------
/regressionTests/t.30.config/allErrorsConfig/badbool.param.0.raw:
--------------------------------------------------------------------------------
1 | exec /bin/echo
2 | prestart-processes truU
3 |
--------------------------------------------------------------------------------
/regressionTests/t.30.config/allErrorsConfig/badmultiplier.param.0.raw:
--------------------------------------------------------------------------------
1 | # X is not a valid multipler - try K, M or G
2 |
3 | exec /bin/echo
4 | maximum-processes 13X
5 |
--------------------------------------------------------------------------------
/regressionTests/t.30.config/allErrorsConfig/badnumber.param.0.raw:
--------------------------------------------------------------------------------
1 | exec /bin/echo
2 | maximum-processes xxx
3 |
--------------------------------------------------------------------------------
/regressionTests/t.30.config/allErrorsConfig/badtype.param.0.yoo:
--------------------------------------------------------------------------------
1 | # "yoo" is not a valid serialization type
2 |
3 | exec /bin/echo
4 |
--------------------------------------------------------------------------------
/regressionTests/t.30.config/allErrorsConfig/duplicate.param.0.raw:
--------------------------------------------------------------------------------
1 | exec /bin/echo
2 | exec /bin/echo
3 |
4 |
--------------------------------------------------------------------------------
/regressionTests/t.30.config/allErrorsConfig/greaterthan.param.0.raw:
--------------------------------------------------------------------------------
1 | # below minimum value allowed
2 |
3 | exec /bin/echo
4 | affinity-timeout 601
5 |
--------------------------------------------------------------------------------
/regressionTests/t.30.config/allErrorsConfig/invalid.type:
--------------------------------------------------------------------------------
1 | exec /bin/echo
2 |
--------------------------------------------------------------------------------
/regressionTests/t.30.config/allErrorsConfig/lessthan.param.0.raw:
--------------------------------------------------------------------------------
1 | # below minimum value allowed
2 |
3 | exec /bin/echo
4 | affinity-timeout 5
5 |
--------------------------------------------------------------------------------
/regressionTests/t.30.config/allErrorsConfig/minimumgreater.param.0.raw:
--------------------------------------------------------------------------------
1 | # minimum cannot be greater than maximum
2 |
3 | exec /bin/echo
4 | maximum-processes 100
5 | minimum-processes 200
6 |
--------------------------------------------------------------------------------
/regressionTests/t.30.config/allErrorsConfig/multiplieroverflow.param.0.raw:
--------------------------------------------------------------------------------
1 | exec /bin/echo
2 | maximum-processes 9999999MMM
3 |
4 |
--------------------------------------------------------------------------------
/regressionTests/t.30.config/allErrorsConfig/noexec.param.0.raw:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/YahooArchive/Pluton/82bbab17c0013d87063b398ec777d5977f353d0a/regressionTests/t.30.config/allErrorsConfig/noexec.param.0.raw
--------------------------------------------------------------------------------
/regressionTests/t.30.config/allErrorsConfig/processgtcc.param.0.raw:
--------------------------------------------------------------------------------
1 | # unknown parameter maximum-occupancy
2 |
3 | exec /bin/echo
4 | maximum-processes 40
5 | maximum-occupancy 20
6 |
7 |
--------------------------------------------------------------------------------
/regressionTests/t.30.config/allErrorsConfig/unknown.param.0.raw:
--------------------------------------------------------------------------------
1 | exex /bin/echo
2 |
--------------------------------------------------------------------------------
/regressionTests/t.30.config/allNoErrors.sh:
--------------------------------------------------------------------------------
1 | #! /bin/sh
2 |
3 | # Test every config parameter without error
4 |
5 | ./start_manager -L/tmp/lookup.map -C $1/allNoErrorsConfig -R/tmp -lservice
6 | ./stop_manager
7 |
8 | grep 'New=19' $rgMANAGEROut || exit 1
9 | grep 'Service Error:' $rgMANAGEROut && exit 1
10 |
11 | exit 0
12 |
--------------------------------------------------------------------------------
/regressionTests/t.30.config/allNoErrorsConfig/cd.good.0.raw:
--------------------------------------------------------------------------------
1 | cd
2 | exec /bin/echo
3 |
--------------------------------------------------------------------------------
/regressionTests/t.30.config/allNoErrorsConfig/enable-leak-ramping.good.0.raw:
--------------------------------------------------------------------------------
1 | enable-leak-ramping true
2 | exec /bin/echo
3 |
--------------------------------------------------------------------------------
/regressionTests/t.30.config/allNoErrorsConfig/exec-failure-backoff.good.0.raw:
--------------------------------------------------------------------------------
1 | exec-failure-backoff 60 # If fork/exec is failure - throttle for x seconds
2 | exec /bin/echo
3 |
--------------------------------------------------------------------------------
/regressionTests/t.30.config/allNoErrorsConfig/exec.good.0.raw:
--------------------------------------------------------------------------------
1 | exec /usr/local/bin/echo
2 |
--------------------------------------------------------------------------------
/regressionTests/t.30.config/allNoErrorsConfig/exit.good.0.raw:
--------------------------------------------------------------------------------
1 | exit 0
2 | exec /bin/echo
3 |
--------------------------------------------------------------------------------
/regressionTests/t.30.config/allNoErrorsConfig/idle-timeout.good.0.raw:
--------------------------------------------------------------------------------
1 | idle-timeout 600 # Drop below minimum-spare if idle for this long
2 | exec /bin/echo
3 |
--------------------------------------------------------------------------------
/regressionTests/t.30.config/allNoErrorsConfig/maximum-processes.good.0.raw:
--------------------------------------------------------------------------------
1 | maximum-processes 10
2 | exec /bin/echo
3 |
--------------------------------------------------------------------------------
/regressionTests/t.30.config/allNoErrorsConfig/maximum-requests.good.0.raw:
--------------------------------------------------------------------------------
1 | maximum-requests 1000
2 | exec /bin/echo
3 |
--------------------------------------------------------------------------------
/regressionTests/t.30.config/allNoErrorsConfig/maximum-retries.good.0.raw:
--------------------------------------------------------------------------------
1 | maximum-retries 1 # Re-queue a request to another service
2 | exec /bin/echo
3 |
--------------------------------------------------------------------------------
/regressionTests/t.30.config/allNoErrorsConfig/maximum-threads.good.0.raw:
--------------------------------------------------------------------------------
1 | maximum-threads 1
2 | exec /bin/echo
3 |
--------------------------------------------------------------------------------
/regressionTests/t.30.config/allNoErrorsConfig/minimum-processes.good.0.raw:
--------------------------------------------------------------------------------
1 | minimum-processes 0
2 | exec /bin/echo
3 |
--------------------------------------------------------------------------------
/regressionTests/t.30.config/allNoErrorsConfig/occupancy-percent.good.0.raw:
--------------------------------------------------------------------------------
1 | occupancy-percent 50
2 | exec /bin/echo
3 |
--------------------------------------------------------------------------------
/regressionTests/t.30.config/allNoErrorsConfig/prestart-processes.good.0.raw:
--------------------------------------------------------------------------------
1 | prestart-processes false
2 | exec /bin/echo
3 |
--------------------------------------------------------------------------------
/regressionTests/t.30.config/allNoErrorsConfig/recorder-cycle.good.0.raw:
--------------------------------------------------------------------------------
1 | recorder-cycle 0
2 | exec /bin/echo
3 |
--------------------------------------------------------------------------------
/regressionTests/t.30.config/allNoErrorsConfig/recorder-prefix.good.0.raw:
--------------------------------------------------------------------------------
1 | recorder-prefix record.
2 | exec /bin/echo
3 |
--------------------------------------------------------------------------------
/regressionTests/t.30.config/allNoErrorsConfig/ulimit-cpu-milliseconds.good.0.raw:
--------------------------------------------------------------------------------
1 | ulimit-cpu-milliseconds 0 # per request amortized across maximumRequests
2 | exec /bin/echo
3 |
--------------------------------------------------------------------------------
/regressionTests/t.30.config/allNoErrorsConfig/ulimit-data-memory.good.0.raw:
--------------------------------------------------------------------------------
1 | ulimit-data-memory 0M # if zero, don't apply
2 | exec /bin/echo
3 |
--------------------------------------------------------------------------------
/regressionTests/t.30.config/allNoErrorsConfig/ulimit-open-files.good.0.raw:
--------------------------------------------------------------------------------
1 | ulimit-open-files 0
2 | exec /bin/echo
3 |
--------------------------------------------------------------------------------
/regressionTests/t.30.config/allNoErrorsConfig/unresponsive-timeout.good.0.raw:
--------------------------------------------------------------------------------
1 | unresponsive-timeout 10 # seconds
2 | exec /bin/echo
3 |
--------------------------------------------------------------------------------
/regressionTests/t.30.config/oneConfig/one.config.0.raw:
--------------------------------------------------------------------------------
1 | exec /bin/echo
2 |
--------------------------------------------------------------------------------
/regressionTests/t.30.config/oneEntry.sh:
--------------------------------------------------------------------------------
1 | #! /bin/sh
2 |
3 | # One service configured
4 |
5 | ./start_manager -L/tmp/lookup.map -C $1/oneConfig -lservice -R/tmp
6 | ./stop_manager
7 |
8 | grep 'Config Scan Complete: New=1 Retained=0 Replaced=0' $rgMANAGEROut
9 |
--------------------------------------------------------------------------------
/regressionTests/t.30.config/replace.sh:
--------------------------------------------------------------------------------
1 | #! /bin/sh
2 |
3 | # Test for replaced and new configs discovered
4 |
5 | mv -f $1/replaceConfig/three.config.0.raw $1/replaceConfig/three.config.0.notvalid
6 |
7 | ./start_manager -L/tmp/lookup.map -C $1/replaceConfig -lservice -R/tmp
8 | touch $1/replaceConfig/one.config.0.raw
9 | mv -f $1/replaceConfig/three.config.0.notvalid $1/replaceConfig/three.config.0.raw
10 | ./hup_manager
11 | sleep 1
12 | ./stop_manager
13 |
14 | grep 'Config Scan Complete: New=1 Retained=1 Replaced=1' $rgMANAGEROut
15 |
--------------------------------------------------------------------------------
/regressionTests/t.30.config/replaceConfig/one.config.0.raw:
--------------------------------------------------------------------------------
1 | exec /bin/echo
2 |
--------------------------------------------------------------------------------
/regressionTests/t.30.config/replaceConfig/three.config.0.raw:
--------------------------------------------------------------------------------
1 | exec /bin/echo
2 |
--------------------------------------------------------------------------------
/regressionTests/t.30.config/replaceConfig/two.config.0.raw:
--------------------------------------------------------------------------------
1 | exec /bin/echo
2 |
--------------------------------------------------------------------------------
/regressionTests/t.30.config/warningConfig/exec-warning.good.0.raw:
--------------------------------------------------------------------------------
1 | exec /bin/echo
2 | exec-failure-backoff 0
3 |
--------------------------------------------------------------------------------
/regressionTests/t.30.config/warningConfig/ignore.this.txt:
--------------------------------------------------------------------------------
1 | Not a service key format filename
2 |
--------------------------------------------------------------------------------
/regressionTests/t.30.config/warnings.sh:
--------------------------------------------------------------------------------
1 | #! /bin/sh
2 |
3 | # Generate every config warning
4 |
5 | # Have to create a bad symlink on the fly as CVS won't check it in
6 |
7 | rm -f $1/warningConfig/bad-stat.good.0.raw
8 | ln -s /dev/null/not/here $1/warningConfig/bad-stat.good.0.raw
9 |
10 | ./start_manager -L/tmp/lookup.map -C $1/warningConfig -R/tmp -lservice
11 | ./stop_manager
12 |
13 | grep 'Ignoring file' $rgMANAGEROut || exit 1
14 | grep 'Cannot stat' $rgMANAGEROut || exit 3
15 | grep 'Zero exec-failure-backoff' $rgMANAGEROut || exit 2
16 |
17 | # Make sure we didn't miss any
18 |
19 | ec=`grep 'Config Warning:' $rgMANAGEROut|grep -v 'Ignoring file' | wc -l`
20 | [ $ec -ne 2 ] && exit `expr 100 + $ec` # Communicate count back to failure tester
21 |
22 | exit 0
23 |
--------------------------------------------------------------------------------
/regressionTests/t.30.config/zeroConfig/README:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/YahooArchive/Pluton/82bbab17c0013d87063b398ec777d5977f353d0a/regressionTests/t.30.config/zeroConfig/README
--------------------------------------------------------------------------------
/regressionTests/t.30.config/zeroEntries.sh:
--------------------------------------------------------------------------------
1 | #! /bin/sh
2 |
3 | # Zero services configured
4 |
5 | ./start_manager -L/tmp/lookup.map -C $1/zeroConfig -lservice -R/tmp
6 | ./stop_manager
7 |
8 | grep 'Config Scan Complete: New=0 Retained=0 Replaced=0' $rgMANAGEROut
9 |
--------------------------------------------------------------------------------
/regressionTests/t.35.lookup/bad.sh:
--------------------------------------------------------------------------------
1 | #! /bin/sh
2 |
3 | good=/tmp/goodlookup.map
4 | ./start_manager -C $1/config -R/tmp -L$good -lservice -lprocess
5 |
6 | # Most of the serviceKey tests are actually done in tClientErrors.cc
7 | # so this is somewhat redundant.
8 |
9 | failed=0
10 | for k in normal normal. normal.func1 normal.func1. \
11 | normal.func1.1.COBO normal.func1.1.COB normal.func1.1.CO normal.func1.1.C \
12 | norma.func1.1.COBOL normal.func.1.COBOL normal.unc1.1.COBOL normal.func1.1.OBOL
13 | do
14 | $rgBinPath/plPing -c1 -L$good $k
15 | if [ $? = 0 ]; then
16 | echo Lookup of $k unexpectedly worked
17 | failed=1
18 | fi
19 | done
20 |
21 | for s in COBOL HTML JMS JSON NETSTRING PHP SOAP XML raw badserial
22 | do
23 | k=normal.func1.2.$s
24 | $rgBinPath/plPing -c1 -L$good $k
25 | if [ $? = 0 ]; then
26 | echo Lookup of $k unexpectedly worked
27 | failed=1
28 | fi
29 |
30 | k=twild.func1.2.$s
31 | $rgBinPath/plPing -c1 -L$good $k
32 | if [ $? = 0 ]; then
33 | echo Lookup of $k unexpectedly worked
34 | failed=1
35 | fi
36 |
37 | k=twild.func51f.2.$s
38 | $rgBinPath/plPing -c1 -L$good $k
39 | if [ $? = 0 ]; then
40 | echo Lookup of $k unexpectedly worked
41 | failed=1
42 | fi
43 | done
44 |
45 | ./stop_manager
46 |
47 | exit $failed
48 |
--------------------------------------------------------------------------------
/regressionTests/t.35.lookup/config/normal.func1.1.COBOL:
--------------------------------------------------------------------------------
1 | exec platform-services/echo
2 |
--------------------------------------------------------------------------------
/regressionTests/t.35.lookup/config/normal.func1.1.HTML:
--------------------------------------------------------------------------------
1 | exec platform-services/echo
2 |
--------------------------------------------------------------------------------
/regressionTests/t.35.lookup/config/normal.func1.1.JMS:
--------------------------------------------------------------------------------
1 | exec platform-services/echo
2 |
--------------------------------------------------------------------------------
/regressionTests/t.35.lookup/config/normal.func1.1.JSON:
--------------------------------------------------------------------------------
1 | exec platform-services/echo
2 |
--------------------------------------------------------------------------------
/regressionTests/t.35.lookup/config/normal.func1.1.NETSTRING:
--------------------------------------------------------------------------------
1 | exec platform-services/echo
2 |
--------------------------------------------------------------------------------
/regressionTests/t.35.lookup/config/normal.func1.1.PHP:
--------------------------------------------------------------------------------
1 | exec platform-services/echo
2 |
--------------------------------------------------------------------------------
/regressionTests/t.35.lookup/config/normal.func1.1.SOAP:
--------------------------------------------------------------------------------
1 | exec platform-services/echo
2 |
--------------------------------------------------------------------------------
/regressionTests/t.35.lookup/config/normal.func1.1.XML:
--------------------------------------------------------------------------------
1 | exec platform-services/echo
2 |
--------------------------------------------------------------------------------
/regressionTests/t.35.lookup/config/normal.func1.1.raw:
--------------------------------------------------------------------------------
1 | exec platform-services/echo
2 |
--------------------------------------------------------------------------------
/regressionTests/t.35.lookup/config/twild..1.COBOL:
--------------------------------------------------------------------------------
1 | exec platform-services/echo
2 |
--------------------------------------------------------------------------------
/regressionTests/t.35.lookup/config/twild..1.HTML:
--------------------------------------------------------------------------------
1 | exec platform-services/echo
2 |
--------------------------------------------------------------------------------
/regressionTests/t.35.lookup/config/twild..1.JMS:
--------------------------------------------------------------------------------
1 | exec platform-services/echo
2 |
--------------------------------------------------------------------------------
/regressionTests/t.35.lookup/config/twild..1.JSON:
--------------------------------------------------------------------------------
1 | exec platform-services/echo
2 |
--------------------------------------------------------------------------------
/regressionTests/t.35.lookup/config/twild..1.NETSTRING:
--------------------------------------------------------------------------------
1 | exec platform-services/echo
2 |
--------------------------------------------------------------------------------
/regressionTests/t.35.lookup/config/twild..1.PHP:
--------------------------------------------------------------------------------
1 | exec platform-services/echo
2 |
--------------------------------------------------------------------------------
/regressionTests/t.35.lookup/config/twild..1.SOAP:
--------------------------------------------------------------------------------
1 | exec platform-services/echo
2 |
--------------------------------------------------------------------------------
/regressionTests/t.35.lookup/config/twild..1.XML:
--------------------------------------------------------------------------------
1 | exec platform-services/echo
2 |
--------------------------------------------------------------------------------
/regressionTests/t.35.lookup/config/twild..1.raw:
--------------------------------------------------------------------------------
1 | exec platform-services/echo
2 |
--------------------------------------------------------------------------------
/regressionTests/t.35.lookup/good.sh:
--------------------------------------------------------------------------------
1 | #! /bin/sh
2 |
3 | good=/tmp/goodlookup.map
4 | ./start_manager -C $1/config -R/tmp -L$good -lservice -lprocess
5 |
6 | failed=0
7 | for s in COBOL HTML JMS JSON NETSTRING PHP SOAP XML raw
8 | do
9 | k=normal.func1.1.$s
10 | $rgBinPath/plPing -c1 -L$good $k
11 | if [ $? != 0 ]; then
12 | echo Lookup of $k failed
13 | failed=1
14 | fi
15 |
16 | k=twild.func1.1.$s
17 | $rgBinPath/plPing -c1 -L$good $k
18 | if [ $? != 0 ]; then
19 | echo Lookup of $k failed
20 | failed=1
21 | fi
22 |
23 | k=twild.func51f.1.$s
24 | $rgBinPath/plPing -c1 -L$good $k
25 | if [ $? != 0 ]; then
26 | echo Lookup of $k failed
27 | failed=1
28 | fi
29 | done
30 |
31 | ./stop_manager
32 |
33 | exit $failed
34 |
--------------------------------------------------------------------------------
/regressionTests/t.40.client/affinity.sh:
--------------------------------------------------------------------------------
1 | #! /bin/sh
2 |
3 | good=/tmp/goodlookup.map
4 | ./start_manager -C $1/echoConfigAffinity -R/tmp -L$good -lservice -lprocess
5 |
6 | $rgTestPath/tClientAffinity $good debug
7 | res=$?
8 | ./stop_manager
9 |
10 | exit $res
11 |
--------------------------------------------------------------------------------
/regressionTests/t.40.client/clientErrors.sh:
--------------------------------------------------------------------------------
1 | #! /bin/sh
2 |
3 | good=/tmp/goodlookup.map
4 | ./start_manager -C $1/echoConfig -R/tmp -L$good
5 |
6 | $rgTestPath/tClientErrors /dev/null $good
7 | res=$?
8 |
9 | ./stop_manager
10 |
11 | exit $res
12 |
--------------------------------------------------------------------------------
/regressionTests/t.40.client/clientFaults.sh:
--------------------------------------------------------------------------------
1 | #! /bin/sh
2 |
3 | good=/tmp/goodlookup.map
4 | ./start_manager -C $1/echoConfig -R/tmp -L$good
5 |
6 | $rgTestPath/tClientFault1 /dev/null $good
7 | res=$?
8 |
9 | ./stop_manager
10 |
11 | exit $res
12 |
--------------------------------------------------------------------------------
/regressionTests/t.40.client/echoConfig/system.echo.0.raw:
--------------------------------------------------------------------------------
1 | exec platform-services/echo
2 | maximum-processes 2
3 | minimum-processes 2
4 | affinity-timeout 10
5 | prestart-processes true
6 |
--------------------------------------------------------------------------------
/regressionTests/t.40.client/echoConfig3/system.echo.0.raw:
--------------------------------------------------------------------------------
1 | exec platform-services/echo
2 | maximum-processes 4
3 | minimum-processes 3
4 | prestart-processes true
5 |
--------------------------------------------------------------------------------
/regressionTests/t.40.client/echoConfigAffinity/system.echo.0.raw:
--------------------------------------------------------------------------------
1 | exec platform-services/echo
2 | maximum-processes 1
3 | minimum-processes 1
4 | affinity-timeout 10
5 | prestart-processes true
6 |
--------------------------------------------------------------------------------
/regressionTests/t.40.client/executeAndWait1.sh:
--------------------------------------------------------------------------------
1 | #! /bin/sh
2 |
3 | good=/tmp/goodlookup.map
4 | ./start_manager -C $1/echoConfig -R/tmp -L$good -lservice -lprocess
5 |
6 | $rgTestPath/tClientExecute1 $good
7 | res=$?
8 | ./stop_manager
9 |
10 | exit $res
11 |
--------------------------------------------------------------------------------
/regressionTests/t.40.client/executeAndWait2.sh:
--------------------------------------------------------------------------------
1 | #! /bin/sh
2 |
3 | good=/tmp/goodlookup.map
4 | ./start_manager -C $1/echoConfig -R/tmp -L$good -lservice -lprocess
5 |
6 | $rgTestPath/tClientExecute2 $good
7 | res=$?
8 | ./stop_manager
9 |
10 | exit $res
11 |
--------------------------------------------------------------------------------
/regressionTests/t.40.client/executeAndWaitBlocked.sh:
--------------------------------------------------------------------------------
1 | #! /bin/sh
2 |
3 | # Not implemented
4 | exit 0
5 |
6 | good=/tmp/goodlookup.map
7 | ./start_manager -C $1/echoConfig -R/tmp -L$good -lservice -lprocess
8 |
9 | $rgTestPath/tClientExecuteBlocked $good
10 | res=$?
11 | ./stop_manager
12 |
13 | exit $res
14 |
--------------------------------------------------------------------------------
/regressionTests/t.40.client/executeBlockedFDs.sh:
--------------------------------------------------------------------------------
1 | #! /bin/sh
2 |
3 | # Not implemented
4 | exit 0
5 |
6 | good=/tmp/goodlookup.map
7 | ./start_manager -C $1/echoConfig -R/tmp -L$good -lservice -lprocess
8 |
9 | $rgTestPath/tClientBlockedFDs $good
10 | res=$?
11 | ./stop_manager
12 |
13 | exit $res
14 |
--------------------------------------------------------------------------------
/regressionTests/t.40.client/faultReturn.sh:
--------------------------------------------------------------------------------
1 | #! /bin/sh
2 |
3 | # Purposely send a bad request to echo to get a fault back
4 |
5 | good=/tmp/goodlookup.map
6 | ./start_manager -C $1/echoConfig -R/tmp -L$good -lservice -lprocess
7 |
8 | $rgBinPath/plSend -L$good -Cecho.sleepMS=-23 system.echo.0.raw ""
9 | res=$?
10 |
11 | echo exit code from plSend is $res
12 |
13 | ./stop_manager
14 |
15 | [ $res -ne 1 ] && exit 1
16 | exit 0
17 |
--------------------------------------------------------------------------------
/regressionTests/t.40.client/inProgress1.sh:
--------------------------------------------------------------------------------
1 | #! /bin/sh
2 |
3 | # Check that the changed semantics of inProgress match the 0.54
4 | # description
5 |
6 | good=/tmp/goodlookup.map
7 | ./start_manager -C $1/echoConfig -R/tmp -L$good -lservice -lprocess
8 |
9 | $rgTestPath/tInProgress $good
10 | res=$?
11 |
12 | ./stop_manager
13 |
14 | exit $res
15 |
16 |
--------------------------------------------------------------------------------
/regressionTests/t.40.client/largeRequests.sh:
--------------------------------------------------------------------------------
1 | #! /bin/sh
2 |
3 | export plutonLookupMap=/tmp/lookup.map
4 | ./start_manager -C $1/echoConfig -R/tmp -L$plutonLookupMap
5 |
6 | failed=
7 | for s in \
8 | 32767 32768 32769 \
9 | 65000 65480 65490 65495 65500 \
10 | 65535 65536 65537 \
11 | 131071 131072 131073 \
12 | 262143 262144 262145 \
13 | 524287 524288 524289 \
14 | 999999 1000000 1000001 \
15 | 1048575 1048576 1048577
16 | do
17 | $rgBinPath/plPing -c3 -i0 -s$s
18 | [ $? -eq 0 ] || failed="$failed $s"
19 | done
20 |
21 | ./stop_manager
22 |
23 | if [ -s "$failed" ]; then
24 | echo Failed : $failed
25 | exit 1
26 | fi
27 |
28 | exit 0
29 |
--------------------------------------------------------------------------------
/regressionTests/t.40.client/partialIO.sh:
--------------------------------------------------------------------------------
1 | #! /bin/sh
2 |
3 | good=/tmp/goodlookup.map
4 | ./start_manager -C $1/singleEchoConfig -R/tmp -L$good
5 |
6 | $rgTestPath/tPartialIO $good
7 | res=$?
8 |
9 | ./stop_manager
10 |
11 | exit $res
12 |
--------------------------------------------------------------------------------
/regressionTests/t.40.client/resourceLeaks.sh:
--------------------------------------------------------------------------------
1 | #! /bin/sh
2 |
3 | good=/tmp/goodlookup.map
4 | ./start_manager -C $1/echoConfig3 -R/tmp -L$good -lservice -lprocess
5 |
6 | ulimit -n 40 # fd limits
7 | ulimit -d 4000 # four MB of memory
8 |
9 | $rgTestPath/tClientResourceLeaks $good
10 | res=$?
11 | ./stop_manager
12 |
13 | exit $res
14 |
--------------------------------------------------------------------------------
/regressionTests/t.40.client/retryConfig/test.retry.0.raw:
--------------------------------------------------------------------------------
1 | exec platform-tests/tRetry
2 | maximum-processes 1
3 |
--------------------------------------------------------------------------------
/regressionTests/t.40.client/retryFail.sh:
--------------------------------------------------------------------------------
1 | #! /bin/sh
2 |
3 | good=/tmp/goodlookup.map
4 | ./start_manager -C $1/retryConfig -R/tmp -L$good -lservice -lprocess
5 |
6 | res=0
7 |
8 | # Tell the service that we want gargage on the next request
9 |
10 | $rgBinPath/plSend -Cgarbage=1 -L$good test.retry.0.raw ""
11 | if [ $? -ne 0 ]; then
12 | echo Exepected good send for garbage did not work
13 | res=1
14 | fi
15 |
16 | # Should get garbage back now
17 |
18 | $rgBinPath/plSend -o -L$good test.retry.0.raw ""
19 | if [ $? -eq 0 ]; then
20 | echo Unexpected good return when wanted garbage
21 | res=1
22 | fi
23 |
24 | # Set up for a sleep return
25 |
26 | $rgBinPath/plSend -Csleep=1 -L$good test.retry.0.raw ""
27 | if [ $? -ne 0 ]; then
28 | echo Exepected good send for sleep did not work
29 | res=1
30 | fi
31 |
32 | # Should time out now
33 |
34 | $rgBinPath/plSend -L$good test.retry.0.raw ""
35 | if [ $? -eq 0 ]; then
36 | echo Unexpected good return when wanted timeout
37 | res=1
38 | fi
39 |
40 | ./stop_manager
41 |
42 | exit $res
43 |
--------------------------------------------------------------------------------
/regressionTests/t.40.client/retryGood.sh:
--------------------------------------------------------------------------------
1 | #! /bin/sh
2 |
3 | good=/tmp/goodlookup.map
4 | ./start_manager -C $1/retryConfig -R/tmp -L$good -lservice -lprocess
5 |
6 | res=0
7 |
8 | # Tell the service that we want garbage on the next request
9 |
10 | $rgBinPath/plSend -Cgarbage=1 -L$good test.retry.0.raw ""
11 | if [ $? -ne 0 ]; then
12 | echo Exepected good send for garbage did not work
13 | res=1
14 | fi
15 |
16 | # Should get garbage on the first attempt and good on the retry
17 |
18 | $rgBinPath/plSend -L$good test.retry.0.raw ""
19 | if [ $? -ne 0 ]; then
20 | echo Unexpected bad return from garbage retry
21 | res=1
22 | fi
23 |
24 | ./stop_manager
25 |
26 | # Doublecheck that garbage was indeed sent to us
27 |
28 | grep -q 'Sending garbage' $rgMANAGEROut || exit 1
29 |
30 | exit $res
31 |
--------------------------------------------------------------------------------
/regressionTests/t.40.client/singleEchoConfig/system.echo.0.raw:
--------------------------------------------------------------------------------
1 | exec platform-services/echo
2 | maximum-processes 1
3 |
--------------------------------------------------------------------------------
/regressionTests/t.40.client/smallRequests.sh:
--------------------------------------------------------------------------------
1 | #! /bin/sh
2 |
3 | export plutonLookupMap=/tmp/lookup.map
4 | ./start_manager -C $1/echoConfig -R/tmp -L$plutonLookupMap
5 |
6 | failed=
7 | for s in 0 1 2 3 4 5 6 10 11 20 100 101 201 202 998 \
8 | 999 1000 1001 1023 1024 1025 \
9 | 1099 2000 2001 2047 2048 2049 \
10 | 3099 4000 4001 4095 4096 4097 \
11 | 8191 8192 8193 \
12 | 16383 16384 16385 \
13 | 32767 32768 32769
14 | do
15 | $rgBinPath/plPing -c1 -s$s
16 | [ $? -eq 0 ] || failed="$failed $s"
17 | done
18 |
19 | ./stop_manager
20 |
21 | if [ -s "$failed" ]; then
22 | echo Failed : $failed
23 | exit 1
24 | fi
25 |
26 | exit 0
27 |
--------------------------------------------------------------------------------
/regressionTests/t.40.client/timeoutReset.sh:
--------------------------------------------------------------------------------
1 | #! /bin/sh
2 |
3 | export plutonLookupMap=/tmp/lookup.map
4 | ./start_manager -C $1/echoConfig -R/tmp -L$plutonLookupMap
5 |
6 | # Check the the perCallerClient timeout is reset when the first request is added
7 | # This is easily tested by running plPing for longer than the timeout.
8 |
9 | failed=
10 | $rgBinPath/plPing -c10 -t5 -L$plutonLookupMap
11 | res=$?
12 |
13 | ./stop_manager
14 |
15 | echo Result: $res
16 | if [ $res -ne 0 ]; then
17 | echo Failed : timeoutReset $res
18 | exit 1
19 | fi
20 |
21 | exit 0
22 |
--------------------------------------------------------------------------------
/regressionTests/t.40.client/waitOneBug.sh:
--------------------------------------------------------------------------------
1 | #! /bin/sh
2 |
3 | export plutonLookupMap=/tmp/lookup.map
4 | ./start_manager -C $1/echoConfig -R/tmp -L$plutonLookupMap
5 |
6 | # ExecuteAndWaitOne() was incorrectly re-constructing the oTodo queue
7 | # when deleting the completed request. Symptoms visible in a multi-add request
8 | # where the request instances are re-used.
9 |
10 | failed=
11 | $rgBinPath/plPing -p4 -c5 -L$plutonLookupMap
12 | res=$?
13 |
14 | ./stop_manager
15 |
16 | echo Result: $res
17 | if [ $res -ne 0 ]; then
18 | echo Failed : waitOneBug still present
19 | exit 1
20 | fi
21 |
22 | exit 0
23 |
--------------------------------------------------------------------------------
/regressionTests/t.42.perlSwig/client1.sh:
--------------------------------------------------------------------------------
1 | #! /bin/sh
2 |
3 | LD_LIBRARY_PATH=$rgTOP/wrappers/perl:$LD_LIBRARY_PATH
4 | PERL5LIB=$rgTOP/wrappers/perl
5 |
6 | export LD_LIBRARY_PATH PERL5LIB
7 |
8 | good=/tmp/goodlookup.map
9 | ./start_manager -C $1/echoConfig -R/tmp -L$good -lservice -lprocess
10 |
11 | $rgTestPath/tPerlSwig1.pl $good
12 | res=$?
13 | ./stop_manager
14 |
15 | exit $res
16 |
--------------------------------------------------------------------------------
/regressionTests/t.42.perlSwig/echoConfig/perl.echo.0.raw:
--------------------------------------------------------------------------------
1 | exec ../tests/tPerlSwig2.pl
2 | maximum-processes 2
3 | minimum-processes 2
4 | affinity-timeout 10
5 | prestart-processes true
6 |
--------------------------------------------------------------------------------
/regressionTests/t.42.perlSwig/echoConfig/system.echo.0.raw:
--------------------------------------------------------------------------------
1 | exec platform-services/echo
2 | maximum-processes 2
3 | minimum-processes 2
4 | affinity-timeout 10
5 | prestart-processes true
6 |
--------------------------------------------------------------------------------
/regressionTests/t.42.perlSwig/service1.sh:
--------------------------------------------------------------------------------
1 | #! /bin/sh
2 |
3 | # Make sure manager inherits these values
4 |
5 | export LD_LIBRARY_PATH=$rgTOP/wrappers/perl:$LD_LIBRARY_PATH
6 | export PERL5LIB=$rgTOP/wrappers/perl
7 |
8 | good=/tmp/goodlookup.map
9 | ./start_manager -C $1/echoConfig -R/tmp -L$good -lservice -lprocess
10 |
11 | $rgBinPath/plSend -L$good perl.echo.0.raw "qwertyu" | grep '7 bytes'
12 | res=$?
13 |
14 | ./stop_manager
15 |
16 | exit $res
17 |
--------------------------------------------------------------------------------
/regressionTests/t.43.C/client1.sh:
--------------------------------------------------------------------------------
1 | #! /bin/sh
2 |
3 | good=/tmp/lookup.map
4 | ./start_manager -C $1/wrapper1Config -R/tmp -L$good -lservice -lprocess
5 |
6 | echo Starting $rgTestPath/tCclient1 with $LD_LIBRARY_PATH
7 |
8 | for d in `echo $LD_LIBRARY_PATH`
9 | do
10 | echo SOs in $d
11 | ls -l $d/*so*
12 | done
13 |
14 | plutonClientDebug=1 $rgTestPath/tCclient1 $good
15 | res=$?
16 |
17 | if [ $res != 0 ]; then
18 | echo C Client 1 failed with $res
19 | exit $res
20 | fi
21 |
22 | ./stop_manager
23 |
24 | exit 0
25 |
--------------------------------------------------------------------------------
/regressionTests/t.43.C/client2.sh:
--------------------------------------------------------------------------------
1 | #! /bin/sh
2 |
3 | good=/tmp/lookup.map
4 | ./start_manager -C $1/wrapper1Config -R/tmp -L$good -lservice -lprocess
5 |
6 | $rgTestPath/tCclient2 $good
7 | res=$?
8 |
9 | if [ $res != 0 ]; then
10 | echo C Client 1 failed with $res
11 | exit $res
12 | fi
13 |
14 | ./stop_manager
15 |
16 | exit 0
17 |
--------------------------------------------------------------------------------
/regressionTests/t.43.C/service1.sh:
--------------------------------------------------------------------------------
1 | #! /bin/sh
2 |
3 | # Make sure manager inherits these values
4 |
5 | failed=0
6 |
7 | good=/tmp/goodlookup.map
8 | ./start_manager -C $1/wrapper1Config -R/tmp -L$good -lservice -lprocess
9 |
10 | echo Output looks like
11 | echo 'vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv'
12 | $rgBinPath/plSend -L$good wrapper.one.0.raw "qwertyu"
13 | echo '^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^'
14 |
15 |
16 | $rgBinPath/plSend -L$good wrapper.one.0.raw "qwertyu" | grep "Request Length = 7"
17 | if [ $? -ne 0 ]; then
18 | echo Error: Expected Request Length of 7
19 | failed=1
20 | fi
21 |
22 | $rgBinPath/plSend -CK12=hello -L$good wrapper.one.0.raw "Cqwertyu" | grep 'Context for K12=hello'
23 | if [ $? -ne 0 ]; then
24 | echo Error: Expected Context K12=hello
25 | failed=1
26 | fi
27 |
28 | $rgBinPath/plSend -L$good wrapper.one.0.raw "qwertyu" | grep 'SK=wrapper.one.0.r and'
29 | if [ $? -ne 0 ]; then
30 | echo Error: Expected Reconstruction of service key failed
31 | failed=1
32 | fi
33 |
34 | ./stop_manager
35 |
36 | exit $failed
37 |
--------------------------------------------------------------------------------
/regressionTests/t.43.C/wrapper1Config/system.echo.0.raw:
--------------------------------------------------------------------------------
1 | exec platform-services/echo
2 | minimum-processes 3
3 | prestart-processes true
4 |
5 |
--------------------------------------------------------------------------------
/regressionTests/t.43.C/wrapper1Config/wrapper.one.0.raw:
--------------------------------------------------------------------------------
1 | exec platform-tests/tCwrapper1
2 | maximum-processes 2
3 | minimum-processes 2
4 | affinity-timeout 10
5 | prestart-processes true
6 |
--------------------------------------------------------------------------------
/regressionTests/t.44.java/client1.sh:
--------------------------------------------------------------------------------
1 | #! /bin/sh
2 |
3 | # Basic client tests
4 |
5 | [ `uname` != "Linux" ] && exit 0
6 |
7 | good=/tmp/lookup.map
8 | ./start_manager -C $1/echoConfig -R/tmp -L$good -lservice -lprocess
9 |
10 | # plutonClientDebug=1
11 | # export plutonClientDebug
12 |
13 | /usr/local/bin/java \
14 | -Djava.library.path=platform-jni \
15 | -cp platform-jar/pluton.jar:$rgTestClasses tJavaClient1 $good
16 |
17 | res=$?
18 | ./stop_manager
19 |
20 | exit $res
21 |
--------------------------------------------------------------------------------
/regressionTests/t.44.java/echoConfig/system.echo.0.raw:
--------------------------------------------------------------------------------
1 | exec platform-services/echo
2 | maximum-processes 20
3 | minimum-processes 3
4 | prestart-processes true
5 |
--------------------------------------------------------------------------------
/regressionTests/t.44.java/echoConfig/system.java.0.raw:
--------------------------------------------------------------------------------
1 | exec /usr/local/bin/java -cp platform-jar/pluton.jar:../tests -Djava.library.path=platform-jni tJavaService0
2 | prestart-processes true
3 | minimum-processes 1
4 |
--------------------------------------------------------------------------------
/regressionTests/t.44.java/echoConfig/system.java.1.raw:
--------------------------------------------------------------------------------
1 | exec /usr/local/bin/java -cp platform-jar/pluton.jar:../tests -Djava.library.path=platform-jni tJavaService1
2 | # exec /usr/local/bin/java -cp ../wrappers/java/pluton.jar:../tests -Djava.library.path=../wrappers/java/jni:../wrappers/C tJavaService1
3 | prestart-processes true
4 | minimum-processes 2
5 |
--------------------------------------------------------------------------------
/regressionTests/t.44.java/service1.sh:
--------------------------------------------------------------------------------
1 | #! /bin/sh
2 |
3 | # Basic service tests
4 |
5 | [ `uname` != "Linux" ] && exit 0
6 |
7 | good=/tmp/lookup.map
8 | ./start_manager -C $1/echoConfig -R/tmp -L$good -lservice -lprocess
9 |
10 | $rgBinPath/plPing -c5 -L$good system.java.0.raw
11 | res=$?
12 |
13 | ./stop_manager
14 |
15 | [ $res -ne 0 ] && exit $res
16 |
17 | exit 0
18 |
--------------------------------------------------------------------------------
/regressionTests/t.44.java/service2.sh:
--------------------------------------------------------------------------------
1 | #! /bin/sh
2 |
3 | # Basic service tests
4 |
5 | [ `uname` != "Linux" ] && exit 0
6 |
7 | JAVA_OPTS=-Djava.library.path=../wrappers/java/jni/i386-rhel4-gcc3
8 | export JAVA_OPTS
9 |
10 | good=/tmp/lookup.map
11 | ./start_manager -C $1/echoConfig -R/tmp -L$good -lservice -lprocess
12 |
13 | $rgBinPath/plPing -c1 -L$good -Cctx=sendfault system.java.1.raw
14 | res1=$?
15 | echo Exit code of plPing is $res1
16 |
17 | grep 'Fault: 123' $rgTESTErr
18 | res2=$?
19 | echo Grep returned $res2
20 |
21 | ./stop_manager
22 |
23 | [ $res1 -ne 1 -a $res2 -ne 0 ] && exit 1
24 |
25 | exit 0
26 |
--------------------------------------------------------------------------------
/regressionTests/t.44.java/thread1.sh:
--------------------------------------------------------------------------------
1 | #! /bin/sh
2 |
3 | # Basic client tests
4 |
5 | [ `uname` != "Linux" ] && exit 0
6 |
7 | good=/tmp/lookup.map
8 | ./start_manager -C $1/echoConfig -R/tmp -L$good -lservice -lprocess
9 |
10 | plutonClientDebug=1 /usr/local/bin/java \
11 | -Djava.library.path=platform-jni \
12 | -cp platform-jar/pluton.jar:$rgTestClasses tJavaThreads1 $good
13 |
14 | res=$?
15 | ./stop_manager
16 |
17 | exit $res
18 |
--------------------------------------------------------------------------------
/regressionTests/t.45.clientProxy/echoConfig/system.echo.0.raw:
--------------------------------------------------------------------------------
1 | exec platform-services/echo
2 | maximum-processes 2
3 | minimum-processes 2
4 | affinity-timeout 10
5 | prestart-processes true
6 |
--------------------------------------------------------------------------------
/regressionTests/t.45.clientProxy/globals1.sh:
--------------------------------------------------------------------------------
1 | #! /bin/sh
2 |
3 | # This is a redundant test - see t.47
4 |
5 | ulimit -c 0
6 | $rgTestPath/tClientGlobals1
7 | res=$?
8 |
9 | [ $res -ne 134 ] && exit 1
10 | grep 'setThreadHandlersNeverCalled == true' $rgTESTErr || exit 2
11 |
12 | exit 0
13 |
--------------------------------------------------------------------------------
/regressionTests/t.45.clientProxy/globals2.sh:
--------------------------------------------------------------------------------
1 | #! /bin/sh
2 |
3 | # This is a redundant test - see t.47
4 |
5 | ulimit -c 0
6 | $rgTestPath/tClientGlobals2
7 | res=$?
8 |
9 | [ $res -ne 134 ] && exit 1
10 | grep 'tooLateToSetThreadHandlers == false' $rgTESTErr || exit 2
11 |
12 | exit 0
13 |
--------------------------------------------------------------------------------
/regressionTests/t.45.clientProxy/pollProxy.sh:
--------------------------------------------------------------------------------
1 | #! /bin/sh
2 |
3 | good=/tmp/goodlookup.map
4 | ./start_manager -C $1/echoConfig -R/tmp -L$good -lservice -lprocess
5 |
6 | $rgTestPath/tClientPollProxy -c20 -p4 -d -L $good
7 | res=$?
8 | ./stop_manager
9 |
10 | exit $res
11 |
--------------------------------------------------------------------------------
/regressionTests/t.45.clientProxy/pollProxyBad.sh:
--------------------------------------------------------------------------------
1 | #! /bin/sh
2 |
3 | good=/tmp/goodlookup.map
4 | ./start_manager -C $1/echoConfig -R/tmp -L$good -lservice -lprocess
5 |
6 | ulimit -c 0
7 | $rgTestPath/tClientPollProxyBad $good
8 | res=$?
9 |
10 | echo Exit with $res
11 |
12 | ./stop_manager
13 |
14 | [ $res -ne 134 ] && exit 1
15 |
16 | exit 0
17 |
--------------------------------------------------------------------------------
/regressionTests/t.46.clientMutex/echoConfig/system.echo.0.raw:
--------------------------------------------------------------------------------
1 | exec platform-services/echo
2 | maximum-processes 20
3 |
--------------------------------------------------------------------------------
/regressionTests/t.46.clientMutex/mutexStateThreads.sh:
--------------------------------------------------------------------------------
1 | #! /bin/sh
2 |
3 | good=/tmp/goodlookup.map
4 | ./start_manager -C $1/echoConfig -R/tmp -L$good -lservice -lprocess
5 |
6 | $rgTestPath/tClientStateThreads $good
7 | res=$?
8 | ./stop_manager
9 |
10 | exit $res
11 |
--------------------------------------------------------------------------------
/regressionTests/t.46.clientMutex/mutexpthreads.sh:
--------------------------------------------------------------------------------
1 | #! /bin/sh
2 |
3 | good=/tmp/goodlookup.map
4 | ./start_manager -C $1/echoConfig -R/tmp -L$good -lservice -lprocess
5 |
6 | $rgTestPath/tClientpthreads $good
7 | res=$?
8 | ./stop_manager
9 |
10 | exit $res
11 |
--------------------------------------------------------------------------------
/regressionTests/t.47.clientThreads/assert1.sh:
--------------------------------------------------------------------------------
1 | #! /bin/sh
2 |
3 | $rgTestPath/tThread3 ss
4 | [ $? -eq 0 ] && exit 1
5 | echo Grepping for assert two
6 | grep 'ssertion `setThreadHandlersNeverCalled == true' $rgTESTErr
7 | res=$?
8 | echo After grep2 = $res
9 | [ $res -ne 0 ] && exit 2
10 |
11 | $rgTestPath/tThread3 cs
12 | echo Grepping for assert three
13 | grep 'ssertion `tooLateToSetThreadHandlers == false' $rgTESTErr
14 | [ $? -ne 0 ] && exit 3
15 |
16 | good=/tmp/goodlookup.map
17 | ./start_manager -C $1/echoConfig -R/tmp -L$good -lservice -lprocess
18 |
19 | $rgTestPath/tThread4 $good
20 |
21 | ./stop_manager
22 |
23 | echo Grepping for assert four
24 | grep 'ssertion `_oneAtATimePerCaller == false' $rgTESTErr
25 | [ $? -ne 0 ] && exit 4
26 |
27 |
28 | good=/tmp/goodlookup.map
29 | ./start_manager -C $1/echoConfig -R/tmp -L$good -lservice -lprocess
30 |
31 | $rgTestPath/tThread5 $good
32 |
33 | ./stop_manager
34 |
35 | echo Grepping for assert five
36 | grep 'ssertion `_pcClient->threadOwnerUnchanged(thread_self' $rgTESTErr
37 | [ $? -ne 0 ] && exit 5
38 |
39 | exit 0
40 |
--------------------------------------------------------------------------------
/regressionTests/t.47.clientThreads/echoConfig/system.echo.0.raw:
--------------------------------------------------------------------------------
1 | exec platform-services/echo
2 | minimum-processes 10
3 | maximum-processes 20
4 | prestart-processes true
5 |
--------------------------------------------------------------------------------
/regressionTests/t.47.clientThreads/posixThread1.sh:
--------------------------------------------------------------------------------
1 | #! /bin/sh
2 |
3 | good=/tmp/goodlookup.map
4 | ./start_manager -C $1/echoConfig -R/tmp -L$good -lservice -lprocess
5 |
6 | $rgTestPath/tThread1 $good
7 | res=$?
8 | ./stop_manager
9 |
10 | exit $res
11 |
--------------------------------------------------------------------------------
/regressionTests/t.47.clientThreads/stThread2.sh:
--------------------------------------------------------------------------------
1 | #! /bin/sh
2 |
3 | good=/tmp/goodlookup.map
4 | ./start_manager -C $1/echoConfig -R/tmp -L$good -lservice -lprocess
5 |
6 | $rgTestPath/tThread2 $good
7 | res=$?
8 | ./stop_manager
9 |
10 | exit $res
11 |
--------------------------------------------------------------------------------
/regressionTests/t.48.clientEvents/config/system.echo.0.raw:
--------------------------------------------------------------------------------
1 | exec platform-services/echo
2 |
--------------------------------------------------------------------------------
/regressionTests/t.48.clientEvents/filter1.sh:
--------------------------------------------------------------------------------
1 | #! /bin/sh
2 |
3 | good=/tmp/goodlookup.map
4 | ./start_manager -C $1/config -R/tmp -L$good -lservice -lprocess
5 |
6 | plutonClientDebug=1 $rgTestPath/tClientEventFilter $good
7 | res=$?
8 | ./stop_manager
9 |
10 | exit $res
11 |
12 |
--------------------------------------------------------------------------------
/regressionTests/t.48.clientEvents/good1.sh:
--------------------------------------------------------------------------------
1 | #! /bin/sh
2 |
3 | good=/tmp/goodlookup.map
4 | ./start_manager -C $1/config -R/tmp -L$good -lservice -lprocess
5 |
6 | plutonClientDebug=1 $rgTestPath/tClientEvent2 $good
7 | res=$?
8 | ./stop_manager
9 |
10 | exit $res
11 |
12 |
--------------------------------------------------------------------------------
/regressionTests/t.50.service/config/nobackoff.exit.0.raw:
--------------------------------------------------------------------------------
1 | exec platform-services/exit
2 | exec-failure-backoff 0
3 |
--------------------------------------------------------------------------------
/regressionTests/t.50.service/config/system.exit.0.raw:
--------------------------------------------------------------------------------
1 | exec platform-services/exit
2 |
--------------------------------------------------------------------------------
/regressionTests/t.50.service/config/test..3.JSON:
--------------------------------------------------------------------------------
1 | exec platform-tests/tService1
2 |
--------------------------------------------------------------------------------
/regressionTests/t.50.service/config/test.service1.3.HTML:
--------------------------------------------------------------------------------
1 | exec platform-tests/tService1
2 |
--------------------------------------------------------------------------------
/regressionTests/t.50.service/getParameters.sh:
--------------------------------------------------------------------------------
1 | #! /bin/sh
2 |
3 | good=/tmp/goodlookup.map
4 | ./start_manager -C $1/config -R/tmp -L$good -lservice -lprocess
5 |
6 | $rgBinPath/plSend -L$good test.service1.3.HTML ''
7 | res1=$?
8 |
9 | $rgBinPath/plSend -L$good test.wildcard.3.JSON ''
10 | res2=$?
11 |
12 | ./stop_manager
13 |
14 | exit `expr $res1 + $res2`
15 |
--------------------------------------------------------------------------------
/regressionTests/t.50.service/serviceExit.sh:
--------------------------------------------------------------------------------
1 | #! /bin/sh
2 |
3 | good=/tmp/goodlookup.map
4 | ./start_manager -C $1/config -R/tmp -L$good -lprocessStart -lprocessExit
5 |
6 | # plutonClientDebug=1 $rgTestPath/tServiceExit $good
7 | $rgTestPath/tServiceExit $good
8 | res1=$?
9 |
10 | ./stop_manager
11 |
12 | [ $res1 -ne 0 ] && exit $res1
13 |
14 | c=`grep 'Process Start: system.exit.0.raw' $rgMANAGEROut | wc -l`
15 | if [ $c -ne 1 ]; then
16 | echo Expected system.exit.0.raw to only be started once, not $c
17 | exit 1
18 | fi
19 |
20 | c=`grep 'Process Start: nobackoff.exit.0.raw' $rgMANAGEROut | wc -l`
21 | if [ $c -ne 2 ]; then
22 | echo Expected nobackoff.exit.0.raw to be started twice, not $c
23 | exit 1
24 | fi
25 |
26 |
27 | exit 0
28 |
--------------------------------------------------------------------------------
/regressionTests/t.60.recorder/configLimit/system.echo.0.raw:
--------------------------------------------------------------------------------
1 | exec platform-services/echo
2 | recorder-prefix ./data/limit.
3 | recorder-cycle 3
4 |
--------------------------------------------------------------------------------
/regressionTests/t.60.recorder/configRecord/system.echo.0.raw:
--------------------------------------------------------------------------------
1 | exec platform-services/echo
2 | recorder-prefix ./data/record.
3 | recorder-cycle 30
4 |
--------------------------------------------------------------------------------
/regressionTests/t.60.recorder/limit.sh:
--------------------------------------------------------------------------------
1 | #! /bin/sh
2 |
3 | # check that the limit to the number of files is honored.
4 |
5 | good=/tmp/goodlookup.map
6 | ./start_manager -C $1/configLimit -R/tmp -L$good -lservice -lprocess
7 |
8 | $rgBinPath/plPing -c20 -i0 -L$good system.echo.0.raw
9 | ./stop_manager
10 |
11 | # test that the files cycle within the limit of 3
12 |
13 | failed=0
14 | wc=`ls $rgData/limit.in.*|wc -l`
15 | echo Input files: $wc
16 |
17 | if [ $wc -ne 3 ]; then
18 | echo Wrong input file cycle of $wc
19 | failed=1
20 | fi
21 |
22 | wc=`ls $rgData/limit.out.*|wc -l`
23 | echo Output Files: $wc
24 |
25 | if [ $wc -ne 3 ]; then
26 | echo Wrong output file cycle of $wc
27 | failed=1
28 | fi
29 |
30 | exit $failed
31 |
--------------------------------------------------------------------------------
/regressionTests/t.60.recorder/record.sh:
--------------------------------------------------------------------------------
1 | #! /bin/sh
2 |
3 | # Check that replaying a request via non-manager mode produces the
4 | # same results.
5 |
6 | good=/tmp/goodlookup.map
7 | ./start_manager -C $1/configRecord -R/tmp -L$good -lservice -lprocess
8 |
9 | # test that recording works
10 | $rgBinPath/plSend -L$good -Cset=context system.echo.0.raw "Test Data" >/dev/null
11 |
12 | $rgBinPath/plPing -L$good -s100 -c1
13 | $rgBinPath/plPing -L$good -s1000 -c1
14 | $rgBinPath/plPing -L$good -s10000 -c1
15 | $rgBinPath/plPing -L$good -s100000 -c1
16 | $rgBinPath/plPing -L$good -s1000000 -c1
17 | $rgBinPath/plPing -L$good -s10000000 -c1
18 |
19 | ./stop_manager
20 |
21 | infile=`echo $rgData/record.in.*.00001`
22 | outfile=`echo $rgData/record.out.*.00001`
23 |
24 | if [ ! -r $infile -o ! -r $outfile ]; then
25 | echo $infile or $outfile not created
26 | exit 1
27 | fi
28 |
29 | # run echo manually to ensure the same output
30 |
31 | for f in 00001 00002 00003 00004 00005 00006 00007
32 | do
33 | in=`echo $rgData/record.in.*.$f`
34 | out=`echo $rgData/record.out.*.$f`
35 | $rgServicesPath/echo 3<$in 4>$rgData/manual.$f
36 | $rgBinPath/plNetStringGrep -v sa <$rgData/manual.$f >$rgData/manual.strip.$f
37 | $rgBinPath/plNetStringGrep -v as <$out >$rgData/out.strip.$f
38 |
39 | if [ ! -s $rgData/manual.strip.$f ]; then
40 | echo Failed: Zero length string: $rgData/manual.strip.$f
41 | failed=1
42 | fi
43 |
44 | cmp -s $rgData/manual.strip.$f $rgData/out.strip.$f
45 | if [ $? -ne 0 ]; then
46 | echo Failed: cmp -s $rgData/manual.strip.$f $rgData/out.strip.$f
47 | failed=1
48 | fi
49 | done
50 |
51 | exit $failed
52 |
--------------------------------------------------------------------------------
/regressionTests/t.70.limits/config/cpu.echo.0.raw:
--------------------------------------------------------------------------------
1 | exec platform-services/cpuLoop
2 | ulimit-cpu-milliseconds 1
3 | maximum-requests 100
4 |
--------------------------------------------------------------------------------
/regressionTests/t.70.limits/config/files.echo.0.raw:
--------------------------------------------------------------------------------
1 | exec platform-services/fopenLoop
2 | ulimit-open-files 30
3 |
--------------------------------------------------------------------------------
/regressionTests/t.70.limits/config/memory.echo.0.raw:
--------------------------------------------------------------------------------
1 | exec platform-services/mallocLoop
2 | ulimit-data-memory 1
3 |
--------------------------------------------------------------------------------
/regressionTests/t.70.limits/cpu.sh:
--------------------------------------------------------------------------------
1 | #! /bin/sh
2 |
3 | echo This is not doing anything yet as ulimit.sh does it all for us
4 |
5 | exit 0
6 |
--------------------------------------------------------------------------------
/regressionTests/t.70.limits/ulimits.sh:
--------------------------------------------------------------------------------
1 | #! /bin/sh
2 |
3 | # check that the various ulimits are honored.
4 |
5 | set -x
6 |
7 | good=/tmp/goodlookup.map
8 | ./start_manager -C $1/config -R/tmp -L$good -lservice -lprocess
9 |
10 | $rgBinPath/plPing -c1 -L$good cpu.echo.0.raw
11 | $rgBinPath/plPing -c1 -L$good files.echo.0.raw
12 | $rgBinPath/plPing -c1 -L$good memory.echo.0.raw
13 |
14 | ./stop_manager
15 |
16 | grep -q 'SIGXCPU' $rgMANAGEROut || exit 1
17 | grep -q 'may have exceeded CPU' $rgMANAGEROut || exit 11
18 | grep -q 'may have exceeded Memory' $rgMANAGEROut || exit 13
19 |
20 | grep -q 'abnormal cpu.echo.0.raw' $rgMANAGEROut || exit 21
21 | grep -q 'abnormal files.echo.0.raw' $rgMANAGEROut || exit 22
22 | grep -q 'abnormal memory.echo.0.raw' $rgMANAGEROut || exit 23
23 |
24 | exit 0
25 |
--------------------------------------------------------------------------------
/regressionTests/t.80.protocol/decode.sh:
--------------------------------------------------------------------------------
1 | #! /bin/sh
2 |
3 | # Test that the packet decoder finds errors
4 |
5 | good='0Q,3b100,12aplPing:26666,17csystem.echo.0.raw,4l5000,0z'
6 | bad1='0G,3b100,12aplPing:26666,17csystem.echo.0.raw,4l5000,0z' # Wrong PT
7 | bad2='0Q,3b1x00,12aplPing:26666,17csystem.echo.0.raw,4l5000,0z' # Malformed
8 | bad3='0Q,3b100,12aplPing:26666,17csystem.echo.0.raw,4l5000,4l5000,0z' # Duplicate
9 | bad4='0Q,999999999993b100,12aplPing:26666,17csystem.echo.0.raw,4l5000,0z' # Large length
10 | bad5='0Q,3b100,12\tplPing:26666,17csystem.echo.0.raw,4l5000,0z' # non-printable type
11 | bad6='xQ,3b100,12aplPing:26666,17csystem.echo.0.raw,4l5000,0z' # Leading must be digit
12 |
13 |
14 | ret=0
15 | echo $good | $rgServicesPath/echo 3<&0 4>/dev/null
16 | if [ $? -ne 0 ]; then
17 | echo Expected acceptance of good packet
18 | ret=1
19 | fi
20 |
21 | printf '%s,' $good | $rgServicesPath/echo 3<&0 4>/dev/null
22 | if [ $? -ne 0 ]; then
23 | echo Expected acceptance of good packet with trailing comma
24 | ret=1
25 | fi
26 |
27 | printf '%sX' $good | $rgServicesPath/echo 3<&0 4>/dev/null
28 | if [ $? -eq 0 ]; then
29 | echo Expected fault with bad terminator
30 | ret=1
31 | fi
32 |
33 | echo $bad1 | $rgServicesPath/echo 3<&0 4>/dev/null
34 | if [ $? -eq 0 ]; then
35 | echo Expected fault with bad1 packet
36 | ret=1
37 | fi
38 |
39 | echo $bad2 | $rgServicesPath/echo 3<&0 4>/dev/null
40 | if [ $? -eq 0 ]; then
41 | echo Expected fault with bad2 packet
42 | ret=1
43 | fi
44 |
45 | echo $bad3 | $rgServicesPath/echo 3<&0 4>/dev/null
46 | if [ $? -eq 0 ]; then
47 | echo Expected fault with bad3 packet
48 | ret=1
49 | fi
50 |
51 | echo $bad4 | $rgServicesPath/echo 3<&0 4>/dev/null
52 | if [ $? -eq 0 ]; then
53 | echo Expected fault with bad4 packet
54 | ret=1
55 | fi
56 |
57 | printf $bad5 | $rgServicesPath/echo 3<&0 4>/dev/null
58 | if [ $? -eq 0 ]; then
59 | echo Expected fault with bad5 packet
60 | ret=1
61 | fi
62 |
63 | echo $bad6 | $rgServicesPath/echo 3<&0 4>/dev/null
64 | if [ $? -eq 0 ]; then
65 | echo Expected fault with bad6 packet
66 | ret=1
67 | fi
68 |
69 | exit $ret
70 |
--------------------------------------------------------------------------------
/regressionTests/t.90.dataExchange/dexFauxSTDIO1.sh:
--------------------------------------------------------------------------------
1 | #! /bin/sh
2 |
3 | # check that the faux data exchanger works
4 |
5 | fn=$rgData/dex.$$
6 |
7 | input1='0Q,3b100,12aplPing:26666,17csystem.echo.0.raw,4l5000,4kabcd,0z'
8 | output1='0A,3b100,12aplPing:26666,'
9 | output2=',4qabcd,0z'
10 | input2='asdhjwer234234adsfsdafwr234234asdfasdfsa junkosville'
11 |
12 | echo $input1 | $rgServicesPath/echo 3<&0 4>$fn.1
13 | if [ $? -ne 0 ]; then
14 | echo Non-zero exit from echo service using FAUX
15 | exit 1
16 | fi
17 |
18 | grep -q $output1 $fn.1 || exit 2
19 | grep -q $output2 $fn.1 || exit 3
20 |
21 | # Now via plTest
22 |
23 | echo $input2 | $rgBinPath/plTest $rgServicesPath/echo >$fn.2 2>/dev/null
24 | grep -q "$input2" $fn.2 || exit 4
25 |
26 | exit 0
27 |
--------------------------------------------------------------------------------
/regressionTests/term_manager:
--------------------------------------------------------------------------------
1 | #! /bin/sh
2 |
3 | kill -TERM `cat data/manager.pid` 2>/dev/null 1>&2
4 |
5 |
6 |
--------------------------------------------------------------------------------
/replace/.deps/dummy.Po:
--------------------------------------------------------------------------------
1 | # dummy
2 |
--------------------------------------------------------------------------------
/replace/Makefile.am:
--------------------------------------------------------------------------------
1 | ## Makefile.am -- Process this file with automake to produce Makefile.in
2 |
3 | AM_CPPFLAGS = -I$(top_builddir) -I$(top_srcdir)
4 |
5 | noinst_LIBRARIES = libreplace.a
6 | libreplace_a_SOURCES = dummy.c
7 | # Later libreplace_a_LIBADD = @LIBOBJS@
8 |
--------------------------------------------------------------------------------
/run_manager.sh:
--------------------------------------------------------------------------------
1 | #! /bin/sh
2 |
3 | set -e
4 |
5 | BINPATH=/usr/local/bin
6 | export BINPATH
7 |
8 | VARPATH=/usr/local/var/pluton
9 | cd $VARPATH
10 |
11 | $BINPATH/plKillOldServices ./rendezvous
12 |
13 | $BINPATH/plutonManager -C ./configuration -L ./lookup.map -R ./rendezvous \
14 | -o \
15 | -c 9990 \
16 | -l serviceConfig \
17 | -l calibrate \
18 | -l processStart -lprocessExit -lprocessLog -lprocessUsage
19 |
--------------------------------------------------------------------------------
/services/Makefile.am:
--------------------------------------------------------------------------------
1 | AM_CPPFLAGS = -I$(top_srcdir)/include @WARN_CXXFLAGS@ -I$(top_srcdir)/clientServiceLibrary
2 | libexec_PROGRAMS = curl_service echo_service
3 | noinst_PROGRAMS = cpuLoop exit fopenLoop loadSimulator mallocLoop
4 | LDADD = $(top_builddir)/clientServiceLibrary/libpluton.la $(top_builddir)/commonLibrary/libcommon.a
5 |
6 | curl_service_SOURCES = curl.cc
7 | curl_service_LDADD = @LIBCURL_LIBS@ $(LDADD)
8 | curl_service_CXXFLAGS = @LIBCURL_CFLAGS@ $(AM_CPPFLAGS)
9 |
10 | echo_service_SOURCES = echo.cc
11 |
12 | # These services are just used for testing purposes
13 |
14 | cpuLoop_SOURCES = cpuLoop.cc
15 |
16 | exit_SOURCES = exit.cc
17 |
18 | fopenLoop_SOURCES = fopenLoop.cc
19 |
20 | loadSimulator_SOURCES = loadSimulator.cc
21 |
22 | mallocLoop_SOURCES = mallocLoop.cc
23 |
--------------------------------------------------------------------------------
/services/cpuLoop.cc:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright (c) 2010, Yahoo! Inc. All rights reserved.
3 |
4 | Redistribution and use of this software in source and binary forms, with or
5 | without modification, are permitted provided that the following conditions are
6 | met:
7 |
8 | * Redistributions of source code must retain the above copyright notice, this
9 | list of conditions and the following disclaimer.
10 |
11 | * Redistributions in binary form must reproduce the above copyright notice,
12 | this list of conditions and the following disclaimer in the documentation and/or
13 | other materials provided with the distribution.
14 |
15 | * Neither the name of Yahoo! Inc. nor the names of its contributors may be used
16 | to endorse or promote products derived from this software without specific prior
17 | written permission of Yahoo! Inc.
18 |
19 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
20 | ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
21 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
22 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
23 | ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
24 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
25 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
26 | ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
27 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
28 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29 | */
30 |
31 | #include
32 |
33 | #include
34 |
35 | #include
36 |
37 | using namespace std;
38 |
39 | int
40 | main(int argc, char** argv)
41 | {
42 | pluton::service S("cpuLoop");
43 |
44 | if (!S.initialize()) {
45 | clog << S.getFault().getMessage("cpuLoop initialize") << std::endl;
46 | exit(1);
47 | }
48 |
49 | while (S.getRequest()) {
50 | while (true);
51 | }
52 |
53 | return(0);
54 | }
55 |
--------------------------------------------------------------------------------
/services/exit.cc:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright (c) 2010, Yahoo! Inc. All rights reserved.
3 |
4 | Redistribution and use of this software in source and binary forms, with or
5 | without modification, are permitted provided that the following conditions are
6 | met:
7 |
8 | * Redistributions of source code must retain the above copyright notice, this
9 | list of conditions and the following disclaimer.
10 |
11 | * Redistributions in binary form must reproduce the above copyright notice,
12 | this list of conditions and the following disclaimer in the documentation and/or
13 | other materials provided with the distribution.
14 |
15 | * Neither the name of Yahoo! Inc. nor the names of its contributors may be used
16 | to endorse or promote products derived from this software without specific prior
17 | written permission of Yahoo! Inc.
18 |
19 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
20 | ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
21 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
22 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
23 | ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
24 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
25 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
26 | ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
27 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
28 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29 | */
30 |
31 | #include
32 | #include
33 |
34 | #include
35 |
36 | using namespace std;
37 |
38 | #include "pluton/service.h"
39 |
40 |
41 | int
42 | main(int argc, char** argv)
43 | {
44 | pluton::service S("exit");
45 |
46 | if (!S.initialize()) {
47 | cerr << "exit: Cannot initialize as a service: " << S.getFault().getMessage() << std::endl;
48 | exit(42);
49 | }
50 |
51 | if (!S.getRequest()) exit(1);
52 | std::string exitCodeStr;
53 | S.getContext("exit.code", exitCodeStr);
54 | int exitCode = atoi(exitCodeStr.c_str());
55 |
56 | exit(exitCode);
57 | }
58 |
--------------------------------------------------------------------------------
/services/fopenLoop.cc:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright (c) 2010, Yahoo! Inc. All rights reserved.
3 |
4 | Redistribution and use of this software in source and binary forms, with or
5 | without modification, are permitted provided that the following conditions are
6 | met:
7 |
8 | * Redistributions of source code must retain the above copyright notice, this
9 | list of conditions and the following disclaimer.
10 |
11 | * Redistributions in binary form must reproduce the above copyright notice,
12 | this list of conditions and the following disclaimer in the documentation and/or
13 | other materials provided with the distribution.
14 |
15 | * Neither the name of Yahoo! Inc. nor the names of its contributors may be used
16 | to endorse or promote products derived from this software without specific prior
17 | written permission of Yahoo! Inc.
18 |
19 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
20 | ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
21 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
22 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
23 | ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
24 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
25 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
26 | ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
27 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
28 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29 | */
30 |
31 | #include
32 |
33 | #include
34 | #include
35 |
36 | #include
37 |
38 | using namespace std;
39 |
40 |
41 | int
42 | main(int argc, char** argv)
43 | {
44 | pluton::service S("fopenLoop");
45 |
46 | if (!S.initialize()) {
47 | clog << S.getFault().getMessage("fopenLoop initialize") << std::endl;
48 | exit(1);
49 | }
50 |
51 | while (S.getRequest()) {
52 |
53 | int fcount = 0;
54 | while (++fcount) {
55 | if (open(".", O_RDONLY, 0) == -1) {
56 | std::cerr << "Opened " << fcount << std::endl;
57 | return(1);
58 | }
59 | }
60 | }
61 |
62 |
63 | return(0);
64 | }
65 |
--------------------------------------------------------------------------------
/services/gdb.sh:
--------------------------------------------------------------------------------
1 | #! /bin/sh
2 |
3 | exec gdb $* /dev/tty 2>/dev/tty
4 |
--------------------------------------------------------------------------------
/services/mallocLoop.cc:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright (c) 2010, Yahoo! Inc. All rights reserved.
3 |
4 | Redistribution and use of this software in source and binary forms, with or
5 | without modification, are permitted provided that the following conditions are
6 | met:
7 |
8 | * Redistributions of source code must retain the above copyright notice, this
9 | list of conditions and the following disclaimer.
10 |
11 | * Redistributions in binary form must reproduce the above copyright notice,
12 | this list of conditions and the following disclaimer in the documentation and/or
13 | other materials provided with the distribution.
14 |
15 | * Neither the name of Yahoo! Inc. nor the names of its contributors may be used
16 | to endorse or promote products derived from this software without specific prior
17 | written permission of Yahoo! Inc.
18 |
19 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
20 | ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
21 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
22 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
23 | ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
24 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
25 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
26 | ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
27 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
28 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29 | */
30 |
31 | #include
32 |
33 | #include
34 | #include
35 |
36 | #include
37 |
38 | using namespace std;
39 |
40 | int
41 | main(int argc, char** argv)
42 | {
43 | pluton::service S("mallocLoop");
44 |
45 | if (!S.initialize()) {
46 | clog << S.getFault().getMessage("mallocLoop initialize") << std::endl;
47 | exit(1);
48 | }
49 |
50 | while (S.getRequest()) {
51 | while (true) {
52 | char* p = new char[1000000]; // 1Meg
53 | if (p) p++; // Shut the compiler up
54 | }
55 | }
56 |
57 | return(0);
58 | }
59 |
--------------------------------------------------------------------------------
/testPrograms/Makefile.am:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/YahooArchive/Pluton/82bbab17c0013d87063b398ec777d5977f353d0a/testPrograms/Makefile.am
--------------------------------------------------------------------------------
/testPrograms/bug1552859.cc:
--------------------------------------------------------------------------------
1 | #include
2 | #include
3 |
4 | #include
5 |
6 | using namespace std;
7 |
8 | #include "pluton/client.h"
9 |
10 | // mutex tests were not comprehensive in clientWrapper
11 |
12 | int
13 | main(int argc, char** argv)
14 | {
15 | const char* map = argv[1];
16 | pluton::client C("t12345");
17 |
18 | cout << C.getAPIVersion() << endl;
19 | if (!C.initialize(map)) {
20 | cout << C.getFault().getMessage("Fatal: pluton::initialize() failed") << endl;
21 | exit(1);
22 | }
23 |
24 | C.executeAndWaitSent();
25 | C.executeAndWaitSent(); // Pre-fix will assert() here
26 |
27 | pluton::clientRequest R1;
28 | C.executeAndWaitOne(R1); // Generates fault
29 |
30 | pluton::clientRequest R2;
31 | C.executeAndWaitOne(R2); // Pre-fix will assert() here
32 |
33 | return 0;
34 | }
35 |
--------------------------------------------------------------------------------
/testPrograms/sampleService.cc:
--------------------------------------------------------------------------------
1 | #include
2 |
3 | #include
4 | #include
5 |
6 | using namespace std;
7 |
8 | #include "pluton/service.h"
9 |
10 | //////////////////////////////////////////////////////////////////////
11 | // This is a sample pluton service that demonstrates the common parts
12 | // of the interface and uses them in various different ways for
13 | // demonstration purposes. This program compiles and runs as a service
14 | // which simply echos the request back to the client with some leading
15 | // text to show that the request was exchanged.
16 | //
17 | // Generally speaking, this is a well-coded pluton service from the
18 | // perspective that it assiduously checks all return codes and logs
19 | // all unexpected results.
20 | //////////////////////////////////////////////////////////////////////
21 |
22 | int
23 | main(int argc, char** argv)
24 | {
25 | pluton::service S("sampleService");
26 |
27 | if (!S.initialize()) {
28 | clog << S.getFault().getMessage("Fatal: initialize() failed in sampleService") << endl;
29 | exit(1);
30 | }
31 |
32 | // Simply iterate on requests
33 |
34 | while (S.getRequest()) {
35 |
36 | string request; // Be in-efficient and slurp the request
37 | S.getRequestData(request); // into a string.
38 |
39 | string response = "testService got: ";
40 | response += request;
41 |
42 | if (!S.sendResponse(response)) {
43 | clog << S.getFault().getMessage("Fatal: sendResponse() failed in sampleService") << endl;
44 | exit(1);
45 | }
46 | }
47 |
48 | //////////////////////////////////////////////////////////////////////
49 | // Check to see if getRequest faulted or we're just being
50 | // told terminated.
51 | //////////////////////////////////////////////////////////////////////
52 |
53 | if (S.hasFault()) {
54 | clog << S.getFault().getMessage("Fatal: getRequest() failed in sampleService") << endl;
55 | exit(2);
56 | }
57 |
58 | return 0; // Cause destructor to be called
59 | }
60 |
--------------------------------------------------------------------------------
/testPrograms/shmAlign.cc:
--------------------------------------------------------------------------------
1 | #include
2 |
3 | #include
4 |
5 | using namespace std;
6 |
7 | #include "shmService.h"
8 |
9 | void
10 | checkSizeOf(const char* name, int sz)
11 | {
12 | if ((sz % 8) != 0) {
13 | std::cerr << "sizeof " << name << " is not 64bit aligned at " << sz << std::endl;
14 | exit(1);
15 | }
16 | }
17 |
18 | void
19 | checkOffsetOf(const char* name, int sz)
20 | {
21 | if ((sz % 8) != 0) {
22 | std::cerr << "offsetof " << name << " is not 64bit aligned at " << sz << std::endl;
23 | exit(1);
24 | }
25 | }
26 |
27 | int
28 | main(int argc, char** argv)
29 | {
30 | checkSizeOf("shmConfig", sizeof(shmConfig));
31 | checkSizeOf("shmTimeVal", sizeof(shmTimeVal));
32 | checkSizeOf("shmThread", sizeof(shmThread));
33 | checkSizeOf("shmProcess", sizeof(shmProcess));
34 | checkSizeOf("shmService", sizeof(shmService));
35 |
36 | checkOffsetOf("shmConfig,_maximumRequests", offsetof(shmConfig,_maximumRequests));
37 | checkOffsetOf("shmConfig,_recorderPrefix", offsetof(shmConfig,_recorderPrefix));
38 |
39 | checkOffsetOf("shmThread,_firstActive", offsetof(shmThread,_firstActive));
40 | checkOffsetOf("shmThread,_lastActive", offsetof(shmThread,_lastActive));
41 | checkOffsetOf("shmThread,_clientRequestStartTime", offsetof(shmThread,_clientRequestStartTime));
42 | checkOffsetOf("shmThread,_clientRequestName", offsetof(shmThread,_clientRequestName));
43 |
44 | checkOffsetOf("shmProcess,_faultCount", offsetof(shmProcess,_faultCount));
45 | checkOffsetOf("shmProcess,_firstActive", offsetof(shmProcess,_firstActive));
46 | checkOffsetOf("shmProcess,_thread", offsetof(shmProcess,_thread));
47 |
48 | checkOffsetOf("shmService,_managerHeartbeat", offsetof(shmService,_managerHeartbeat));
49 | checkOffsetOf("shmService,_config", offsetof(shmService,_config));
50 | checkOffsetOf("shmService,_process", offsetof(shmService,_process));
51 |
52 | exit(0);
53 | }
54 |
55 |
--------------------------------------------------------------------------------
/testPrograms/shmInvalidate.cc:
--------------------------------------------------------------------------------
1 | #include
2 | #include
3 | #include
4 |
5 | #include
6 | #include
7 | #include
8 | #include
9 |
10 | #include "shmLookupPrivate.h"
11 |
12 | using namespace std;
13 |
14 | int
15 | main(int argc, char** argv)
16 | {
17 | int fd = open("lookup.map", O_RDWR, 0644);
18 | if (fd == -1) {
19 | perror("open");
20 | exit(1);
21 | }
22 |
23 | relativeHashMap rhm;
24 | int bytesRead = read(fd, (char*) &rhm, sizeof(rhm));
25 | if (bytesRead != sizeof(rhm)) {
26 | perror("read:truncated");
27 | exit(1);
28 | }
29 |
30 | rhm._remapFlag = 'Y';
31 | if (lseek(fd, 0, 0) != 0) {
32 | perror("lseek");
33 | exit(1);
34 | }
35 |
36 | int bytesWritten = write(fd, (char*) &rhm, sizeof(rhm));
37 | if (bytesWritten != sizeof(rhm)) {
38 | perror("write:truncated");
39 | exit(1);
40 | }
41 |
42 | close(fd);
43 |
44 | exit(0);
45 | }
46 |
--------------------------------------------------------------------------------
/testPrograms/tClientGlobals1.cc:
--------------------------------------------------------------------------------
1 | //////////////////////////////////////////////////////////////////////
2 | // Try and call globals twice
3 | //////////////////////////////////////////////////////////////////////
4 |
5 | #include
6 |
7 | #include "pluton/client.h"
8 |
9 | static pluton::thread_t
10 | my_thread_self(const char* who)
11 | {
12 | return 0;
13 | }
14 |
15 | int
16 | main(int argc, char **argv)
17 | {
18 | pluton::client::setThreadHandlers(my_thread_self);
19 | pluton::client::setThreadHandlers(my_thread_self);
20 |
21 | exit(0);
22 | }
23 |
--------------------------------------------------------------------------------
/testPrograms/tClientGlobals2.cc:
--------------------------------------------------------------------------------
1 | //////////////////////////////////////////////////////////////////////
2 | // Try and call globals after construction of pluton::client
3 | //////////////////////////////////////////////////////////////////////
4 |
5 | #include
6 |
7 | #include "pluton/client.h"
8 |
9 | static pluton::thread_t
10 | my_thread_self(const char* who)
11 | {
12 | return 0;
13 | }
14 |
15 | int
16 | main(int argc, char **argv)
17 | {
18 | pluton::client C("tClientGlobals2");
19 | pluton::client::setThreadHandlers(my_thread_self);
20 |
21 | exit(0);
22 | }
23 |
--------------------------------------------------------------------------------
/testPrograms/tClientPollProxyBad.cc:
--------------------------------------------------------------------------------
1 | //////////////////////////////////////////////////////////////////////
2 | // Purposely fail the protective mutex in clientImpl
3 | //////////////////////////////////////////////////////////////////////
4 |
5 | #include
6 |
7 | #include
8 | #include
9 |
10 | #include
11 |
12 | #include "util.h"
13 | #include "pluton/client.h"
14 |
15 |
16 | using namespace std;
17 |
18 | //////////////////////////////////////////////////////////////////////
19 | // Purposely re-use the same pluton::client against the rules to
20 | // ensure we get an assert() alert.
21 | //////////////////////////////////////////////////////////////////////
22 |
23 | const char* SK = "system.echo.0.raw";
24 |
25 | static void*
26 | pingThread(void* voidC)
27 | {
28 | pluton::client* C = (pluton::client*) voidC;
29 | pluton::clientRequest R;
30 | R.setContext("echo.sleepMS", "1000");
31 | if (!C->addRequest(SK, R)) {
32 | clog << "Fault: " << C->getFault().getMessage("addRequest", true) << endl;
33 | exit(1);
34 | }
35 |
36 | if (C->executeAndWaitOne(R) <= 0) {
37 | clog << "Fault: " << C->getFault().getMessage("executeAndWaitOne", true) << endl;
38 | exit(1);
39 | }
40 |
41 | return 0;
42 | }
43 |
44 | int
45 | main(int argc, char **argv)
46 | {
47 | assert(argc >= 2);
48 |
49 | const char* goodPath = argv[1];
50 |
51 | st_init();
52 | pluton::client C("tClientPollProxyBad");
53 | C.setPollProxy(st_poll);
54 |
55 | if (!C.initialize(goodPath)) {
56 | clog << C.getFault().getMessage("initialize") << endl;
57 | exit(1);
58 | }
59 |
60 | if (argc > 2) C.setDebug(true);
61 |
62 | for (int ix=0; ix < 10; ++ix) {
63 | st_thread_create(pingThread, (void*) &C, 0, 0);
64 | }
65 |
66 | pingThread((void*) &C);
67 |
68 | exit(0);
69 | }
70 |
--------------------------------------------------------------------------------
/testPrograms/tCwrapper1.c:
--------------------------------------------------------------------------------
1 | #include
2 | #include
3 | #include
4 |
5 | #include
6 |
7 | /* Exercise the server-side C wrapper */
8 |
9 | static void
10 | fail(const char* msg)
11 | {
12 | fprintf(stderr, "Failed: %s\n", msg);
13 | if (pluton_service_C_hasFault()) {
14 | fprintf(stderr, "Fault: %d - %s\n", pluton_service_C_getFaultCode(),
15 | pluton_service_C_getFaultMessage("Prefix", 1));
16 | }
17 |
18 | exit(1);
19 | }
20 |
21 | int
22 | main(int argc, char** argv)
23 | {
24 | const char* ptr;
25 | const char* context;
26 | int len;
27 | char response[1000];
28 |
29 | if (!pluton_service_C_initialize()) fail("pluton_service_C_initialize");
30 |
31 | printf("Starting with API Version: %s\n", pluton_service_C_getAPIVersion());
32 |
33 | while (pluton_service_C_getRequest()) {
34 | pluton_service_C_getRequestData(&ptr, &len);
35 |
36 | switch (*ptr) {
37 | case 'F':
38 | pluton_service_C_sendFault(12, "You asked for a fault");
39 | break;
40 |
41 | case 'C':
42 | context = pluton_service_C_getContext("K12");
43 | if (!context) context = "No Context found for K12";
44 | sprintf(response, "Context for K12=%s\n", context);
45 | pluton_service_C_sendResponse(response, strlen(response));
46 | break;
47 |
48 | default:
49 | sprintf(response, "Request Length = %d\n SK=%s.%s.%d.%c and %s\nClient=%s\n",
50 | len,
51 | pluton_service_C_getServiceApplication(),
52 | pluton_service_C_getServiceFunction(),
53 | pluton_service_C_getServiceVersion(),
54 | pluton_service_C_getSerializationType(),
55 | pluton_service_C_getServiceKey(),
56 | pluton_service_C_getClientName());
57 | pluton_service_C_sendResponse(response, strlen(response));
58 | break;
59 | }
60 | }
61 |
62 | if (pluton_service_C_hasFault()) {
63 | fprintf(stderr, "Got a fault %d and %s\n",
64 | pluton_service_C_getFaultCode(),
65 | pluton_service_C_getFaultMessage("My prefix", 1));
66 | }
67 |
68 |
69 | pluton_service_C_terminate();
70 |
71 | exit(0);
72 | }
73 |
--------------------------------------------------------------------------------
/testPrograms/tInProgress.cc:
--------------------------------------------------------------------------------
1 | #include
2 |
3 | #include
4 | #include
5 | #include
6 |
7 | #include
8 |
9 | using namespace std;
10 |
11 | int
12 | main(int argc, char** argv)
13 | {
14 | assert(argc >= 2);
15 |
16 | const char* goodPath = argv[1];
17 |
18 | pluton::client C;
19 |
20 | if (!C.initialize(goodPath)) {
21 | cout << C.getFault().getMessage("initialize unexpectedly failed") << endl;
22 | exit(1);
23 | }
24 |
25 | pluton::clientRequest R1;
26 | if (!C.addRequest("system.echo.0.raw", R1)) {
27 | cout << C.getFault().getMessage("addRequest(R1) unexpectedly failed") << endl;
28 | exit(2);
29 | }
30 |
31 | pluton::clientRequest R2;
32 | R2.setContext("echo.sleepMS", "1100");
33 | if (!C.addRequest("system.echo.0.raw", R2)) {
34 | cout << C.getFault().getMessage("addRequest(R2) unexpectedly failed") << endl;
35 | exit(2);
36 | }
37 |
38 | cout << time(0) << " Starting E&W" << endl;
39 | int res = C.executeAndWaitOne(R2); // Wait for R2, but R1 should finish well first
40 | if (res <= 0) {
41 | cout << C.getFault().getMessage("executeAndWaitOne(R2) unexpectedly failed") << endl;
42 | exit(3);
43 | }
44 | cout << time(0) << " Completed E&W" << endl;
45 |
46 | if (R1.hasFault()) cout << "R1 fault: " << R1.getFaultText() << endl;
47 | if (R2.hasFault()) cout << "R2 fault: " << R2.getFaultText() << endl;
48 |
49 | // inProgress should be false with 0.52 of the library when the
50 | // request is completed.
51 |
52 | if (R1.inProgress()) {
53 | cout << "Error: R1.inProgress() still true!" << endl;
54 | exit(4);
55 | }
56 |
57 | if (R2.inProgress()) {
58 | cout << "Error: R2.inProgress() still true!" << endl;
59 | exit(5);
60 | }
61 | }
62 |
--------------------------------------------------------------------------------
/testPrograms/tJavaService0.java:
--------------------------------------------------------------------------------
1 | import com.yahoo.pluton.Service;
2 |
3 | class tJavaService0 {
4 | public static void main(String[] args) throws Throwable {
5 | System.err.println("Java Test Service Started");
6 | com.yahoo.pluton.Service s = new com.yahoo.pluton.Service("test Java");
7 | System.err.println("Service API Version=" + s.getAPIVersion());
8 | if (s.getAPIVersion().length() == 0) throw new Exception("API Length must be > 0");
9 | s.initialize();
10 | if (s.hasFault()) throw new Error("Unexpected fault setting");
11 | if (s.getFaultCode() != 0) throw new Error("Non-zero fault code");
12 | boolean gotdupe = false;
13 | try {
14 | s.initialize();
15 | }
16 | catch (Exception e) {
17 | System.err.println("Caught dupe init - good");
18 | gotdupe = true;
19 | }
20 |
21 | if (!gotdupe) throw new Error("Duplication initialization not detected");
22 |
23 | if (!s.hasFault()) throw new Error("Unexpected non-fault setting");
24 | if (s.getFaultCode() == 0) throw new Error("Zero fault code");
25 | String str = s.getFaultMessage("A prefix", true);
26 | if (str.length() == 0) throw new Error("FaultMessage is zero length");
27 | System.err.println("Fault message=" + str);
28 |
29 | if (!s.getRequest()) throw new Error("First getRequest failed");
30 |
31 | System.err.println("ServiceKey=" + s.getServiceKey());
32 | System.err.println("ServiceApplication=" + s.getServiceApplication());
33 | System.err.println("ServiceFunction=" + s.getServiceFunction());
34 | int v = s.getServiceVersion();
35 | System.err.println("ServiceVersion=" + v);
36 | System.err.println("SerializationType=" + s.getSerializationType());
37 | System.err.println("ClientName=" + s.getClientName());
38 |
39 | String ctx = s.getContext("ctx");
40 | System.err.println("ctx=" + ctx);
41 |
42 | byte[] r = s.getRequestDataBytes();
43 | s.sendResponseBytes(r);
44 |
45 | while (true) {
46 | System.err.println("Getting next Request");
47 | if (!s.getRequest()) break;
48 | String sr = s.getRequestData();
49 | System.err.println("Have request: " + sr);
50 | s.sendResponse(sr);
51 | }
52 |
53 | System.err.println("Terminating");
54 | s.terminate();
55 | System.err.println("Exiting");
56 | }
57 | }
58 |
--------------------------------------------------------------------------------
/testPrograms/tJavaService1.java:
--------------------------------------------------------------------------------
1 | import com.yahoo.pluton.Service;
2 |
3 | class tJavaService1 {
4 | public static void main(String[] args) throws Throwable {
5 | System.out.println("Java Test Service Started");
6 | com.yahoo.pluton.Service s = new com.yahoo.pluton.Service("fault sender");
7 | s.initialize();
8 |
9 | while (s.getRequest()) {
10 | String r = s.getRequestData();
11 | String ctx = s.getContext("ctx");
12 | System.out.println("ctx=" + ctx);
13 | if (ctx.equals("sendfault")) {
14 | s.sendFault(123, r);
15 | }
16 | else {
17 | s.sendResponse("Expected a context of 'ctx'");
18 | }
19 | }
20 |
21 | s.terminate();
22 | }
23 | }
24 |
--------------------------------------------------------------------------------
/testPrograms/tJavaThreads1.java:
--------------------------------------------------------------------------------
1 | import com.yahoo.pluton.Client;
2 |
3 | public class tJavaThreads1
4 | {
5 | private aThread1 at;
6 | public tJavaThreads1(String name)
7 | {
8 | at = new aThread1(name);
9 | at.start();
10 | }
11 |
12 | public void join() throws InterruptedException
13 | {
14 | at.join();
15 | }
16 |
17 | private class aThread1 extends Thread {
18 | aThread1(String name) {
19 | _name = name;
20 | }
21 |
22 | private String _name;
23 | public void run()
24 | {
25 | System.out.println(_name + " started");
26 | com.yahoo.pluton.Client c = new com.yahoo.pluton.Client();
27 | for(int i=0;i<100;++i) {
28 | com.yahoo.pluton.ClientRequest r = new com.yahoo.pluton.ClientRequest();
29 | r.setRequestData(_name);
30 | c.addRequest("system.echo.0.raw", r);
31 | c.executeAndWaitAll();
32 | String resp = r.getResponseData();
33 | System.out.println("Response for " + _name + " is " + resp);
34 | if (!resp.equals(_name)) {
35 | System.out.println("Unexpected response of " + resp);
36 | }
37 | }
38 | }
39 | }
40 | public static void main(String args[]) throws Throwable
41 | {
42 | tJavaThreads1 t1 = new tJavaThreads1("t1");
43 | tJavaThreads1 t2 = new tJavaThreads1("t2");
44 | tJavaThreads1 t3 = new tJavaThreads1("t3");
45 | tJavaThreads1 t4 = new tJavaThreads1("t4");
46 | tJavaThreads1 t5 = new tJavaThreads1("t5");
47 | tJavaThreads1 t6 = new tJavaThreads1("t6");
48 | tJavaThreads1 t7 = new tJavaThreads1("t7");
49 |
50 | System.out.println("Waiting on t1"); t1.join();
51 | System.out.println("Waiting on t2"); t2.join();
52 | System.out.println("Waiting on t3"); t3.join();
53 | System.out.println("Waiting on t4"); t4.join();
54 | System.out.println("Waiting on t5"); t5.join();
55 | System.out.println("Waiting on t6"); t6.join();
56 | System.out.println("Waiting on t7"); t7.join();
57 | }
58 | }
59 |
--------------------------------------------------------------------------------
/testPrograms/tLineToArgv.cc:
--------------------------------------------------------------------------------
1 | #include
2 |
3 | #include
4 |
5 | using namespace std;
6 |
7 | #include
8 |
9 | #include "lineToArgv.h"
10 |
11 | // Test out lineToArgv.cc
12 |
13 |
14 | static const int maxArgv = 100;
15 |
16 | static void
17 | runit(const char* line, int expectedArgv, const char* errMsg, int newMaxArgv=maxArgv)
18 | {
19 | char buffer[2048];
20 | char* argv[maxArgv];
21 | const char* err;
22 | int argc = util::lineToArgv(line, strlen(line), buffer, argv, newMaxArgv, err);
23 | if (argc != expectedArgv) {
24 | cout << "Error: " << errMsg << ":" << argc;
25 | if (argc < 0) cout << ":" << err;
26 | cout << endl;
27 | cout << "Line: " << line << endl;
28 | }
29 | if (argc <= 0) return;
30 |
31 | for (int ix=0; ix < argc; ++ix) {
32 | cout << ix << ":" << argv[ix] << "< ";
33 | }
34 | cout << endl;
35 | }
36 |
37 | int
38 | main(int realArgc, char** realArgv)
39 | {
40 |
41 | runit("", 0, "1 Empty Line Fails");
42 |
43 | runit("aaaaa", 1, "2 One simple token");
44 |
45 | runit("a bb", 2, "3 Two simple tokens");
46 |
47 | runit(" a bb", 2, "4a Leading whitespace");
48 | runit(" a bb", 2, "4b Leading whitespace");
49 |
50 | runit(" a bb ", 2, "5a Trailing whitespace");
51 | runit(" a bb ", 2, "5b Trailing whitespace");
52 | runit(" a bb ", 2, "5c Trailing whitespace");
53 |
54 | runit("a bb ccc dddd eeeee ffffff ggggggg hhhhhhhh iiiiiiiii", 9, "6a too many args", 9);
55 | runit("a b c d e f g h j k", -17, "6b too many args", 8);
56 | runit("a b c d e f g h j k", -23, "6c too many args", 9);
57 |
58 | runit("a 'bb' \"ccc\" 'dddd' \"eeeee\" ffffff", 6, "7a quotes");
59 | runit("a 'ee\"eee'", 2, "7b quote double quotes");
60 | runit("a \"ee'eee\"", 2, "7c quote single quotes");
61 | runit("'ggggggg'", 1, "7d Ends in single quote");
62 | runit("\"ggggggg\"", 1, "7e Ends in double quote");
63 |
64 | runit("a ee\\\"eee", 2, "8a escape double quote");
65 | runit("a ee\\\'eee", 2, "8b escape single quote");
66 | runit("a ee\\\\eee", 2, "8c escape escape");
67 |
68 | runit("a ' b b' \"c c c \"", 3, "9a white spaced tokens");
69 |
70 | exit(0);
71 | }
72 |
--------------------------------------------------------------------------------
/testPrograms/tPartialIO.cc:
--------------------------------------------------------------------------------
1 | #include
2 |
3 | #include
4 |
5 | #include
6 | #include
7 |
8 | #include
9 |
10 | using namespace std;
11 |
12 | // Force a service to be left in a partially read request state, then
13 | // send a new request to ensure that it resets properly.
14 |
15 |
16 | const char* SK = "system.echo.0.raw";
17 |
18 | int
19 | main(int argc, char** argv)
20 | {
21 | assert(argc == 2);
22 |
23 | const char* goodPath = argv[1];
24 |
25 | int res;
26 | pluton::client C;
27 |
28 | if (!C.initialize(goodPath)) {
29 | cout << "Failed: " << C.getFault().getMessage("Failed: C.initialize()") << endl;
30 | exit(1);
31 | }
32 |
33 | C.setDebug(true);
34 | C.setTimeoutMilliSeconds(1);
35 | pluton::clientRequest R;
36 |
37 | static const int bufSize = 1000 * 1000 * 60; // 60MB ought to timeout after 1MS
38 | char* buf = new char[bufSize];
39 | R.setRequestData(buf, bufSize);
40 |
41 | if (!C.addRequest(SK, R)) {
42 | cout << "Failed Addr 1: " << C.getFault().getMessage("C.addRequest() 1") << endl;
43 | exit(2);
44 | }
45 | res = C.executeAndWaitAll();
46 | if (res != 0) {
47 | cout << "Failed: Expected T/O from executeAndWaitAll: " << res << endl;
48 | exit(3);
49 | }
50 |
51 | // Now do a second request to make sure the service isn't broken
52 |
53 | C.setTimeoutMilliSeconds(4000); // Make the t/o really small
54 | R.setRequestData(buf, 0);
55 |
56 | if (!C.addRequest(SK, R)) {
57 | cout << "Failed: AddR 2: " << C.getFault().getMessage("C.addRequest() 2") << endl;
58 | exit(4);
59 | }
60 | res = C.executeAndWaitAll();
61 | if (res <= 0) {
62 | cout << "Failed: E&W2 " << res << " " << C.getFault().getMessage("executeAndWaitAll") << endl;
63 | exit(5);
64 | }
65 |
66 | if (R.hasFault()) {
67 | cout << "Failed: request Faulted: " << R.getFaultText() << endl;
68 | exit(6);
69 | }
70 |
71 | return(0);
72 | }
73 |
--------------------------------------------------------------------------------
/testPrograms/tPerlSwig2.pl:
--------------------------------------------------------------------------------
1 | #! /usr/bin/perl -w
2 |
3 | use Yahoo::pluton;
4 |
5 | print "Client API: ", Yahoo::pluton::client::getAPIVersion(), "\n";
6 | print "Service API: ", Yahoo::pluton::service::getAPIVersion(), "\n";
7 |
8 | my $s = Yahoo::pluton::service->new("perlservice");
9 | $s->initialize();
10 |
11 | while ($s->getRequest()) {
12 | my $str = $s->getRequestData();
13 | if ($s->hasFault()) {
14 | print STDERR "getRequestData Fault: ", $s->getFault()->getMessage("getRequest"), "\n";
15 | exit(0);
16 | }
17 |
18 | if (length($str) == 0) {
19 | $s->sendFault(1, "Empty request is invalid");
20 | }
21 | else {
22 | my $response = "Your request is " . length($str) . " bytes long";
23 | $s->sendResponse($response);
24 | }
25 | }
26 |
27 | if ($s->hasFault()) {
28 | print STDERR "Service Fault: ", $s->getFault()->getMessage("getRequest"), "\n";
29 | exit(0);
30 | }
31 |
32 | $s->terminate();
33 | exit(0);
34 |
35 |
--------------------------------------------------------------------------------
/testPrograms/tPhpWrapper1.php:
--------------------------------------------------------------------------------
1 | #!/usr/bin/php
2 | initialize();
6 |
7 | $clReq1 = new PlutonClientRequest();
8 | $clReq2 = new PlutonClientRequest();
9 |
10 | $req1 = "1234567890";
11 | $req2 = "qwertyuiop";
12 |
13 | $clReq1->setRequestData($req1);
14 | if(!($pc->addRequest(SERVICE_KEY, $clReq1))) {
15 | print_r("addRequest Error! " . $pc->getFault() . "\n");
16 | exit(-1);
17 | }
18 |
19 | $clReq2->setRequestData($req2);
20 | if(!($pc->addRequest(SERVICE_KEY, $clReq2))) {
21 | print_r("addRequest Error! " . $pc->getFault() . "\n");
22 | exit(-1);
23 | }
24 |
25 | // ExecuteAndWaitALL
26 | $pc->executeAndWaitAll();
27 | if ($pc->hasFault()) {
28 | print_r("Fault! " . $pc->getFault() . "\n");
29 | exit(-1);
30 | }
31 |
32 | $response = '';
33 |
34 | $fault = $clReq1->getResponseData($response);
35 | if ($fault != 0) {
36 | print_r("fault: " . $clReq1->getFaultText() . "\n");
37 | exit(1);
38 | }
39 | if ($response != $req1) {
40 | print_r("Req1 output is not same as input! [$response] vs [$req1]\n");
41 | exit(1);
42 | }
43 |
44 | $fault = $clReq2->getResponseData($response);
45 | if ($fault != 0) {
46 | print_r("fault: " . $clReq2->getFaultText() . "\n");
47 | }
48 | if ($response != $req2) {
49 | print_r("Req2 output is not same as input! [$response] vs [$req2]\n");
50 | exit(1);
51 | }
52 |
53 |
54 | // ExecuteAndWaitAny
55 | $r = $pc->executeAndWaitAny();
56 | if ($pc->hasFault()) {
57 | print_r("[Fault] " . $pc->getFault() . "\n");
58 | exit(-1);
59 | }
60 |
61 | if($r->hasFault()) {
62 | print_r("[fault] " . $r->getFaultText() . "\n");
63 | exit(-1);
64 | }
65 |
66 | $response = "";
67 |
68 | /* Extract the response data */
69 |
70 | $fault = $r->getResponseData($response);
71 | if ($fault != 0) {
72 | print_r("fault: " . $r->getFaultText() . "\n");
73 | }
74 | if ($response != $req2 && $response != $req) {
75 | print_r("Req2 output is not same as input! [$response] vs [$req2] or [$response] vs [$req2]\n");
76 | exit(1);
77 | }
78 |
79 | ?>
80 |
--------------------------------------------------------------------------------
/testPrograms/tRateLimit.cc:
--------------------------------------------------------------------------------
1 | #include
2 |
3 | #include
4 | #include
5 |
6 | #include "rateLimit.h"
7 |
8 | using namespace std;
9 |
10 | int
11 | main()
12 | {
13 | util::rateLimit rl1; // One per second
14 | util::rateLimit rl2(3, 2); // Three in two seconds
15 | util::rateLimit rl3;
16 | util::rateLimit rl4(1, 3); // One in three seconds
17 |
18 | rl3.setRate(7);
19 | rl3.setTimeUnit(3); // Seven in three seconds
20 |
21 | assert(rl1.getRate() == 1);
22 | assert(rl1.getTimeUnit() == 1);
23 |
24 | assert(rl2.getRate() == 3);
25 | assert(rl2.getTimeUnit() == 2);
26 |
27 | assert(rl3.getRate() == 7);
28 | assert(rl3.getTimeUnit() == 3);
29 |
30 | // Tick
31 |
32 | int sec = 0;
33 | assert(rl1.allowed(sec)); // 1
34 | assert(rl2.allowed(sec)); // 1
35 | assert(rl3.allowed(sec)); // 1
36 | assert(rl4.allowed(sec)); // 1
37 |
38 | assert(!rl1.allowed(sec)); // >1
39 | assert(rl2.allowed(sec)); // 2
40 | assert(rl3.allowed(sec)); // 2
41 | assert(!rl4.allowed(sec)); // >1
42 |
43 | assert(!rl1.allowed(sec)); // >1
44 | assert(rl2.allowed(sec)); // 2
45 | assert(rl3.allowed(sec)); // 3
46 | assert(!rl4.allowed(sec)); // >1
47 |
48 | // Tick
49 |
50 | sec = 1;
51 | assert(rl1.allowed(sec)); // 1
52 | assert(!rl2.allowed(sec)); // >2
53 | assert(rl3.allowed(sec)); // 4
54 | assert(!rl4.allowed(sec)); // >1
55 |
56 | // Tick
57 |
58 | sec = 2;
59 | assert(rl1.allowed(sec)); // 1
60 | assert(rl2.allowed(sec)); // 1
61 | assert(rl3.allowed(sec)); // 5
62 | assert(rl3.allowed(sec)); // 6
63 | assert(rl3.allowed(sec)); // 7
64 | assert(!rl3.allowed(sec)); // >7
65 | assert(!rl4.allowed(sec)); // 1
66 |
67 | // Tick
68 |
69 | sec = 3;
70 | assert(rl4.allowed(sec)); // 1
71 |
72 | cout << "RateLimit tests ok" << endl;
73 | }
74 |
--------------------------------------------------------------------------------
/testPrograms/tRetry.cc:
--------------------------------------------------------------------------------
1 | #include
2 | #include
3 |
4 | #include
5 |
6 | #include "serviceImpl.h"
7 |
8 | using namespace std;
9 |
10 | // Fail if context says to
11 |
12 | int
13 | main(int argc, char** argv)
14 | {
15 | pluton::serviceImpl S;
16 | pluton::perCallerService owner("tRetry");
17 | pluton::serviceRequestImpl R;
18 |
19 | S.setDefaultRequest(&R);
20 | S.setDefaultOwner(&owner);
21 |
22 | owner.initialize();
23 | if (!S.initialize(&owner)) {
24 | cerr << "S.initialize() failed" << endl;
25 | exit(1);
26 | }
27 |
28 | bool sleepFlag = false;
29 | bool garbageFlag = false;
30 |
31 | string ct;
32 | while (S.getRequest(&owner, &R)) {
33 | if (sleepFlag) {
34 | clog << "Sleeping for 10" << endl;
35 | sleep(10);
36 | sleepFlag = false;
37 | R.setFault(pluton::noFault);
38 | R.setResponseData("", 0);
39 | S.sendResponse(&owner, &R);
40 | continue;
41 | }
42 |
43 | if (garbageFlag) {
44 | clog << "Sending garbage" << endl;
45 | S.sendRawResponse(&owner, R.getRequestDataLength(), "4:some,junkers", 10, "funct", 1);
46 | garbageFlag = false;
47 | continue;
48 | }
49 |
50 | sleepFlag = R.getContext("sleep", ct);
51 | garbageFlag = R.getContext("garbage", ct);
52 |
53 | clog << "SF=" << sleepFlag << ", GF=" << garbageFlag << endl;
54 |
55 | R.setFault(pluton::noFault);
56 | R.setResponseData("", 0);
57 | S.sendResponse(&owner, &R);
58 | }
59 |
60 | return 0;
61 | }
62 |
--------------------------------------------------------------------------------
/testPrograms/tService1.cc:
--------------------------------------------------------------------------------
1 | #include
2 | #include
3 |
4 | #include
5 |
6 | #include "pluton/service.h"
7 |
8 | using namespace std;
9 |
10 | // Invoked as test.service1.3.HTML
11 | // and test.wildcard.3.JSON (configured test..wildcard.3.JSON)
12 |
13 | int
14 | main(int argc, char** argv)
15 | {
16 | pluton::service S("tService1");
17 |
18 | if (!S.initialize()) {
19 | cerr << S.getFault().getMessage("tService1", true) << endl;
20 | exit(1);
21 | }
22 |
23 | while (S.getRequest()) {
24 |
25 | string sk;
26 | S.getServiceKey(sk);
27 |
28 | if ((sk != "test.service1.3.HTML") && (sk != "test.wildcard.3.JSON")) {
29 | clog << "Error tService1: getServiceKey mismatch=" << sk << endl;
30 | S.sendFault(11, "sk bad");
31 | continue;
32 | }
33 |
34 | string sa;
35 | S.getServiceApplication(sa);
36 | if (sa != "test") {
37 | clog << "Error tService1: getServiceApplication mismatch=" << sa << endl;
38 | S.sendFault(12, "sa bad");
39 | continue;
40 | }
41 |
42 | string sf;
43 | S.getServiceFunction(sf);
44 | if ((sf != "service1") && (sf != "wildcard")) {
45 | clog << "Error tService1: getServiceFunction mismatch=" << sf << endl;
46 | S.sendFault(pluton::unknownFunction, "sf bad");
47 | continue;
48 | }
49 |
50 | int version = S.getServiceVersion();
51 | if (version != 3) {
52 | clog << "Error tService1: getServiceVersion mismatch=" << version << endl;
53 | S.sendFault(13, "version bad");
54 | continue;
55 | }
56 |
57 | pluton::serializationType st = S.getSerializationType();
58 | if ((st != pluton::HTML) && (st != pluton::JSON)) {
59 | clog << "Error tService1: getSerializationType mismatch=" << st << endl;
60 | S.sendFault(14, "st bad");
61 | continue;
62 | }
63 |
64 | string cn;
65 | S.getClientName(cn);
66 | clog << "Client: " << cn << endl;
67 | S.sendResponse("");
68 | }
69 |
70 | if (S.hasFault()) clog << "Error: " << S.getFault().getMessage() << endl;
71 |
72 | return 0;
73 | }
74 |
--------------------------------------------------------------------------------
/testPrograms/tShmService.cc:
--------------------------------------------------------------------------------
1 | #include
2 |
3 | #include
4 |
5 | #include
6 | #include
7 | #include
8 | #include
9 |
10 | #include "shmService.h"
11 |
12 | using namespace std;
13 |
14 | int
15 | main(int argc, char** argv)
16 | {
17 | pluton::shmServiceHandler shmManager;
18 | pluton::shmServiceHandler shmService;
19 |
20 | int fd = open("tShmService.mmap", O_RDWR | O_CREAT | O_TRUNC, 0600);
21 | if (fd == -1) {
22 | perror("open");
23 | exit(1);
24 | }
25 |
26 | pluton::faultCode fc = shmManager.mapManager(fd, 3, 5);
27 | if (fc != pluton::noFault) {
28 | cout << "mapManager() failed: " << fc << endl;
29 | exit(1);
30 | }
31 |
32 | fc = shmService.mapService(fd, getpid(), 0);
33 | if (fc != pluton::noFault) {
34 | cout << "mapService failed: " << fc << endl;
35 | exit(1);
36 | }
37 |
38 | unlink("tShmService.mmap");
39 |
40 | return 0;
41 | }
42 |
--------------------------------------------------------------------------------
/testPrograms/tThread4.cc:
--------------------------------------------------------------------------------
1 | #include
2 | #include
3 | #include
4 |
5 | #include
6 | #include
7 |
8 | #include
9 |
10 | using namespace std;
11 |
12 | #include "pluton/client.h"
13 |
14 | //////////////////////////////////////////////////////////////////////
15 | // Test the threaded interface to the pluton client library.
16 | //////////////////////////////////////////////////////////////////////
17 |
18 |
19 | class myMutex {
20 | public:
21 | st_mutex_t mutex;
22 | };
23 |
24 | // Need to fake out that we're all the same thread to avoid another assert test
25 |
26 | static pluton::thread_t
27 | tSelf(const char* who)
28 | {
29 | // st_thread_t self = st_thread_self();
30 | st_thread_t self = 0;
31 | clog << "tSelf called by " << who << " returning " << (void*)(self) << endl;
32 |
33 | return reinterpret_cast(self);
34 | }
35 |
36 | void*
37 | tStart(void* a1)
38 | {
39 | pluton::client* C = (pluton::client*)(a1);
40 |
41 | pluton::clientRequest R;
42 | R.setContext("echo.log", "y");
43 | R.setContext("echo.sleepMS", "3000");
44 | R.setRequestData("ok");
45 | if (!C->addRequest("system.echo.0.raw", &R)) {
46 | clog << C->getFault().getMessage("Fatal: addRequest(R) failed in tThread4") << endl;
47 | exit(3);
48 | }
49 |
50 | if (C->executeAndWaitAll() <= 0) {
51 | clog << C->getFault().getMessage("Fatal: executeAndWaitAll() failed in tThread4") << endl;
52 | exit(4);
53 | }
54 |
55 | return 0;
56 | }
57 |
58 |
59 | int
60 | main(int argc, char** argv)
61 | {
62 | st_init();
63 |
64 | pluton::client::setThreadHandlers(tSelf);
65 |
66 | pluton::client C("tThread4");
67 | if (!C.initialize(argv[1])) {
68 | clog << C.getFault().getMessage("Fatal: initialize() failed in tThread1") << endl;
69 | exit(1);
70 | }
71 |
72 | C.setPollProxy(st_poll);
73 | st_thread_t t1, t2;
74 | t1 = st_thread_create(tStart, (void*)(&C), 1, 0);
75 | st_sleep(1);
76 | t2 = st_thread_create(tStart, (void*)(&C), 1, 0); // Use the same client - a nono
77 |
78 | clog << "Waiting on t1" << endl;
79 | st_thread_join(t1, 0);
80 |
81 | clog << "Waiting on t2" << endl;
82 | st_thread_join(t2, 0);
83 |
84 | exit(0);
85 | }
86 |
--------------------------------------------------------------------------------
/testPrograms/tThread5.cc:
--------------------------------------------------------------------------------
1 | #include
2 | #include
3 | #include
4 |
5 | #include
6 | #include
7 |
8 | #include
9 |
10 | using namespace std;
11 |
12 | #include "pluton/client.h"
13 |
14 | //////////////////////////////////////////////////////////////////////
15 | // Test the assert for sharing a pluton::client between threads.
16 | //////////////////////////////////////////////////////////////////////
17 |
18 |
19 | class myMutex {
20 | public:
21 | st_mutex_t mutex;
22 | };
23 |
24 | static pluton::thread_t
25 | tSelf(const char* who)
26 | {
27 | st_thread_t self = st_thread_self();
28 | clog << "tSelf called by " << who << " returning " << (void*)(self) << endl;
29 |
30 | return reinterpret_cast(self);
31 | }
32 |
33 | void*
34 | tStart(void* a1)
35 | {
36 | pluton::client* C = (pluton::client*)(a1);
37 |
38 | pluton::clientRequest R;
39 | R.setContext("echo.log", "y");
40 | R.setContext("echo.sleepMS", "3000");
41 | R.setRequestData("ok");
42 | if (!C->addRequest("system.echo.0.raw", &R)) {
43 | clog << C->getFault().getMessage("Fatal: addRequest(R) failed in tThread4") << endl;
44 | exit(3);
45 | }
46 |
47 | if (C->executeAndWaitAll() <= 0) {
48 | clog << C->getFault().getMessage("Fatal: executeAndWaitAll() failed in tThread4") << endl;
49 | exit(4);
50 | }
51 |
52 | return 0;
53 | }
54 |
55 |
56 | int
57 | main(int argc, char** argv)
58 | {
59 | st_init();
60 |
61 | pluton::client::setThreadHandlers(tSelf);
62 |
63 | pluton::client C("tThread5");
64 | if (!C.initialize(argv[1])) {
65 | clog << C.getFault().getMessage("Fatal: initialize() failed in tThread1") << endl;
66 | exit(1);
67 | }
68 |
69 | C.setPollProxy(st_poll);
70 | st_thread_t t1, t2;
71 | t1 = st_thread_create(tStart, (void*)(&C), 1, 0);
72 | st_sleep(1);
73 | t2 = st_thread_create(tStart, (void*)(&C), 1, 0); // Use the same client - a nono
74 |
75 | clog << "Waiting on t1" << endl;
76 | st_thread_join(t1, 0);
77 |
78 | clog << "Waiting on t2" << endl;
79 | st_thread_join(t2, 0);
80 |
81 | exit(0);
82 | }
83 |
--------------------------------------------------------------------------------
/testPrograms/tc.cc:
--------------------------------------------------------------------------------
1 | #include
2 |
3 | #include
4 | #include
5 |
6 | using namespace std;
7 |
8 | #include "pluton/client.h"
9 |
10 |
11 | int
12 | main(int argc, char** argv)
13 | {
14 | pluton::client C("tc");
15 | pluton::clientRequest R1;
16 | pluton::clientRequest R2;
17 | pluton::clientRequest R3;
18 |
19 | cout << C.getAPIVersion() << endl;
20 | if (!C.initialize("./lookup.map")) {
21 | cout << C.getFault().getMessage("Fatal: pluton::initialize() failed") << endl;
22 | exit(1);
23 | }
24 |
25 | R1.setRequestData("This is the first request");
26 | R2.setRequestData("This is the second request");
27 | R3.setRequestData("This is the third");
28 |
29 | C.setTimeoutMilliSeconds(2000);
30 |
31 | C.addRequest("Mail.getFolder.XML.1", &R1);
32 | C.addRequest("AB.addEvent.PHP.0", &R2);
33 | C.addRequest("AB.addEvent.PHP0", &R3);
34 | if (C.executeAndWaitAll() <= 0) {
35 | cout << "execute failed" << endl;
36 | }
37 |
38 | cout << "R1 Fault Code=" << R1.getFaultCode() << " Text=" << R1.getFaultText() << endl;
39 | cout << "R2 Fault Code=" << R2.getFaultCode() << " Text=" << R2.getFaultText() << endl;
40 | cout << "R3 Fault Code=" << R3.getFaultCode() << " Text=" << R3.getFaultText() << endl;
41 |
42 | string s;
43 |
44 | cin >> s; // Block until input
45 |
46 | return 0;
47 | }
48 |
--------------------------------------------------------------------------------
/testPrograms/ts.cc:
--------------------------------------------------------------------------------
1 | #include
2 |
3 | using namespace std;
4 |
5 | #include
6 |
7 | #include "pluton/service.h"
8 |
9 |
10 | int
11 | main(int argc, char** argv)
12 | {
13 | pluton::service S("ts");
14 |
15 | if (!S.initialize()) {
16 | cerr << S.getFault().getMessage("ts") << endl;
17 | exit(1);
18 | }
19 |
20 | while (S.getRequest()) {
21 | string req;
22 | string con;
23 | string key;
24 | cout << "SK = " << S.getServiceKey(key);
25 | S.getRequestData(req);
26 | S.getContext("context", con);
27 | cerr << "Mas Request: " << req << " C=" << con << endl;
28 | string sa;
29 | string sf;
30 | S.getServiceApplication(sa);
31 | S.getServiceFunction(sf);
32 |
33 | S.sendFault(1, "ERROR");
34 | S.sendResponse(sf);
35 | }
36 |
37 | if (S.hasFault()) cerr << "Error: " << S.getFault().getMessage() << endl;
38 |
39 | return 0;
40 | }
41 |
--------------------------------------------------------------------------------
/wrappers/README:
--------------------------------------------------------------------------------
1 | This is where the code for language-specific wrappers lives.
--------------------------------------------------------------------------------
/wrappers/java.old/Makefile.Yahoo:
--------------------------------------------------------------------------------
1 | all:
2 | $(MAKE) -C jar all
3 | $(MAKE) -C jni all
4 |
5 | clean:
6 | $(MAKE) -C jar clean
7 | $(MAKE) -C jni clean
8 |
--------------------------------------------------------------------------------
/wrappers/java.old/README:
--------------------------------------------------------------------------------
1 | The API for this wrapper is for java on RHEL
2 |
3 |
--------------------------------------------------------------------------------
/wrappers/java.old/jar/Makefile.Yahoo:
--------------------------------------------------------------------------------
1 | JSRC=$(wildcard ../com/yahoo/pluton/*.java)
2 | CLASSES=$(patsubst %.java,%.class,$(JSRC))
3 | CLASSPATHS=$(patsubst ../%,%,$(CLASSES))
4 |
5 | all libs: pluton.jar
6 |
7 | pluton.jar: $(CLASSES)
8 | echo Building jar file from: $(CLASSPATHS)
9 | cd .. && jar cf $@ $(CLASSPATHS)
10 | mv ../$@ .
11 |
12 | $(CLASSES): $(JSRC)
13 | javac $(JSRC)
14 |
15 | clean::
16 | rm -f pluton.jar $(CLASSES)
17 |
--------------------------------------------------------------------------------
/wrappers/java.old/jni/Makefile.Yahoo:
--------------------------------------------------------------------------------
1 | ROOT=../../..
2 |
3 | include $(ROOT)/make.config
4 |
5 | CSRCS = client.c service.c
6 | CXXSRCS = initThreads.cc
7 |
8 | CFLAGS += -fPIC
9 | CXXFLAGS += -fPIC
10 | OBJS = client.o service.o initThreads.o
11 |
12 | LIB_NAME = plutonjni
13 | LIB_VERSION = 0.1
14 | SOLIB=$(LIB_NAME).so.$(LIB_VERSION)
15 |
16 | LINC = -I$(ROOT)/include -I$(JDK)/include -I$(JDK)/include/linux
17 |
18 | LINK.C = $(LINK.c)
19 |
20 | all: $(SOLIB)
21 |
22 | com_yahoo_pluton_Client.h: ../com/yahoo/pluton/Client.class
23 | javah -force -verbose -jni -classpath .. com.yahoo.pluton.Client
24 |
25 | com_yahoo_pluton_ClientRequest.h: ../com/yahoo/pluton/ClientRequest.class
26 | javah -force -verbose -jni -classpath .. com.yahoo.pluton.ClientRequest
27 |
28 | com_yahoo_pluton_Service.h: ../com/yahoo/pluton/Service.class
29 | javah -force -verbose -jni -classpath .. com.yahoo.pluton.Service
30 |
31 | $(SOLIB): $(OBJS)
32 | $(LD) -shared -soname $(SOLIB) -o $@ $(LDLIBS) $^
33 |
34 | faultExceptions.c.txt: $(ROOT)/include/pluton/fault.h generate_FaultExceptions.pl
35 | perl generate_FaultExceptions.pl <$(ROOT)/include/pluton/fault.h >faultExceptions.c.txt
36 |
37 | client.o: faultExceptions.c.txt com_yahoo_pluton_Client.h com_yahoo_pluton_ClientRequest.h
38 |
39 | service.o: faultExceptions.c.txt com_yahoo_pluton_Service.h
40 |
41 | clean::
42 | rm -f $(OBJ) $(SOLIB) faultExceptions.c.txt
43 | rm -f com_yahoo_pluton_Client.h com_yahoo_pluton_Service.h
44 |
--------------------------------------------------------------------------------
/wrappers/java.old/jni/generate_FaultExceptions.pl:
--------------------------------------------------------------------------------
1 | #! /usr/bin/perl -w
2 |
3 | # Feed fault.h via stdin and generate an exception switch list for JNI
4 |
5 | print <) {
21 |
22 | printf("\tcase %d: return \"com/yahoo/pluton/%s\";\n", $2, $1)
23 | if (/\s+(\S+)\s+\=\s+(\d+),\s+\/\/ E:/);
24 |
25 | printf("\tcase -%d: return \"com/yahoo/pluton/%s\";\n", $2, $1)
26 | if (/\s+(\S+)\s+\=\s+\-(\d+),\s+\/\/ E:/);
27 | }
28 |
29 | print <
4 | #include "swigClient.h"
5 | #include "swigService.h"
6 | %}
7 |
8 | %include stl.i
9 | %include
10 | %include "swigClient.h"
11 | %include "swigService.h"
12 |
--------------------------------------------------------------------------------
/wrappers/perl.old/tc.pl:
--------------------------------------------------------------------------------
1 | #! /usr/local/bin/perl -w
2 |
3 | use Yahoo::pluton;
4 |
5 | print Yahoo::pluton::client::getAPIVersion(), "\n";
6 |
7 | my $c = Yahoo::pluton::client->new("perlbaby");
8 | $c->initialize("");
9 | # $c->setDebug(1);
10 |
11 | my $r = Yahoo::pluton::clientRequest->new();
12 |
13 | my $rd = "123456789A123456789A12345X";
14 | $r->setRequestData($rd);
15 |
16 | print "Request set\n";
17 |
18 | if (! $c->addRequest("system.echo.0.raw", $r)) {
19 | print $c->getFault()->getMessage("add Request"), "\n";
20 | exit(1);
21 | }
22 |
23 | my $newR = $r;
24 | my $newC = $c;
25 |
26 | $c->executeAndWaitAll();
27 | if ($c->hasFault()) {
28 | print $c->getFault()->getMessage("E&W"), "\n";
29 | exit(1);
30 | }
31 |
32 | my $s = $r->getResponseData();
33 |
34 | print "Response Data: ", $s, "\n";
35 |
--------------------------------------------------------------------------------
/wrappers/perl.old/ts.pl:
--------------------------------------------------------------------------------
1 | #! /usr/local/bin/perl -w
2 |
3 | use Yahoo::pluton;
4 |
5 | print "Client API: ", Yahoo::pluton::client::getAPIVersion(), "\n";
6 | print "Service APU: ", Yahoo::pluton::service::getAPIVersion(), "\n";
7 |
8 | my $s = Yahoo::pluton::service->new("perlbaby");
9 | $s->initialize();
10 |
11 | while ($s->getRequest()) {
12 | my $str = $s->getRequestData();
13 | # print STDERR "Have req of $str\n";
14 | if ($s->hasFault()) {
15 | print STDERR "getRequestData Fault: ", $s->getFault()->getMessage("getRequest"), "\n";
16 | exit(0);
17 | }
18 |
19 | if (length($str) == 0) {
20 | $s->sendFault(1, "Empty request is invalid");
21 | }
22 | else {
23 | my $response = "Your request is " . length($str) . " bytes long";
24 | $s->sendResponse($response);
25 | }
26 | }
27 |
28 | if ($s->hasFault()) {
29 | print STDERR "Service Fault: ", $s->getFault()->getMessage("getRequest"), "\n";
30 | exit(0);
31 | }
32 |
33 | $s->terminate();
34 | exit(0);
35 |
36 |
--------------------------------------------------------------------------------
/wrappers/perl/Makefile.am:
--------------------------------------------------------------------------------
1 | AM_CFLAGS = -I$(top_srcdir)/include @WARN_CFLAGS@ \
2 | `@PERLPROG@ -M'ExtUtils::Embed' -e ccopts --`
3 |
4 | LDADD = $(top_builddir)/clientServiceLibrary/libpluton.la $(top_builddir)/commonLibrary/libcommon.a \
5 | `@PERLPROG@ -M'ExtUtils::Embed' -e ldopts --`
6 |
7 | lib_LTLIBRARIES = libplutonperl.la
8 |
9 | libplutonperl_la_SOURCES = pluton_perl.c
10 |
11 | libplutonperl_la_LDFLAGS = -version-info 0:0:0
12 |
13 | YahooPluton.pm pluton_perl.c: ../pluton.i
14 | @SWIGPROG@ -perl -o pluton_perl.c -outdir . ../pluton.i
15 |
16 | clean-local:
17 | -rm -f YahooPluton.pm pluton_perl.c
18 |
--------------------------------------------------------------------------------
/wrappers/perl/README:
--------------------------------------------------------------------------------
1 | The API for this wrapper is for perl.
2 |
3 | Unique perl wrappers have to be built for each significant version of
4 | perl as the underlying C++ interface changes. Bah humbug. Currently
5 | there are unique versions for 5.6 and 5.8. I anticipate a 5.10 and of
6 | course a 6.0.
7 |
--------------------------------------------------------------------------------
/wrappers/perl/tc.pl:
--------------------------------------------------------------------------------
1 | #! /usr/local/bin/perl -w
2 |
3 | use Yahoo::pluton;
4 |
5 | print Yahoo::pluton::client::getAPIVersion(), "\n";
6 |
7 | my $c = Yahoo::pluton::client->new("perlbaby");
8 | $c->initialize("");
9 | # $c->setDebug(1);
10 |
11 | my $r = Yahoo::pluton::clientRequest->new();
12 |
13 | my $rd = "123456789A123456789A12345X";
14 | $r->setRequestData($rd);
15 |
16 | print "Request set\n";
17 |
18 | if (! $c->addRequest("system.echo.0.raw", $r)) {
19 | print $c->getFault()->getMessage("add Request"), "\n";
20 | exit(1);
21 | }
22 |
23 | my $newR = $r;
24 | my $newC = $c;
25 |
26 | $c->executeAndWaitAll();
27 | if ($c->hasFault()) {
28 | print $c->getFault()->getMessage("E&W"), "\n";
29 | exit(1);
30 | }
31 |
32 | my $s = $r->getResponseData();
33 |
34 | print "Response Data: ", $s, "\n";
35 |
--------------------------------------------------------------------------------
/wrappers/perl/ts.pl:
--------------------------------------------------------------------------------
1 | #! /usr/local/bin/perl -w
2 |
3 | use Yahoo::pluton;
4 |
5 | print "Client API: ", Yahoo::pluton::client::getAPIVersion(), "\n";
6 | print "Service APU: ", Yahoo::pluton::service::getAPIVersion(), "\n";
7 |
8 | my $s = Yahoo::pluton::service->new("perlbaby");
9 | $s->initialize();
10 |
11 | while ($s->getRequest()) {
12 | my $str = $s->getRequestData();
13 | # print STDERR "Have req of $str\n";
14 | if ($s->hasFault()) {
15 | print STDERR "getRequestData Fault: ", $s->getFault()->getMessage("getRequest"), "\n";
16 | exit(0);
17 | }
18 |
19 | if (length($str) == 0) {
20 | $s->sendFault(1, "Empty request is invalid");
21 | }
22 | else {
23 | my $response = "Your request is " . length($str) . " bytes long";
24 | $s->sendResponse($response);
25 | }
26 | }
27 |
28 | if ($s->hasFault()) {
29 | print STDERR "Service Fault: ", $s->getFault()->getMessage("getRequest"), "\n";
30 | exit(0);
31 | }
32 |
33 | $s->terminate();
34 | exit(0);
35 |
36 |
--------------------------------------------------------------------------------
/wrappers/php.old/Makefile.Yahoo:
--------------------------------------------------------------------------------
1 | ROOT = ../..
2 |
3 | include $(ROOT)/make.config
4 |
5 | all:
6 | @echo Please write me
7 |
8 | clean:
9 | @echo ok
10 |
--------------------------------------------------------------------------------
/wrappers/php.old/Makefile.am:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/YahooArchive/Pluton/82bbab17c0013d87063b398ec777d5977f353d0a/wrappers/php.old/Makefile.am
--------------------------------------------------------------------------------
/wrappers/php.old/README:
--------------------------------------------------------------------------------
1 | Need a Makefile for this
2 |
--------------------------------------------------------------------------------
/wrappers/php.old/php_pluton.h:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright (c) 2010, Yahoo! Inc. All rights reserved.
3 |
4 | Redistribution and use of this software in source and binary forms, with or
5 | without modification, are permitted provided that the following conditions are
6 | met:
7 |
8 | * Redistributions of source code must retain the above copyright notice, this
9 | list of conditions and the following disclaimer.
10 |
11 | * Redistributions in binary form must reproduce the above copyright notice,
12 | this list of conditions and the following disclaimer in the documentation and/or
13 | other materials provided with the distribution.
14 |
15 | * Neither the name of Yahoo! Inc. nor the names of its contributors may be used
16 | to endorse or promote products derived from this software without specific prior
17 | written permission of Yahoo! Inc.
18 |
19 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
20 | ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
21 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
22 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
23 | ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
24 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
25 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
26 | ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
27 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
28 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29 | */
30 |
31 | #ifndef PHP_PLUTON_H
32 | #define PHP_PLUTON_H
33 |
34 | #define PHP_PLUTON_VERSION "1.1.0"
35 |
36 | extern zend_module_entry pluton_module_entry;
37 | #define phpext_pluton_ptr &pluton_module_entry
38 |
39 | ZEND_BEGIN_MODULE_GLOBALS(pluton)
40 | ZEND_END_MODULE_GLOBALS(pluton)
41 |
42 | #ifdef ZTS
43 | # define PLUTONG(v) TSRMG(pluton_globals_id, zend_pluton_globals *, v)
44 | #else
45 | # define PLUTONG(v) (pluton_globals.v)
46 | #endif
47 |
48 | #endif
49 |
--------------------------------------------------------------------------------
/wrappers/php.old/php_pluton_structures.h:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright (c) 2010, Yahoo! Inc. All rights reserved.
3 |
4 | Redistribution and use of this software in source and binary forms, with or
5 | without modification, are permitted provided that the following conditions are
6 | met:
7 |
8 | * Redistributions of source code must retain the above copyright notice, this
9 | list of conditions and the following disclaimer.
10 |
11 | * Redistributions in binary form must reproduce the above copyright notice,
12 | this list of conditions and the following disclaimer in the documentation and/or
13 | other materials provided with the distribution.
14 |
15 | * Neither the name of Yahoo! Inc. nor the names of its contributors may be used
16 | to endorse or promote products derived from this software without specific prior
17 | written permission of Yahoo! Inc.
18 |
19 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
20 | ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
21 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
22 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
23 | ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
24 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
25 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
26 | ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
27 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
28 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29 | */
30 |
31 | #ifndef PHP_PLUTON_STRUCTS_H
32 | #define PHP_PLUTON_STRUCTS_H
33 |
34 | #include "pluton/client.h"
35 | #include "pluton/clientRequest.h"
36 | #include "pluton/service.h"
37 |
38 | typedef struct _php_client_object {
39 | zend_object zo;
40 | pluton::client *C;
41 | } php_client_object;
42 |
43 | typedef struct _php_clientRequest_object {
44 | zend_object zo;
45 | pluton::clientRequest *R;
46 | } php_clientRequest_object;
47 |
48 | typedef struct _php_service_object {
49 | zend_object zo;
50 | pluton::service *S;
51 | } php_service_object;
52 |
53 |
54 | #endif
55 |
--------------------------------------------------------------------------------
/wrappers/php.old/unit_tests/05-client-simple.expected.stdout:
--------------------------------------------------------------------------------
1 | Request is in progress
2 | executeAndWaitAny returned 23
3 | getClientHandle returned 23
4 | Calling reset
5 | After reset
6 | Getting response data
7 | After reset handle=0 and response Data=
8 |
--------------------------------------------------------------------------------
/wrappers/php.old/unit_tests/05-client-simple.php:
--------------------------------------------------------------------------------
1 | #!/usr/local/bin/php
2 | initialize();
8 |
9 | $request = new PlutonClientRequest();
10 | $request->setRequestData($expected);
11 | $request->setClientHandle(23);
12 |
13 | $client->addRequest('system.echo.0.raw', $request);
14 | $client->executeAndWaitSent();
15 |
16 | if ($request->inProgress()) {
17 | print "Request is in progress\n";
18 | }
19 | else {
20 | print "Request is NOT in progress\n";
21 | }
22 |
23 | $res = $client->executeAndWaitAny();
24 | print "executeAndWaitAny returned $res\n";
25 | $res = $request->getClientHandle();
26 | if ($res != 23) {
27 | print "Expected return client handle of 23 rather than $res\n";
28 | exit(2);
29 | }
30 | print "getClientHandle returned $res\n";
31 |
32 | $responseData = null;
33 | $request->getResponseData($responseData);
34 |
35 | if($responseData != $expected) {
36 | print "Client test failed\n expected: $expected\n received: $responseData\n";
37 | exit(3);
38 | }
39 |
40 | print "Calling reset\n";
41 | $request->reset();
42 | print "After reset\n";
43 | $res = $request->getClientHandle();
44 | $responseData = null;
45 | print "Getting response data\n";
46 | $request->getResponseData($responseData);
47 |
48 | if ($res == 23) {
49 | print "Did not expect return client handle of 23 after reset\n";
50 | exit(4);
51 | }
52 |
53 | print "After reset handle=$res and response Data=$responseData\n";
54 |
55 | ?>
56 |
--------------------------------------------------------------------------------
/wrappers/php.old/unit_tests/10-client-fault.expected.stdout:
--------------------------------------------------------------------------------
1 | client has fault after bogus initialize - good
2 | Fault code=-33 Text=pluton::Fault=-33/-1 (openForMmapFailed:open() prior to mmap() of lookup Path failed) errno=2:No such file or directory '/does/not/exist' at pluton::client::initialize->initialize:325
3 | Short=SHORT pluton::Fault=-33/-1 errno=2 '/does/not/exist'
4 | Long=LONG pluton::Fault=-33/-1 (openForMmapFailed:open() prior to mmap() of lookup Path failed) errno=2:No such file or directory '/does/not/exist' at pluton::client::initialize->initialize:325
5 | Request is in progress - good
6 | Request is NOT in progress - good
7 |
8 | Client fault test ok
9 |
--------------------------------------------------------------------------------
/wrappers/php.old/unit_tests/10-client-fault.php:
--------------------------------------------------------------------------------
1 | #!/usr/local/bin/php
2 | initialize("/does/not/exist");
6 |
7 | if ($client->hasFault()) {
8 | print "client has fault after bogus initialize - good\n";
9 | }
10 | else {
11 | print "client does NOT have fault after bogus initialize - bad\n";
12 | exit(1);
13 | }
14 |
15 | $ftext = $client->getFault();
16 | $fc = $client->getFaultCode();
17 | $flong = $client->getFaultMessage("LONG", 1);
18 | $fshort = $client->getFaultMessage("SHORT", 0);
19 | print "Fault code=$fc Text=$ftext\n";
20 | print "Short=$fshort\n";
21 | print "Long=$flong\n";
22 |
23 | if (strlen($flong) == 0) {
24 | print "Long message should not be zero length\n";
25 | exit(3);
26 | }
27 |
28 | if (strlen($fshort) == strlen($flong)) {
29 | print "Hmm expected short message to be shorter than long message\n";
30 | exit(4);
31 | }
32 |
33 | $client->initialize();
34 | $client->reset();
35 | if ($client->hasFault()) {
36 | print "client has fault after reset - bad\n";
37 | exit(5);
38 | }
39 |
40 | $request = new PlutonClientRequest();
41 | $request->setRequestData("Some data");
42 |
43 | $client->addRequest('system.echo.0.raw', $request);
44 | if ($request->inProgress()) {
45 | print "Request is in progress - good\n";
46 | }
47 | else {
48 | print "Request is NOT in progress - bad\n";
49 | exit(6);
50 | }
51 |
52 | $client->reset();
53 |
54 | if ($request->inProgress()) {
55 | print "Request is in progress - bad\n";
56 | exit(7);
57 | }
58 | else {
59 | print "Request is NOT in progress - good\n";
60 | }
61 |
62 | print "\nClient fault test ok\n";
63 | ?>
64 |
--------------------------------------------------------------------------------
/wrappers/php.old/unit_tests/12-client-timeout.expected.stdout:
--------------------------------------------------------------------------------
1 | Result of E&W with timeout is 0
2 | Request has fault - good
3 |
--------------------------------------------------------------------------------
/wrappers/php.old/unit_tests/12-client-timeout.php:
--------------------------------------------------------------------------------
1 | #!/usr/local/bin/php
2 | initialize();
8 | $client->setTimeoutMilliSeconds(1000);
9 | $to = $client->getTimeoutMilliSeconds();
10 | if ($to != 1000) {
11 | print "Expected timeout to be 1000 rather than $to\n";
12 | exit(1);
13 | }
14 |
15 | $request = new PlutonClientRequest();
16 | $request->setRequestData($expected);
17 |
18 | $request->setContext("echo.sleepMS", "3000");
19 | $client->addRequest('system.echo.0.raw', $request);
20 | $res = $client->executeAndWaitAll();
21 |
22 | print "Result of E&W with timeout is $res\n";
23 |
24 | if ($request->hasFault()) {
25 | print "Request has fault - good\n";
26 | }
27 | else {
28 | print "Request does NOT have fault - bad\n";
29 | exit(2);
30 | }
31 |
32 | $fc = $request->getFaultCode();
33 |
34 | # We happen to know that timeout is -19
35 |
36 | if ($fc != -19) {
37 | print "Expected fault code of -19 rather than $fc\n";
38 | exit(4);
39 | }
40 |
41 | ?>
42 |
--------------------------------------------------------------------------------
/wrappers/php.old/unit_tests/15-client-execute.expected.stdout:
--------------------------------------------------------------------------------
1 | executeAndWaitOne returned 1
2 | executeAndWaitOne = 1 = ok
3 | executeAndWaitAny returned 3 or 10 - good
4 | executeAndWaitAny first = ok
5 | executeAndWaitAny returned 10 or 3 - good
6 | Second executeAndWaitAny second = ok
7 |
--------------------------------------------------------------------------------
/wrappers/php.old/unit_tests/15-client-execute.php:
--------------------------------------------------------------------------------
1 | #!/usr/local/bin/php
2 | initialize();
8 |
9 | $request10 = new PlutonClientRequest();
10 | $request10->setRequestData($expected);
11 | $request10->setClientHandle(10);
12 |
13 | $request2 = new PlutonClientRequest();
14 | $request2->setRequestData($expected);
15 | $request2->setClientHandle(2);
16 |
17 | $request3 = new PlutonClientRequest();
18 | $request3->setRequestData($expected);
19 | $request3->setClientHandle(3);
20 |
21 | $client->addRequest('system.echo.0.raw', $request10);
22 | $client->addRequest('system.echo.0.raw', $request2);
23 | $client->addRequest('system.echo.0.raw', $request3);
24 |
25 | $res = $client->executeAndWaitOne($request2);
26 | print "executeAndWaitOne returned $res\n";
27 | if ($res != 1) {
28 | print "E&WOne failed. Expected return of 1 rather than $res\n";
29 | exit(2);
30 | }
31 |
32 | print "executeAndWaitOne = $res = ok\n";
33 |
34 | $res = $client->executeAndWaitAny();
35 | if (($res != 10) && ($res != 3)) {
36 | print "E&WAny failed. Expected return of 10 or 3 rather than $res\n";
37 | exit(2);
38 | }
39 | print "executeAndWaitAny returned 3 or 10 - good\n";
40 |
41 | print "executeAndWaitAny first = ok\n";
42 |
43 | $res = $client->executeAndWaitAny();
44 | if (($res != 10) && ($res != 3)) {
45 | print "E&WAny failed. Expected return of 10 or 3 rather than $res\n";
46 | exit(2);
47 | }
48 | print "executeAndWaitAny returned 10 or 3 - good\n";
49 |
50 | print "Second executeAndWaitAny second = ok\n";
51 |
52 | ?>
53 |
--------------------------------------------------------------------------------
/wrappers/php.old/unit_tests/50-clientrequest-attributes.php:
--------------------------------------------------------------------------------
1 | #!/usr/local/bin/php
2 | getAPIVersion();
14 |
15 | print "API=$api\n\n";
16 |
17 | print "Setting attributes\n";
18 | $request = new PlutonClientRequest();
19 | $request->setAttribute(PLUTON_NOWAIT_ATTR);
20 | $request->setAttribute(PLUTON_NOREMOTE_ATTR);
21 | $request->setAttribute(PLUTON_NORETRY_ATTR);
22 | $request->setAttribute(PLUTON_KEEPAFFINITY_ATTR);
23 | $request->setAttribute(PLUTON_NEEDAFFINITY_ATTR);
24 | $request->setAttribute(PLUTON_ALL_ATTR);
25 |
26 | print "Fetching attributes\n";
27 |
28 | function checkAttribute($req, $name, $att, $val)
29 | {
30 | $b = $req->getAttribute($att);
31 | if ($b != $val) {
32 | abortme("Attribute not as expected for $name as $b != $val", 1);
33 | }
34 | print "$name=$b ok\n";
35 | }
36 |
37 | checkAttribute($request, "PLUTON_NOWAIT_ATTR", PLUTON_NOWAIT_ATTR, 1);
38 | checkAttribute($request, "PLUTON_NOREMOTE_ATTR", PLUTON_NOREMOTE_ATTR, 1);
39 | checkAttribute($request, "PLUTON_NORETRY_ATTR", PLUTON_NORETRY_ATTR, 1);
40 | checkAttribute($request, "PLUTON_KEEPAFFINITY_ATTR", PLUTON_KEEPAFFINITY_ATTR, 1);
41 | checkAttribute($request, "PLUTON_NEEDAFFINITY_ATTR", PLUTON_NEEDAFFINITY_ATTR, 1);
42 | checkAttribute($request, "PLUTON_ALL_ATTR", PLUTON_ALL_ATTR, 1);
43 |
44 | print "Checking one off\n";
45 | $request->clearAttribute(PLUTON_NOWAIT_ATTR);
46 | checkAttribute($request, "PLUTON_NOWAIT_ATTR", PLUTON_NOWAIT_ATTR, 0);
47 |
48 | print "Checking all off\n";
49 | $request->clearAttribute(PLUTON_ALL_ATTR);
50 | checkAttribute($request, "PLUTON_NOWAIT_ATTR", PLUTON_NOWAIT_ATTR, 0);
51 | checkAttribute($request, "PLUTON_NOREMOTE_ATTR", PLUTON_NOREMOTE_ATTR, 0);
52 | checkAttribute($request, "PLUTON_NORETRY_ATTR", PLUTON_NORETRY_ATTR, 0);
53 | checkAttribute($request, "PLUTON_KEEPAFFINITY_ATTR", PLUTON_KEEPAFFINITY_ATTR, 0);
54 | checkAttribute($request, "PLUTON_NEEDAFFINITY_ATTR", PLUTON_NEEDAFFINITY_ATTR, 0);
55 | checkAttribute($request, "PLUTON_ALL_ATTR", PLUTON_ALL_ATTR, 0);
56 |
57 | ?>
58 |
59 |
--------------------------------------------------------------------------------
/wrappers/php.old/unit_tests/55-clientrequest-context.php:
--------------------------------------------------------------------------------
1 | #!/usr/local/bin/php
2 | initialize();
14 |
15 | if (!$request->setContext("random", 23)) {
16 | abortme("Context set of innocuous name failed", 1);
17 | }
18 |
19 | if ($request->setContext("pluton.haha", 24)) {
20 | abortme("Context set of protected namespace succeeded", 2);
21 | }
22 |
23 | $request->reset();
24 | $request->setContext("echo.sleepMS", "3300");
25 |
26 | $res = $client->addRequest("system.echo.0.raw", $request);
27 |
28 | print "AddRequest = $res\n";
29 | if (!$res) {
30 | $em1 = $request->getFaultText();
31 | $em2 = $client->getFault();
32 | abortme("addRequest Failed with $em1:$em2", 3);
33 | }
34 |
35 |
36 | $st = time();
37 |
38 | $res = $client->executeAndWaitAll();
39 | print "E&WAll = $res\n";
40 |
41 | $et = time();
42 |
43 | print "Time diffs st=$st et=$et\n";
44 |
45 | if (($st+2) > $et) {
46 | abortme("Context didn't caused echo to sleep - was it really set?", 3);
47 | }
48 |
49 | ?>
50 |
--------------------------------------------------------------------------------
/wrappers/php.old/unit_tests/60-clientrequest-inprogress.php:
--------------------------------------------------------------------------------
1 | #!/usr/local/bin/php
2 | initialize();
8 |
9 | $request = new PlutonClientRequest();
10 | $request->setRequestData($expected);
11 |
12 | $request->setContext("echo.sleepMS", "3000");
13 | $client->addRequest('system.echo.0.raw', $request);
14 | $client->executeAndWaitSent();
15 |
16 | if ($request->inProgress()) {
17 | print "Request is in progress - good\n";
18 | }
19 | else {
20 | print "Request is NOT in progress - bad\n";
21 | exit(1);
22 | }
23 |
24 | $res = $client->executeAndWaitAny();
25 | print "executeAndWaitAny returned $res\n";
26 | if ($request->inProgress()) {
27 | print "Request is still in progress - bad\n";
28 | exit(2);
29 | }
30 | else {
31 | print "Request is NOT in progress - good\n";
32 | }
33 |
34 | $responseData = null;
35 | $request->getResponseData($responseData);
36 |
37 | if($responseData !== $expected) {
38 | print "Client test failed\n expected: $expected\n received: $responseData\n";
39 | exit(3);
40 | }
41 | else {
42 | print "Client test successful\n";
43 | }
44 |
45 | ?>
46 |
--------------------------------------------------------------------------------
/wrappers/php.old/unit_tests/65-clientrequest-fault.php:
--------------------------------------------------------------------------------
1 | #!/usr/local/bin/php
2 | initialize();
8 |
9 | $request = new PlutonClientRequest();
10 | $request->setRequestData($expected);
11 |
12 | $request->setContext("echo.sleepMS", "-3000"); # We know that echo barfs at this
13 | $client->addRequest('system.echo.0.raw', $request);
14 | $client->executeAndWaitAll();
15 |
16 | if ($request->hasFault()) {
17 | print "Request has fault - good\n";
18 | }
19 | else {
20 | print "Request does not has fault - bad\n";
21 | exit(1);
22 | }
23 |
24 | $fc = $request->getFaultCode();
25 | if ($fc != 111) {
26 | print "Expected a fault code of 111 rather than $fc\n";
27 | exit(2);
28 | }
29 |
30 | $ftext = $request->getFaultText();
31 | $service = $request->getServiceName();
32 |
33 | print "Fault code = $fc\n";
34 | print "Fault text = $ftext\n";
35 | print "service = $service\n";
36 |
37 | ?>
38 |
--------------------------------------------------------------------------------
/wrappers/php.old/unit_tests/71-client-leak.expected.stdout:
--------------------------------------------------------------------------------
1 | Repeat Count=200 Depth=400
2 | Client leak test ok
3 |
--------------------------------------------------------------------------------
/wrappers/php.old/unit_tests/80-service-simple.1.data:
--------------------------------------------------------------------------------
1 | echo me out
2 |
--------------------------------------------------------------------------------
/wrappers/php.old/unit_tests/80-service-simple.1.expected.dataout:
--------------------------------------------------------------------------------
1 | echo me out
2 |
--------------------------------------------------------------------------------
/wrappers/php.old/unit_tests/80-service-simple.php:
--------------------------------------------------------------------------------
1 | #!/usr/local/bin/php
2 | initialize();
7 |
8 | $api = $service->getAPIVersion();
9 |
10 | print "Service API Version: $api\n";
11 | if (strlen($api) == 0) {
12 | print "Expected a non-zero length api version\n";
13 | exit(1);
14 | }
15 |
16 | // Invoke the call loop.
17 | while($service->getRequest()) {
18 | $request = $service->getRequestData();
19 | if(!$service->sendResponse($request)) {
20 | $service->sendFault(11, 'sendResponse() failed');
21 | }
22 | }
23 |
24 | if($service->hasFault()) {
25 | error_log('Service had a fault');
26 | }
27 |
28 | $service->terminate();
29 |
30 | print "Terminate complete - about to exit\n";
31 |
32 | exit(0);
33 |
34 | ?>
35 |
--------------------------------------------------------------------------------
/wrappers/php.old/unit_tests/82-service-sendfault.1.data:
--------------------------------------------------------------------------------
1 | echo me out
2 |
--------------------------------------------------------------------------------
/wrappers/php.old/unit_tests/82-service-sendfault.1.expected.stderr:
--------------------------------------------------------------------------------
1 | plTest: Fault 11:sendResponse() failed
2 |
--------------------------------------------------------------------------------
/wrappers/php.old/unit_tests/82-service-sendfault.php:
--------------------------------------------------------------------------------
1 | #!/usr/local/bin/php
2 | initialize();
6 |
7 | $service->getRequest();
8 | $service->sendFault(11, 'sendResponse() failed');
9 |
10 | $service->terminate();
11 |
12 | exit(0);
13 |
14 | ?>
15 |
--------------------------------------------------------------------------------
/wrappers/php.old/unit_tests/84-service-getstuff.1.data:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/YahooArchive/Pluton/82bbab17c0013d87063b398ec777d5977f353d0a/wrappers/php.old/unit_tests/84-service-getstuff.1.data
--------------------------------------------------------------------------------
/wrappers/php.old/unit_tests/84-service-getstuff.1.expected.dataout:
--------------------------------------------------------------------------------
1 | sk=plTest.service.0.raw sa=plTest sf=service sv=0 serial=114 cn=
2 |
--------------------------------------------------------------------------------
/wrappers/php.old/unit_tests/84-service-getstuff.php:
--------------------------------------------------------------------------------
1 | #!/usr/local/bin/php
2 | initialize();
6 |
7 | $service->getRequest();
8 |
9 | $sk = $service->getServiceKey();
10 | $sa = $service->getServiceApplication();
11 | $sf = $service->getServiceFunction();
12 | $sv = $service->getServiceVersion();
13 | $serial = $service->getSerializationType();
14 | $cn = $service->getClientName();
15 |
16 | $service->sendResponse("sk=$sk sa=$sa sf=$sf sv=$sv serial=$serial cn=$cn\n");
17 |
18 | $service->terminate();
19 |
20 | # Give plTest a chance to consume the response
21 |
22 | sleep(2);
23 |
24 | exit(0);
25 |
26 | ?>
27 |
--------------------------------------------------------------------------------
/wrappers/php.old/unit_tests/86-service-context.1.context:
--------------------------------------------------------------------------------
1 | -Cctx=hellO
2 |
--------------------------------------------------------------------------------
/wrappers/php.old/unit_tests/86-service-context.1.data:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/YahooArchive/Pluton/82bbab17c0013d87063b398ec777d5977f353d0a/wrappers/php.old/unit_tests/86-service-context.1.data
--------------------------------------------------------------------------------
/wrappers/php.old/unit_tests/86-service-context.1.expected.dataout:
--------------------------------------------------------------------------------
1 | hellO
--------------------------------------------------------------------------------
/wrappers/php.old/unit_tests/86-service-context.php:
--------------------------------------------------------------------------------
1 | #!/usr/local/bin/php
2 | initialize();
6 |
7 | $service->getRequest();
8 |
9 | $ctx = $service->getContext("ctx");
10 | $service->sendResponse($ctx);
11 |
12 | $service->terminate();
13 |
14 | # Give plTest a chance to consume the response
15 |
16 | sleep(2);
17 |
18 | exit(0);
19 |
20 | ?>
21 |
--------------------------------------------------------------------------------
/wrappers/php.old/unit_tests/90-service-getfault.1.php:
--------------------------------------------------------------------------------
1 | #!/usr/local/bin/php
2 | getRequest();
9 | print "Return from getRequest is $rc\n";
10 |
11 |
12 | if ($service->hasFault()) {
13 | print "service has fault after missing initialize - good\n";
14 | }
15 | else {
16 | print "service does NOT have fault after missing initialize - bad\n";
17 | # exit(1);
18 | }
19 |
20 | $ftext = $service->getFault();
21 | $fc = $service->getFaultCode();
22 | $flong = $service->getFaultMessage("LONG", 1);
23 | $fshort = $service->getFaultMessage("SHORT", 0);
24 | print "Fault code=$fc Text=$ftext\n";
25 | print "Short=$fshort\n";
26 | print "Long=$flong\n";
27 |
28 | if (strlen($flong) == 0) {
29 | print "Long message should not be zero length\n";
30 | exit(3);
31 | }
32 |
33 | if (strlen($fshort) == strlen($flong)) {
34 | print "Hmm expected short message to be shorter than long message\n";
35 | exit(4);
36 | }
37 |
38 |
39 | print "\n Service getFault test ok\n";
40 | ?>
41 |
--------------------------------------------------------------------------------
/wrappers/php.old/unit_tests/90-service-getfault.php:
--------------------------------------------------------------------------------
1 | #!/usr/local/bin/php
2 | getRequest();
9 | print "Return from getRequest is $rc\n";
10 |
11 |
12 | if ($service->hasFault()) {
13 | print "service has fault after missing initialize - good\n";
14 | }
15 | else {
16 | print "service does NOT have fault after missing initialize - bad\n";
17 | # exit(1);
18 | }
19 |
20 | $ftext = $service->getFault();
21 | $fc = $service->getFaultCode();
22 | $flong = $service->getFaultMessage("LONG", 1);
23 | $fshort = $service->getFaultMessage("SHORT", 0);
24 | print "Fault code=$fc Text=$ftext\n";
25 | print "Short=$fshort\n";
26 | print "Long=$flong\n";
27 |
28 | if (strlen($flong) == 0) {
29 | print "Long message should not be zero length\n";
30 | exit(3);
31 | }
32 |
33 | if (strlen($fshort) == strlen($flong)) {
34 | print "Hmm expected short message to be shorter than long message\n";
35 | exit(4);
36 | }
37 |
38 |
39 | print "\n Service getFault test ok\n";
40 | ?>
41 |
--------------------------------------------------------------------------------
/wrappers/php.old/unit_tests/91-service-leak.php:
--------------------------------------------------------------------------------
1 | #!/usr/local/bin/php
2 | 1) {
39 | $rc = $argv[1];
40 | }
41 |
42 | if ($argc > 2) {
43 | $depth = $argv[2];
44 | }
45 | print "Repeat Count=$rc Depth=$depth\n";
46 |
47 | for ($ix=0; $ix < 40; $ix++) {
48 | oneRun($depth, memory_get_usage(true), memory_get_usage(false));
49 | }
50 |
51 | $st = oneRun($depth, memory_get_usage(true), memory_get_usage(false));
52 |
53 | for ($ix=0; $ix < $rc; $ix++) {
54 | oneRun($depth, memory_get_usage(true), memory_get_usage(false));
55 | }
56 |
57 | $en = oneRun($depth, memory_get_usage(true), memory_get_usage(false));
58 | $enInternal = memory_get_usage(false);
59 | $enExternal = memory_get_usage(true);
60 |
61 | $diff = $en - $st;
62 | $diffInternal = $enInternal - $stInternal;
63 | $diffExternal = $enExternal - $stExternal;
64 |
65 | if (($diff > 100) || ($diff < 0)) {
66 | print "Scotty - we appear to have a service leak!\n";
67 | print "ps Start=$st End=$en Diff=$diff\n";
68 | print "Int Start=$stInternal End=$enInternal Diff=$diffInternal\n";
69 | print "Ext Start=$stExternal End=$enExternal Diff=$diffExternal\n";
70 | exit(10);
71 | }
72 |
73 | print "Service leak test ok\n";
74 | ?>
75 |
--------------------------------------------------------------------------------
/wrappers/php.old/unit_tests/95-other-leak1.sh:
--------------------------------------------------------------------------------
1 | #! /bin/sh
2 |
3 | echo testing for memory leaks
4 |
--------------------------------------------------------------------------------
/wrappers/php.old/unit_tests/run_client_tests.sh:
--------------------------------------------------------------------------------
1 | #! /bin/sh
2 |
3 | errorCount=0
4 | failedList=""
5 | banner='--------------------------------------------------------------'
6 |
7 | echo $banner
8 | echo Testing client side
9 | echo $banner
10 |
11 | for f in *-client-*.php
12 | do
13 | echo $banner
14 | echo $f
15 | dataname=`echo $f | cut -f1 -d.`
16 | php $f 2>stderr/$dataname >stdout/$dataname
17 | exitCode=$?
18 | echo Exit code for $f = $exitCode
19 | if [ $exitCode -ne 0 ]; then
20 | errorCount=`expr $errorCount + 1`
21 | failedList="$failedList $f"
22 | echo $f failed: exit code=$exitCode
23 | continue;
24 | fi
25 | if [ -r $dataname.expected.dataout ]; then
26 | echo Running: cmp -s dataout/$dataname $dataname.expected.dataout
27 | cmp -s dataout/$dataname $dataname.expected.dataout
28 | if [ $? -ne 0 ]; then
29 | errorCount=`expr $errorCount + 1`
30 | failedList="$failedList $f"
31 | echo $f failed: output differs from expected
32 | continue;
33 | fi
34 | fi
35 |
36 | if [ -r $dataname.expected.stdout ]; then
37 | echo Running: cmp -s stdout/$dataname $dataname.expected.stdout
38 | cmp -s stdout/$dataname $dataname.expected.stdout
39 | if [ $? -ne 0 ]; then
40 | errorCount=`expr $errorCount + 1`
41 | failedList="$failedList $f"
42 | echo $f failed: output differs from expected
43 | continue;
44 | fi
45 | fi
46 |
47 | if [ -r $dataname.expected.stderr ]; then
48 | echo Running: cmp -s stderr/$dataname $dataname.expected.stderr
49 | cmp -s stderr/$dataname $dataname.expected.stderr
50 | if [ $? -ne 0 ]; then
51 | errorCount=`expr $errorCount + 1`
52 | failedList="$failedList $f"
53 | echo $f failed: output differs from expected
54 | continue;
55 | fi
56 | fi
57 |
58 | echo $f with $d Ok
59 |
60 | done
61 |
62 | if [ -n "$failedList" ]; then
63 | echo Failed: $errorCount : $failedList
64 | exit 1
65 | else
66 | echo All client tests completed successfully
67 | fi
68 |
--------------------------------------------------------------------------------
/wrappers/php.old/unit_tests/run_other_tests.sh:
--------------------------------------------------------------------------------
1 | #! /bin/sh
2 |
3 | errorCount=0
4 | failedList=""
5 | banner='--------------------------------------------------------------'
6 |
7 | echo $banner
8 | echo Testing other stuff
9 | echo $banner
10 |
11 | for f in *-other-*.sh
12 | do
13 | echo $banner
14 | echo $f
15 | sh $f
16 | exitCode=$?
17 | if [ $exitCode -ne 0 ]; then
18 | errorCount=`expr $errorCount + 1`
19 | failedList="$failedList $f"
20 | echo $f failed: exit code=$exitCode
21 | else
22 | echo $f Ok
23 | fi
24 | done
25 |
26 | if [ -n "$failedList" ]; then
27 | echo Failed: $errorCount : $failedList
28 | exit 1
29 | else
30 | echo All other tests completed successfully
31 | fi
32 |
--------------------------------------------------------------------------------
/wrappers/php.old/unit_tests/run_service_tests.sh:
--------------------------------------------------------------------------------
1 | #! /bin/sh
2 |
3 | errorCount=0
4 | failedList=""
5 | banner='--------------------------------------------------------------'
6 |
7 | echo $banner
8 | echo Testing service side
9 | echo $banner
10 |
11 | for f in *-service-*.php
12 | do
13 | echo $banner
14 | testname=`echo $f | cut -f1 -d.`
15 | echo Testing $testname
16 | for d in $testname.*.data
17 | do
18 | echo Testing $f with $d
19 | dataname=`echo $d | cut -f1-2 -d.`
20 | rm -f $dataname.actual
21 | context=""
22 | [ -r $dataname.context ] && context=`cat $dataname.context`
23 | plTest $context -i $d -o dataout/$dataname -- php $f 2>stderr/$dataname >stdout/$dataname
24 | exitCode=$?
25 | echo Exit code from plTest = $exitCode
26 |
27 | # Non-zero exit codes are ok - stdout/stderr comparisons decide errors
28 |
29 | if [ -r $dataname.expected.dataout ]; then
30 | echo Running: cmp -s dataout/$dataname $dataname.expected.dataout
31 | cmp -s dataout/$dataname $dataname.expected.dataout
32 | if [ $? -ne 0 ]; then
33 | errorCount=`expr $errorCount + 1`
34 | failedList="$failedList $f"
35 | echo $f failed: output differs from expected
36 | continue;
37 | fi
38 | fi
39 |
40 | if [ -r $dataname.expected.stdout ]; then
41 | echo Running: cmp -s stdout/$dataname $dataname.expected.stdout
42 | cmp -s stdout/$dataname $dataname.expected.stdout
43 | if [ $? -ne 0 ]; then
44 | errorCount=`expr $errorCount + 1`
45 | failedList="$failedList $f"
46 | echo $f failed: output differs from expected
47 | continue;
48 | fi
49 | fi
50 |
51 | if [ -r $dataname.expected.stderr ]; then
52 | echo Running: cmp -s stderr/$dataname $dataname.expected.stderr
53 | cmp -s stderr/$dataname $dataname.expected.stderr
54 | if [ $? -ne 0 ]; then
55 | errorCount=`expr $errorCount + 1`
56 | failedList="$failedList $f"
57 | echo $f failed: output differs from expected
58 | continue;
59 | fi
60 | fi
61 |
62 | echo $f with $d Ok
63 |
64 | done
65 | done
66 |
67 | if [ -n "$failedList" ]; then
68 | echo Failed: $errorCount : $failedList
69 | exit 1
70 | else
71 | echo All service tests completed successfully
72 | fi
73 |
--------------------------------------------------------------------------------
/wrappers/php.old/unit_tests/runall.sh:
--------------------------------------------------------------------------------
1 | #! /bin/sh
2 |
3 | rm -rf stdout stderr dataout
4 | mkdir stdout stderr dataout
5 |
6 | ./run_client_tests.sh
7 | cec=$?
8 |
9 | ./run_service_tests.sh
10 | sec=$?
11 |
12 | ./run_other_tests.sh
13 | oec=$?
14 |
15 | if [ $cec -eq 0 ] && [ $sec -eq 0 ] && [ $oec -eq 0 ]; then
16 | echo All tests completed successfully
17 | exit 0
18 | else
19 | echo At least one test failed
20 | fi
21 |
22 | exit 1
23 |
--------------------------------------------------------------------------------
/wrappers/php.old/yahoo_pluton.ini:
--------------------------------------------------------------------------------
1 | extension = yahoo_pluton.so
2 |
--------------------------------------------------------------------------------
/wrappers/php/Makefile.am:
--------------------------------------------------------------------------------
1 | AM_CFLAGS = -I$(top_srcdir)/include @WARN_CFLAGS@ \
2 | -I`@PHPCONFIG@ --include-dir` \
3 | -I`@PHPCONFIG@ --include-dir`/Zend \
4 | -I`@PHPCONFIG@ --include-dir`/main \
5 | -I`@PHPCONFIG@ --include-dir`/TSRM
6 |
7 | lib_LTLIBRARIES = libplutonphp.la
8 |
9 | libplutonphp_la_SOURCES = pluton_php.c
10 |
11 | LDADD = $(top_builddir)/clientServiceLibrary/libpluton.la $(top_builddir)/commonLibrary/libcommon.a
12 |
13 | libplutonphp_la_LDFLAGS = -version-info 0:0:0
14 |
15 | YahooPluton.php php_YahooPluton.h pluton_php.c: ../pluton.i
16 | @SWIGPROG@ -php -o pluton_php.c -outdir . ../pluton.i
17 |
18 | clean-local:
19 | -rm -f YahooPluton.php php_YahooPluton.h pluton_php.c
20 |
--------------------------------------------------------------------------------
/wrappers/php/README:
--------------------------------------------------------------------------------
1 | Need a Makefile for this
2 |
--------------------------------------------------------------------------------
/wrappers/php/yahoo_pluton.ini:
--------------------------------------------------------------------------------
1 | extension = yahoo_pluton.so
2 |
--------------------------------------------------------------------------------
/wrappers/pluton.i:
--------------------------------------------------------------------------------
1 | /* File : pluton.i */
2 |
3 | %module YahooPluton
4 | %{
5 | #include
6 |
7 | #include
8 | %}
9 |
--------------------------------------------------------------------------------