Skip to content

Commit 85b5b36

Browse files
authored
Hardening tests (#9)
Hardening tests and they now work on travis-ci properly.
1 parent ec70aa5 commit 85b5b36

File tree

6 files changed

+9755
-8608
lines changed

6 files changed

+9755
-8608
lines changed

include/cpuaff/impl/basic_affinity_manager.hpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -409,6 +409,7 @@ class basic_affinity_manager
409409
cpus_by_numa_[i->numa].insert(cpu);
410410
cpus_by_socket_[i->spec.socket()].insert(cpu);
411411
cpus_by_core_[i->spec.core()].insert(cpu);
412+
cpus_by_socket_and_core_[std::make_pair(i->spec.socket(), i->spec.core())].insert(cpu);
412413
cpus_by_processing_unit_[i->spec.processing_unit()].insert(cpu);
413414
}
414415

include/cpuaff/impl/basic_cpu.hpp

Lines changed: 16 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -141,27 +141,25 @@ class basic_cpu
141141
return spec_ == rhs.spec_;
142142
}
143143

144+
/*!
145+
* Stream operator
146+
*
147+
* Print [id, numa, socket, core, processing unit]
148+
*
149+
*/
150+
friend std::ostream &operator<<(std::ostream &s,
151+
const basic_cpu &cpu)
152+
{
153+
s << "[id: " << cpu.id().get() << ", numa: " << cpu.numa()
154+
<< ", socket: " << cpu.socket() << ", core: " << cpu.core()
155+
<< ", processing_unit: " << cpu.processing_unit() << "]";
156+
return s;
157+
}
158+
144159
private:
145160
cpu_spec spec_;
146161
cpu_identifier_wrapper_type id_;
147162
numa_type numa_;
148163
};
149164
} // namespace impl
150-
} // namespace cpuaff
151-
152-
/*!
153-
* Stream operator
154-
*
155-
* Print [id, numa, socket, core, processing unit]
156-
*
157-
*/
158-
159-
template < typename TRAITS >
160-
std::ostream &operator<<(std::ostream &s,
161-
const cpuaff::impl::basic_cpu< TRAITS > &cpu)
162-
{
163-
s << "[id: " << cpu.id().get() << ", numa: " << cpu.numa()
164-
<< ", socket: " << cpu.socket() << ", core: " << cpu.core()
165-
<< ", processing_unit: " << cpu.processing_unit() << "]";
166-
return s;
167-
}
165+
} // namespace cpuaff

include/cpuaff/impl/basic_cpu_set.hpp

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@
3333
#include "../config.hpp"
3434
#include "basic_cpu.hpp"
3535
#include <set>
36+
#include <iostream>
3637

3738
namespace cpuaff
3839
{
@@ -44,6 +45,26 @@ namespace impl
4445
template < typename TRAITS >
4546
class basic_cpu_set : public std::set< basic_cpu< TRAITS > >
4647
{
48+
public:
49+
friend std::ostream &operator<<(std::ostream &s, const basic_cpu_set &obj)
50+
{
51+
typename basic_cpu_set::const_iterator i = obj.begin();
52+
typename basic_cpu_set::const_iterator iend = obj.end();
53+
54+
for ( ; i != iend; ++i)
55+
{
56+
if (i != obj.begin())
57+
{
58+
s << ", ";
59+
}
60+
61+
s << (*i);
62+
}
63+
64+
return s;
65+
}
4766
};
67+
68+
4869
} // namespace impl
49-
} // namespace cpuaff
70+
} // namespace cpuaff

tests/Makefile.am

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,2 @@
1-
exampledir = $(datarootdir)/cpuaff/examples
21
noinst_PROGRAMS = test
32
test_SOURCES = test.cpp catch.hpp

0 commit comments

Comments
 (0)