~ubuntu-branches/ubuntu/vivid/mir/vivid

« back to all changes in this revision

Viewing changes to tests/unit-tests/test_variable_length_array.cpp

  • Committer: Package Import Robot
  • Author(s): Ubuntu daily release, Daniel van Vugt, Ubuntu daily release
  • Date: 2014-06-03 21:41:02 UTC
  • mfrom: (1.1.62)
  • Revision ID: package-import@ubuntu.com-20140603214102-jh0yoq6xy4x0rwn1
Tags: 0.2.0+14.10.20140603.3-0ubuntu1
[ Daniel van Vugt ]
* New upstream release 0.2.0 (https://launchpad.net/mir/+milestone/0.2.0)
  - mirclient ABI unchanged, still at 7. Clients do not need rebuilding.
  - mirserver ABI bumped to 20. Shells need rebuilding.
    . Cursor::set_image() parameters changed.
    . Display::the_cursor() renamed to Display::create_hardware_cursor()
    . Platform::create_display() requires a new parameter; gl_program_factory
    . Renderable::buffer() no longer accepts any parameter at all. Multi-
      monitor frame sync is guaranteed in other ways now.
    . Scene::generate_renderable_list() renamed to renderable_list_for(id)
      where id is an opaque compositor ID of your choosing.
    . Scene::set_change_callback() replaced by the more generic:
      add_observer() and remove_observer() functions.
    . Added default implementation for SceneObserver.  
    . SessionCreator renamed to ConnectionCreator.
    . ConnectedSessions renamed to Connections.
    . ProtobufSessionCreator renamed to ProtobufConnectionCreator.
    . SessionAuthorizer: pid_t parameters replaced by SessionCredentials.
    . Massive architectural changes to Input-everything.
    . Surface no longer implements Renderable, but emits one via
      compositor_snapshot().
    . Pass the full renderable list to Renderer::render().
    . Graceful handling of exceptions thrown from server threads.
    . Clarify size position interfaces in the Surface classes.
    . Plumbing for trusted sessions.
    . Allow posting and managing custom main-loop actions.
    . Timer extension.
    . Identify client process when client connects to Mir not when socket
      connects.
    . Use the ServerActionQueue for display config.
    . Recomposition signal moved to the MultiThreadedCompositor.
    . Make timer service replaceable.
    . Clarify assumptions about how many buffers a client can fill without
      blocking.
    . Introduce EmergencyCleanup interface.
  - Demo shell enhancements:
    . You can now change graphics modes on the fly using Ctrl+Alt+(-/=).
      To reset to the preferred mode use Ctrl+Alt+0.
    . The above mode changing as well as existing screen rotation keys
      (Ctrl+Alt+arrows) are now per-display; only applied to the monitor
      the mouse pointer is on.
    . New shell controls documented.
  - A new testing category, performance test, was introduced. It currently
    runs glmark2-es2 and compares the result to a minimum threshold. 
  - MIR_VERSION_MINOR is tied to MIRSERVER_ABI in the sense that a change
    in the former now requires dependent projects that a rebuild is 
    necessary.
  - SwitchingBundle was replaced by BufferQueue.
  - Expand credentials to include uid/gid for session authorizer.
  - Bypass control is now Mesa-specific and tied to the command line options.
    So the environment variable MIR_BYPASS has changed to MIR_SERVER_BYPASS.
  - mirscreencast screenshots now produce images with correct color instead
    of transparency.
  - Ongoing architectural changes in the compositor/renderer logic to
    prepare for overlay support, and to reduce locking overhead.
  - Made InputDispatcher replaceable.
  - Progress made on new cursor interfaces with the end goal of client and
    toolkit control of the mouse cursor appearance. More work required.
  - Updated cross-compile docs and scripts to support the latest utopic
    devel images.
  - Replaced uses of android::sp with std::shared_ptr.
  - Client cursor API infrastructure.
  - Enabled eglSwapInternal(0).
  - Make texture caching algorithm reuseable.
  - Add a DPI surface attribute.
  - Exclude arm64 from build.
  - Bugs fixed:
    . Mir doesn't install cleanly if docs are not built. (LP: #1304271)
    . Unity-system-compositor crashed [what(): Failed to set DRM crtc].
      (LP: #1294510)
    . [regression] unity8 fails to load libmirplatformgraphics
      (undefined symbol: _ZN3mir8graphics9GLProgramD1Ev). (LP: #1317200)
    . [regression] unity8 rendering artifacts. (LP: #1317260)
    . [regression] [BufferQueue] 
      BufferQueueTest.compositor_never_owns_client_buffers occasionally
      crashes with: what(): unexpected release: buffer was not given to
      compositor. (LP: #1317801)
    . Hardcoded size for serialization buffers is neither reliable nor
      secure. (LP: #1320187)
    . [regression] [BufferQueue] mir does not composite last client given
      buffer. (LP: #1321861)
    . [regression] stale frame on seen on greeter when screen is unblanked
      and toolkit/apps are laggy/throttled. (LP: #1321886)
    . [regression] [BufferQueue] current_buffer_users vector memory usage
      grows unbounded. (LP: #1317808)
    . Intermittent test failures in 
      CustomInputDispatcherFixture.custom_input_dispatcher_receives_input.
      (LP: #1318587)
    . [regression] [BufferQueue] Race condition in 
      BufferQueue::compositor_acquire could underflow shared_ptr refcount and
      delete prematurely, crash. (LP: #1318632)
    . Overflow in 
      mir::client::rpc::MirSocketRpcChannel::receive_file_descriptors as
      reported by address sanitizer. (LP: #1320821)
    . [regression] [input] Scroll events are now always zero: 
      event.motion.pointer_coordinates[0].vscroll. (LP: #1321077)
    . CI failures in CustomInputDispatcherFixture
      .custom_input_dispatcher_gets_started_and_stopped. (LP: #1321215)
    . [regression] Mir cursor vanishes after switching VTs. (LP: #1323225)
    . Server library links against libmirserverlttng. (LP: #1323317)
    . [DRM/GBM] Killing (or crashing) Mir often leaves the screen blank and
      difficult to recover. (LP: #1189770)
    . Frame rates of GL clients are limited to 60Hz on Android, even with
      swapinterval=0. (LP: #1206400)
    . mir_surface_is_valid(NULL) crashes instead of returning false.
      (LP: #1248474)
    . Mirscreencast outputs translucency instead of shadows, producing
      incorrect images. (LP: #1301210)
    . [regression] tests/unit-tests/shell/test_mediating_display_changer.cpp
      is not compiled and executed. (LP: #1312832)
    . Android platform does not reset the compositionType to HWC_FRAMEBUFFER
      before prepare() on every frame. (LP: #1314399)
    . The client process is identified when the socket connects, not when the
      client connects to Mir. (LP: #1314574)
    . [regression] Clients can't acquire multiple buffers any more.
      (LP: #1315302)
    . [regression] Enabling SwitchingBundleTest 
      DISABLED_synchronous_clients_only_get_two_real_buffers now crashes with
      no usable stack trace. It used to only fail. (LP: #1315312)
    . [regression] [BufferQueue] double-buffered client freezes as no buffer
      is returned on compositor_release. (LP: #1319765)
    . Uninitialized mem in OutputBuilder.hwc_version_11_success.
      (LP: #1312867)
    . [enhancement] In the tests make it possible to get a
      DefaultConfiguration initialized from the command line (LP: #1316987)
    . ci train blocked due to missing arm64 libandroid-properties-dev.
      (LP: #1323504)
[ Ubuntu daily release ]
* New rebuild forced

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
 * Copyright © 2014 Canonical Ltd.
 
3
 *
 
4
 * This program is free software: you can redistribute it and/or modify it
 
5
 * under the terms of the GNU General Public License version 3,
 
6
 * as published by the Free Software Foundation.
 
7
 *
 
8
 * This program is distributed in the hope that it will be useful,
 
9
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 
10
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
11
 * GNU General Public License for more details.
 
12
 *
 
13
 * You should have received a copy of the GNU General Public License
 
14
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
15
 *
 
16
 *
 
17
 * Authored by: Alexandros Frantzis <alexandros.frantzis@canonical.com>
 
18
 */
 
19
 
 
20
#include "mir/variable_length_array.h"
 
21
 
 
22
#include <gtest/gtest.h>
 
23
#include <gmock/gmock.h>
 
24
 
 
25
TEST(VariableLengthArray, has_correct_size_if_using_builtin)
 
26
{
 
27
    using namespace testing;
 
28
 
 
29
    size_t const builtin_size{100};
 
30
    size_t const vla_size_builtin{builtin_size - 1};
 
31
    mir::VariableLengthArray<builtin_size> vla{vla_size_builtin};
 
32
 
 
33
    EXPECT_THAT(vla.size(), Eq(vla_size_builtin));
 
34
    memset(vla.data(), 0x55, vla.size());
 
35
}
 
36
 
 
37
TEST(VariableLengthArray, has_correct_size_if_using_heap)
 
38
{
 
39
    using namespace testing;
 
40
 
 
41
    size_t const builtin_size{100};
 
42
    size_t const vla_size_heap{builtin_size + 1};
 
43
    mir::VariableLengthArray<builtin_size> vla{vla_size_heap};
 
44
 
 
45
    EXPECT_THAT(vla.size(), Eq(vla_size_heap));
 
46
    memset(vla.data(), 0x55, vla.size());
 
47
}
 
48
 
 
49
TEST(VariableLengthArray, resizes_from_builtin_to_heap)
 
50
{
 
51
    using namespace testing;
 
52
 
 
53
    size_t const builtin_size{100};
 
54
    size_t const vla_size_builtin{builtin_size - 1};
 
55
    size_t const vla_size_heap{builtin_size + 1};
 
56
    mir::VariableLengthArray<builtin_size> vla{vla_size_builtin};
 
57
 
 
58
    vla.resize(vla_size_heap);
 
59
 
 
60
    EXPECT_THAT(vla.size(), Eq(vla_size_heap));
 
61
    memset(vla.data(), 0x55, vla.size());
 
62
}
 
63
 
 
64
TEST(VariableLengthArray, resizes_from_builtin_to_builtin)
 
65
{
 
66
    using namespace testing;
 
67
 
 
68
    size_t const builtin_size{100};
 
69
    size_t const vla_size_builtin1{builtin_size - 1};
 
70
    size_t const vla_size_builtin2{builtin_size};
 
71
    mir::VariableLengthArray<builtin_size> vla{vla_size_builtin1};
 
72
 
 
73
    vla.resize(vla_size_builtin2);
 
74
 
 
75
    EXPECT_THAT(vla.size(), Eq(vla_size_builtin2));
 
76
    memset(vla.data(), 0x55, vla.size());
 
77
}
 
78
 
 
79
TEST(VariableLengthArray, resizes_from_heap_to_builtin)
 
80
{
 
81
    using namespace testing;
 
82
 
 
83
    size_t const builtin_size{100};
 
84
    size_t const vla_size_builtin{builtin_size - 1};
 
85
    size_t const vla_size_heap{builtin_size + 1};
 
86
    mir::VariableLengthArray<builtin_size> vla{vla_size_heap};
 
87
 
 
88
    vla.resize(vla_size_builtin);
 
89
 
 
90
    EXPECT_THAT(vla.size(), Eq(vla_size_builtin));
 
91
    memset(vla.data(), 0x55, vla.size());
 
92
}
 
93
 
 
94
TEST(VariableLengthArray, resizes_from_heap_to_heap)
 
95
{
 
96
    using namespace testing;
 
97
 
 
98
    size_t const builtin_size{100};
 
99
    size_t const vla_size_heap1{builtin_size + 1};
 
100
    size_t const vla_size_heap2{builtin_size + 2};
 
101
    mir::VariableLengthArray<builtin_size> vla{vla_size_heap1};
 
102
 
 
103
    vla.resize(vla_size_heap2);
 
104
 
 
105
    EXPECT_THAT(vla.size(), Eq(vla_size_heap2));
 
106
    memset(vla.data(), 0x55, vla.size());
 
107
}