File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -34,7 +34,10 @@ execute_process(
3434# curl introduce support from 8.11 but it works reliably only with 8.18
3535if (CURL_CLI_OUTPUT MATCHES "curl ([0-9]+\\ .[0-9]+\\ .[0-9]+)" )
3636 set (CURL_CLI_VERSION "${CMAKE_MATCH_1} " )
37- message (STATUS "Find curl ${CURL_CLI_VERSION} for http server tests" )
37+ message (STATUS "Found curl ${CURL_CLI_VERSION} for http server tests" )
38+ if (CURL_CLI_VERSION VERSION_GREATER_EQUAL "7.50.0" )
39+ ROOT_ADD_GTEST (testUnixSocket test_xsocket.cxx LIBRARIES RHTTP RHTTPSniff Hist )
40+ endif ()
3841 if (CURL_CLI_VERSION VERSION_GREATER_EQUAL "8.18.0" )
3942 ROOT_ADD_GTEST (testWebSocket test_websocket.cxx LIBRARIES RHTTP Hist )
4043 endif ()
Original file line number Diff line number Diff line change 1+ #include " gtest/gtest.h"
2+
3+ #include < string>
4+ #include < fstream>
5+
6+ #include " THttpServer.h"
7+ #include " TROOT.h"
8+
9+ #include " TSystem.h"
10+ #include " TNamed.h"
11+ #include " TRandom.h"
12+
13+ #include " ROOT/TestSupport.hxx"
14+
15+
16+ #include " ./test_suite.cxx"
17+
18+ // main http server
19+ TEST (THttpServer, main)
20+ {
21+ THttpServer serv (" " );
22+
23+ TString fname;
24+ Bool_t create = kFALSE ;
25+
26+ for (Int_t ntry = 0 ; ntry < 10 ; ++ntry) {
27+ fname = " root_test_" ;
28+ auto f = gSystem ->TempFileName (fname, nullptr , " .socket" );
29+ if (!f)
30+ continue ;
31+ fclose (f);
32+
33+ EXPECT_EQ (fname[0 ], ' /' ) << " first symbol in temporary file must be slash" ;
34+ create = serv.CreateEngine (" socket:" + fname + " ?socket_mode=0700" );
35+
36+ if (create)
37+ break ;
38+
39+ gSystem ->Unlink (fname);
40+ }
41+
42+ EXPECT_EQ (create, kTRUE ) << " create unix socket" ;
43+
44+ if (!create)
45+ return ;
46+
47+ server_hash = fname.Hash (); // dummy number for file suffix
48+ unix_socket = " --unix-socket " + fname; // curl argument
49+ server_url = " http://localhost" ; // dummy host name for curl
50+
51+ test_suite (serv);
52+ }
You can’t perform that action at this time.
0 commit comments