26 std::map<std::string, std::string> SmokeTest::smokeTestUrls = std::map<std::string, std::string>();
32 mPlayerInstanceAamp = playerInstanceAamp;
42 void SmokeTest::loadSmokeTestUrls()
45 const std::string smokeurlFile(
"/smoketest.csv");
46 int BUFFER_SIZE = 500;
47 char buffer[BUFFER_SIZE];
50 if ( (fp = mAampcli.getConfigFile(smokeurlFile)) != NULL)
52 printf(
"%s:%d: opened smoketest file\n",__FUNCTION__,__LINE__);
56 if(fgets(buffer, BUFFER_SIZE, fp) != NULL)
58 buffer[strcspn(buffer,
"\n")] = 0;
59 std::string urlData(buffer);
61 std::size_t delimiterPos = urlData.find(
",");
63 if(delimiterPos != std::string::npos)
65 smokeTestUrls[ urlData.substr(0, delimiterPos) ] = urlData.substr(delimiterPos + 1);
75 void SmokeTest::vodTune(
const char *stream)
77 const char *url = NULL;
79 std::string testFilePath;
81 time_t initialTime = 0, currentTime = 0;
82 std::map<std::string, std::string>::iterator itr;
84 createTestFilePath(testFilePath);
85 if(strncmp(stream,
"Dash",4) == 0)
87 fileName = testFilePath +
"tuneDashStream.txt";
88 itr = smokeTestUrls.find(
"VOD_DASH");
90 itr = smokeTestUrls.find(
"VOD_DASH");
92 if(itr != smokeTestUrls.end())
94 url = (itr->second).c_str();
99 url =
"https://cpetestutility.stb.r53.xcal.tv/VideoTestStream/main.mpd";
103 else if(strncmp(stream,
"Hls",3) == 0)
105 fileName = testFilePath +
"tuneHlsStream.txt";
106 itr = smokeTestUrls.find(
"VOD_HLS");
108 if(itr != smokeTestUrls.end())
110 url = (itr->second).c_str();
115 url =
"https://cpetestutility.stb.r53.xcal.tv/VideoTestStream/main.m3u8";
120 stdout = fopen(fileName.c_str(),
"w");
122 mPlayerInstanceAamp->
Tune(url);
124 initialTime = time(NULL);
131 printf(
"%s:%d: Tune sub task started\n",__FUNCTION__,__LINE__);
132 mPlayerInstanceAamp->
Tune(url);
133 mPlayerInstanceAamp->
SetRate(0);
134 mPlayerInstanceAamp->
SetRate(4);
135 mPlayerInstanceAamp->
SetRate(1);
137 mPlayerInstanceAamp->
SetRate(-2);
139 mPlayerInstanceAamp->
Stop();
142 printf(
"%s:%d: Tune %s completed\n",__FUNCTION__,__LINE__,stream);
146 currentTime = time(NULL);
147 if((currentTime - initialTime) > 1200)
157 void SmokeTest::liveTune(
const char *stream)
159 const char *url = NULL;
160 std::string fileName;
161 std::string testFilePath;
164 createTestFilePath(testFilePath);
166 url =
"https://ll-usw2.akamaized.net/live/disk/sky/DASH-LL-sky.toml/sky.mpd";
167 fileName = testFilePath +
"tuneLive.txt";
170 stdout = fopen(fileName.c_str(),
"w");
172 mPlayerInstanceAamp->
Tune(url);
174 mPlayerInstanceAamp->
SetRate(0);
175 mPlayerInstanceAamp->
SetRate(1);
177 mPlayerInstanceAamp->
Stop();
185 bool SmokeTest::createTestFilePath(std::string &filePath)
187 #ifdef AAMP_SIMULATOR_BUILD
188 char *ptr = getenv(
"HOME");
191 filePath.append(ptr);
192 filePath +=
"/smoketest/";
196 printf(
"%s:%d: Path not found\n",__FUNCTION__,__LINE__);
200 filePath =
"/opt/smoketest/";
202 DIR *dir = opendir(filePath.c_str());
205 mkdir(filePath.c_str(), 0777);