EXT-3780 FIX Added llprocessor regression test
parent
183a18f237
commit
7bf5e5c618
|
|
@ -289,6 +289,7 @@ if (LL_TESTS)
|
|||
LL_ADD_INTEGRATION_TEST(llframetimer "" "${test_libs}")
|
||||
LL_ADD_INTEGRATION_TEST(llinstancetracker "" "${test_libs}")
|
||||
LL_ADD_INTEGRATION_TEST(lllazy "" "${test_libs}")
|
||||
LL_ADD_INTEGRATION_TEST(llprocessor "" "${test_libs}")
|
||||
LL_ADD_INTEGRATION_TEST(llrand "" "${test_libs}")
|
||||
LL_ADD_INTEGRATION_TEST(llsdserialize "" "${test_libs}")
|
||||
LL_ADD_INTEGRATION_TEST(llstring "" "${test_libs}")
|
||||
|
|
|
|||
|
|
@ -46,6 +46,20 @@
|
|||
|
||||
#include "llsd.h"
|
||||
|
||||
#if LL_MSVC && _M_X64
|
||||
# define LL_X86_64 1
|
||||
# define LL_X86 1
|
||||
#elif LL_MSVC && _M_IX86
|
||||
# define LL_X86 1
|
||||
#elif LL_GNUC && ( defined(__amd64__) || defined(__x86_64__) )
|
||||
# define LL_X86_64 1
|
||||
# define LL_X86 1
|
||||
#elif LL_GNUC && ( defined(__i386__) )
|
||||
# define LL_X86 1
|
||||
#elif LL_GNUC && ( defined(__powerpc__) || defined(__ppc__) )
|
||||
# define LL_PPC 1
|
||||
#endif
|
||||
|
||||
class LLProcessorInfoImpl; // foward declaration for the mImpl;
|
||||
|
||||
namespace
|
||||
|
|
@ -680,66 +694,13 @@ class LLProcessorInfoLinuxImpl : public LLProcessorInfoImpl
|
|||
public:
|
||||
LLProcessorInfoLinuxImpl()
|
||||
{
|
||||
std::map< std::string, std::string > cpuinfo;
|
||||
LLFILE* cpuinfo_fp = LLFile::fopen(CPUINFO_FILE, "rb");
|
||||
if(cpuinfo_fp)
|
||||
{
|
||||
char line[MAX_STRING];
|
||||
memset(line, 0, MAX_STRING);
|
||||
while(fgets(line, MAX_STRING, cpuinfo_fp))
|
||||
{
|
||||
// /proc/cpuinfo on Linux looks like:
|
||||
// name\t*: value\n
|
||||
char* tabspot = strchr( line, '\t' );
|
||||
if (tabspot == NULL)
|
||||
continue;
|
||||
char* colspot = strchr( tabspot, ':' );
|
||||
if (colspot == NULL)
|
||||
continue;
|
||||
char* spacespot = strchr( colspot, ' ' );
|
||||
if (spacespot == NULL)
|
||||
continue;
|
||||
char* nlspot = strchr( line, '\n' );
|
||||
if (nlspot == NULL)
|
||||
nlspot = line + strlen( line ); // Fallback to terminating NUL
|
||||
std::string linename( line, tabspot );
|
||||
std::string llinename(linename);
|
||||
LLStringUtil::toLower(llinename);
|
||||
std::string lineval( spacespot + 1, nlspot );
|
||||
cpuinfo[ llinename ] = lineval;
|
||||
}
|
||||
fclose(cpuinfo_fp);
|
||||
}
|
||||
# if LL_X86
|
||||
std::string flags = " " + cpuinfo["flags"] + " ";
|
||||
LLStringUtil::toLower(flags);
|
||||
|
||||
if( flags.find( " sse " ) != std::string::npos )
|
||||
{
|
||||
setExtension(eSSE_Ext);
|
||||
}
|
||||
|
||||
if( flags.find( " sse2 " ) != std::string::npos )
|
||||
{
|
||||
setExtension(eSSE2_Ext);
|
||||
}
|
||||
|
||||
F64 mhz;
|
||||
if (LLStringUtil::convertToF64(cpuinfo["cpu mhz"], mhz)
|
||||
&& 200.0 < mhz && mhz < 10000.0)
|
||||
{
|
||||
setInfo(eFrequency,(F64)(mhz));
|
||||
}
|
||||
|
||||
if (!cpuinfo["model name"].empty())
|
||||
mCPUString = cpuinfo["model name"];
|
||||
# endif // LL_X86
|
||||
get_proc_cpuinfo();
|
||||
}
|
||||
|
||||
virtual ~LLProcessorInfoLinuxImpl() {}
|
||||
private:
|
||||
|
||||
void getCPUIDInfo()
|
||||
void get_proc_cpuinfo()
|
||||
{
|
||||
std::map< std::string, std::string > cpuinfo;
|
||||
LLFILE* cpuinfo_fp = LLFile::fopen(CPUINFO_FILE, "rb");
|
||||
|
|
|
|||
|
|
@ -35,7 +35,7 @@
|
|||
#define LLPROCESSOR_H
|
||||
class LLProcessorInfoImpl;
|
||||
|
||||
class LLProcessorInfo
|
||||
class LL_COMMON_API LLProcessorInfo
|
||||
{
|
||||
public:
|
||||
LLProcessorInfo();
|
||||
|
|
|
|||
|
|
@ -0,0 +1,67 @@
|
|||
/**
|
||||
* @file llprocessor_test.cpp
|
||||
* @date 2010-06-01
|
||||
*
|
||||
* $LicenseInfo:firstyear=2010&license=viewergpl$
|
||||
*
|
||||
* Copyright (c) 2010, Linden Research, Inc.
|
||||
*
|
||||
* Second Life Viewer Source Code
|
||||
* The source code in this file ("Source Code") is provided by Linden Lab
|
||||
* to you under the terms of the GNU General Public License, version 2.0
|
||||
* ("GPL"), unless you have obtained a separate licensing agreement
|
||||
* ("Other License"), formally executed by you and Linden Lab. Terms of
|
||||
* the GPL can be found in doc/GPL-license.txt in this distribution, or
|
||||
* online at http://secondlifegrid.net/programs/open_source/licensing/gplv2
|
||||
*
|
||||
* There are special exceptions to the terms and conditions of the GPL as
|
||||
* it is applied to this Source Code. View the full text of the exception
|
||||
* in the file doc/FLOSS-exception.txt in this software distribution, or
|
||||
* online at
|
||||
* http://secondlifegrid.net/programs/open_source/licensing/flossexception
|
||||
*
|
||||
* By copying, modifying or distributing this software, you acknowledge
|
||||
* that you have read and understood your obligations described above,
|
||||
* and agree to abide by those obligations.
|
||||
*
|
||||
* ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
|
||||
* WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
|
||||
* COMPLETENESS OR PERFORMANCE.
|
||||
* $/LicenseInfo$
|
||||
*/
|
||||
|
||||
#include "linden_common.h"
|
||||
#include "../test/lltut.h"
|
||||
|
||||
#include "../llprocessor.h"
|
||||
|
||||
|
||||
namespace tut
|
||||
{
|
||||
struct processor
|
||||
{
|
||||
};
|
||||
|
||||
typedef test_group<processor> processor_t;
|
||||
typedef processor_t::object processor_object_t;
|
||||
tut::processor_t tut_processor("processor");
|
||||
|
||||
template<> template<>
|
||||
void processor_object_t::test<1>()
|
||||
{
|
||||
set_test_name("LLProcessorInfo regression test");
|
||||
|
||||
LLProcessorInfo pi;
|
||||
F64 freq = pi.getCPUFrequency();
|
||||
//bool sse = pi.hasSSE();
|
||||
//bool sse2 = pi.hasSSE2();
|
||||
//bool alitvec = pi.hasAltivec();
|
||||
std::string family = pi.getCPUFamilyName();
|
||||
std::string brand = pi.getCPUBrandName();
|
||||
//std::string steam = pi.getCPUFeatureDescription();
|
||||
|
||||
ensure_not_equals("Unknown Brand name", brand, "Unknown");
|
||||
ensure_not_equals("Unknown Family name", family, "Unknown");
|
||||
ensure_not_equals("Undetected Frequency", freq, LLSD(0).asReal());
|
||||
}
|
||||
}
|
||||
Loading…
Reference in New Issue