Merge "Libhardware: Fix tests"

am: de5662d7fa

* commit 'de5662d7fae646205aebc030f4105f50610e8b82':
  Libhardware: Fix tests
This commit is contained in:
Andreas Gampe 2015-12-17 01:05:06 +00:00 committed by android-build-merger
commit 7edadd7197
9 changed files with 62 additions and 50 deletions

View file

@ -495,9 +495,6 @@ TEST_F(CameraMultiStreamTest, DISABLED_MultiBurst) {
jpegData = availableJpegSizes.data.i32;
jpegCount = availableJpegSizes.count;
} else {
const int32_t *implDefResolutions;
size_t implDefResolutionsCount;
getResolutionList(HAL_PIXEL_FORMAT_IMPLEMENTATION_DEFINED, &implDefData, &implDefCount);
ASSERT_NE(0u, implDefCount)
<< "Missing implementation defined sizes";

View file

@ -186,7 +186,6 @@ protected:
void getResolutionList(int32_t format,
const int32_t **list,
size_t *count) {
status_t res;
ALOGV("Getting resolutions for format %x", format);
if (getDeviceVersion() < CAMERA_DEVICE_API_VERSION_3_2) {
return;

View file

@ -208,13 +208,13 @@ int MetadataQueue::consumer_dequeue(const camera2_request_queue_src_ops_t *q,
return queue->dequeue(buffer, true);
}
int MetadataQueue::consumer_free(const camera2_request_queue_src_ops_t *q,
int MetadataQueue::consumer_free(const camera2_request_queue_src_ops_t * /* q */,
camera_metadata_t *old_buffer) {
free_camera_metadata(old_buffer);
return OK;
}
int MetadataQueue::producer_dequeue(const camera2_frame_queue_dst_ops_t *q,
int MetadataQueue::producer_dequeue(const camera2_frame_queue_dst_ops_t * /* q */,
size_t entries, size_t bytes,
camera_metadata_t **buffer) {
camera_metadata_t *new_buffer =
@ -224,7 +224,7 @@ int MetadataQueue::producer_dequeue(const camera2_frame_queue_dst_ops_t *q,
return OK;
}
int MetadataQueue::producer_cancel(const camera2_frame_queue_dst_ops_t *q,
int MetadataQueue::producer_cancel(const camera2_frame_queue_dst_ops_t * /* q */,
camera_metadata_t *old_buffer) {
free_camera_metadata(old_buffer);
return OK;
@ -386,12 +386,21 @@ status_t StreamAdapter::connectToDevice(camera2_device_t *d,
return res;
}
res = native_window_set_buffers_geometry(mConsumerInterface.get(),
mWidth, mHeight, mFormat);
res = native_window_set_buffers_dimensions(mConsumerInterface.get(),
mWidth, mHeight);
if (res != OK) {
ALOGE("%s: Unable to configure buffer geometry"
" %d x %d, format 0x%x for stream %d",
__FUNCTION__, mWidth, mHeight, mFormat, mId);
ALOGE("%s: Unable to configure buffer dimensions"
" %d x %d for stream %d",
__FUNCTION__, mWidth, mHeight, mId);
mState = CONNECTED;
return res;
}
res = native_window_set_buffers_format(mConsumerInterface.get(),
mFormat);
if (res != OK) {
ALOGE("%s: Unable to configure buffer format"
" 0x%x for stream %d",
__FUNCTION__, mFormat, mId);
mState = CONNECTED;
return res;
}
@ -454,8 +463,8 @@ cleanUpBuffers:
res = mConsumerInterface->cancelBuffer(mConsumerInterface.get(),
anwBuffers[i], -1);
}
delete anwBuffers;
delete buffers;
delete[] anwBuffers;
delete[] buffers;
return res;
}

View file

@ -27,11 +27,11 @@
template<size_t> static constexpr size_t CheckSizeHelper(size_t, size_t);
template<> constexpr size_t CheckSizeHelper<4>(size_t size32, size_t size64) {
template<> constexpr size_t CheckSizeHelper<4>(size_t size32, size_t /* size64 */) {
return size32;
}
template<> constexpr size_t CheckSizeHelper<8>(size_t size32, size_t size64) {
template<> constexpr size_t CheckSizeHelper<8>(size_t /* size32 */, size_t size64) {
return size64;
}

View file

@ -3,6 +3,7 @@ LOCAL_PATH:= $(call my-dir)
include $(CLEAR_VARS)
LOCAL_MODULE := libcnativewindow
LOCAL_SRC_FILES := cnativewindow.c util.c
LOCAL_CFLAGS := -Wno-unused-parameter
include $(BUILD_STATIC_LIBRARY)
include $(CLEAR_VARS)

View file

@ -337,8 +337,8 @@ static int cnw_perform(aWindow *base, int op, ...) {
TRACE("set scaling mode %d\n", va_arg(ap,int));
return 0;
case NATIVE_WINDOW_SET_BUFFERS_DIMENSIONS: {
int w = va_arg(ap,int);
int h = va_arg(ap,int);
unsigned int w = va_arg(ap,unsigned int);
unsigned int h = va_arg(ap,unsigned int);
if ((w == win->width) && (h == win->height)) {
TRACE("set buffers dimensions %d x %d\n", w, h);
return 0;
@ -377,7 +377,7 @@ static int hwc_init(CNativeWindow *win) {
unsigned i;
int r;
uint32_t configs[32];
uint32_t numconfigs = 32;
size_t numconfigs = 32;
int32_t values[8];
if (hw_get_module(HWC_HARDWARE_MODULE_ID, &module) != 0) {

View file

@ -17,6 +17,11 @@ LOCAL_CLANG := true
LOCAL_CFLAGS += -Wall -Wextra -Wno-unused-parameter
LOCAL_CPPFLAGS += -std=c++14
# TestHelpers uses mktemp. As the path is given to TempFile, we can't do too much
# here (e.g., use mkdtemp first). At least races will lead to an early failure, as
# mkfifo fails on existing files.
LOCAL_CFLAGS += -Wno-deprecated-declarations
LOCAL_MODULE := libinput_evdevtests
LOCAL_MODULE_TAGS := tests

View file

@ -395,8 +395,8 @@ class KeymasterGenerateECTest : public KeymasterBaseTest,
TEST_P(KeymasterGenerateRSATest, GenerateKeyPair_RSA_Success) {
keymaster_keypair_t key_type = TYPE_RSA;
keymaster_rsa_keygen_params_t params = {
modulus_size: GetParam(),
public_exponent: RSA_F4,
.modulus_size = GetParam(),
.public_exponent = RSA_F4,
};
uint8_t* key_blob;
@ -443,7 +443,7 @@ INSTANTIATE_TEST_CASE_P(RSA,
TEST_P(KeymasterGenerateECTest, GenerateKeyPair_EC_Success) {
keymaster_keypair_t key_type = TYPE_EC;
keymaster_ec_keygen_params_t params = {
field_size: GetParam(),
.field_size = GetParam(),
};
uint8_t* key_blob;
@ -864,8 +864,8 @@ TEST_F(KeymasterTest, SignData_RSA_Raw_Success) {
UniqueKey key(&sDevice, key_blob, key_blob_length);
keymaster_rsa_sign_params_t params = {
digest_type: DIGEST_NONE,
padding_type: PADDING_NONE,
.digest_type = DIGEST_NONE,
.padding_type = PADDING_NONE,
};
uint8_t* sig;
@ -904,7 +904,7 @@ TEST_F(KeymasterTest, SignData_EC_Success) {
UniqueKey key(&sDevice, key_blob, key_blob_length);
keymaster_ec_sign_params_t params = {
digest_type: DIGEST_NONE,
.digest_type = DIGEST_NONE,
};
uint8_t* sig;
@ -952,8 +952,8 @@ TEST_F(KeymasterTest, SignData_RSA_Raw_InvalidSizeInput_Failure) {
UniqueKey key(&sDevice, key_blob, key_blob_length);
keymaster_rsa_sign_params_t params = {
digest_type: DIGEST_NONE,
padding_type: PADDING_NONE,
.digest_type = DIGEST_NONE,
.padding_type = PADDING_NONE,
};
uint8_t* sig;
@ -971,8 +971,8 @@ TEST_F(KeymasterTest, SignData_RSA_Raw_InvalidSizeInput_Failure) {
TEST_F(KeymasterTest, SignData_RSA_Raw_NullKey_Failure) {
keymaster_rsa_sign_params_t params = {
digest_type: DIGEST_NONE,
padding_type: PADDING_NONE,
.digest_type = DIGEST_NONE,
.padding_type = PADDING_NONE,
};
uint8_t* sig;
@ -1002,8 +1002,8 @@ TEST_F(KeymasterTest, SignData_RSA_Raw_NullInput_Failure) {
UniqueKey key(&sDevice, key_blob, key_blob_length);
keymaster_rsa_sign_params_t params = {
digest_type: DIGEST_NONE,
padding_type: PADDING_NONE,
.digest_type = DIGEST_NONE,
.padding_type = PADDING_NONE,
};
uint8_t* sig;
@ -1030,8 +1030,8 @@ TEST_F(KeymasterTest, SignData_RSA_Raw_NullOutput_Failure) {
UniqueKey key(&sDevice, key_blob, key_blob_length);
keymaster_rsa_sign_params_t params = {
digest_type: DIGEST_NONE,
padding_type: PADDING_NONE,
.digest_type = DIGEST_NONE,
.padding_type = PADDING_NONE,
};
uint8_t* sig;
@ -1061,8 +1061,8 @@ TEST_F(KeymasterTest, VerifyData_RSA_Raw_Success) {
UniqueKey key(&sDevice, key_blob, key_blob_length);
keymaster_rsa_sign_params_t params = {
digest_type: DIGEST_NONE,
padding_type: PADDING_NONE,
.digest_type = DIGEST_NONE,
.padding_type = PADDING_NONE,
};
UniqueReadOnlyBlob testData(TEST_SIGN_DATA_1, sizeof(TEST_SIGN_DATA_1));
@ -1092,7 +1092,7 @@ TEST_F(KeymasterTest, VerifyData_EC_Raw_Success) {
UniqueKey key(&sDevice, key_blob, key_blob_length);
keymaster_ec_sign_params_t params = {
digest_type: DIGEST_NONE,
.digest_type = DIGEST_NONE,
};
uint8_t* sig;
@ -1129,8 +1129,8 @@ TEST_F(KeymasterTest, VerifyData_RSA_Raw_BadSignature_Failure) {
UniqueKey key(&sDevice, key_blob, key_blob_length);
keymaster_rsa_sign_params_t params = {
digest_type: DIGEST_NONE,
padding_type: PADDING_NONE,
.digest_type = DIGEST_NONE,
.padding_type = PADDING_NONE,
};
ASSERT_EQ(-1,
@ -1154,7 +1154,7 @@ TEST_F(KeymasterTest, VerifyData_EC_Raw_BadSignature_Failure) {
UniqueKey key(&sDevice, key_blob, key_blob_length);
keymaster_ec_sign_params_t params = {
digest_type: DIGEST_NONE,
.digest_type = DIGEST_NONE,
};
ASSERT_EQ(-1,
@ -1166,8 +1166,8 @@ TEST_F(KeymasterTest, VerifyData_EC_Raw_BadSignature_Failure) {
TEST_F(KeymasterTest, VerifyData_RSA_Raw_NullKey_Failure) {
keymaster_rsa_sign_params_t params = {
digest_type: DIGEST_NONE,
padding_type: PADDING_NONE,
.digest_type = DIGEST_NONE,
.padding_type = PADDING_NONE,
};
UniqueReadOnlyBlob testData(TEST_SIGN_DATA_1, sizeof(TEST_SIGN_DATA_1));
@ -1194,8 +1194,8 @@ TEST_F(KeymasterTest, VerifyData_RSA_NullInput_Failure) {
UniqueKey key(&sDevice, key_blob, key_blob_length);
keymaster_rsa_sign_params_t params = {
digest_type: DIGEST_NONE,
padding_type: PADDING_NONE,
.digest_type = DIGEST_NONE,
.padding_type = PADDING_NONE,
};
UniqueReadOnlyBlob testSig(TEST_SIGN_RSA_SIGNATURE_1, sizeof(TEST_SIGN_RSA_SIGNATURE_1));
@ -1222,8 +1222,8 @@ TEST_F(KeymasterTest, VerifyData_RSA_NullSignature_Failure) {
UniqueKey key(&sDevice, key_blob, key_blob_length);
keymaster_rsa_sign_params_t params = {
digest_type: DIGEST_NONE,
padding_type: PADDING_NONE,
.digest_type = DIGEST_NONE,
.padding_type = PADDING_NONE,
};
UniqueReadOnlyBlob testData(TEST_SIGN_DATA_1, sizeof(TEST_SIGN_DATA_1));

View file

@ -14,6 +14,7 @@
* limitations under the License.
*/
#include <inttypes.h>
#include <string.h>
#include <stdint.h>
#include <string.h>
@ -57,7 +58,7 @@ char const* getSensorName(int type) {
return "ukn";
}
int main(int argc, char** argv)
int main(int /* argc */, char** /* argv */)
{
int err;
struct sensors_poll_device_t* device;
@ -131,7 +132,7 @@ int main(int argc, char** argv)
const sensors_event_t& data = buffer[i];
if (data.version != sizeof(sensors_event_t)) {
printf("incorrect event version (version=%d, expected=%d",
printf("incorrect event version (version=%d, expected=%zu",
data.version, sizeof(sensors_event_t));
break;
}
@ -144,7 +145,7 @@ int main(int argc, char** argv)
case SENSOR_TYPE_GRAVITY:
case SENSOR_TYPE_LINEAR_ACCELERATION:
case SENSOR_TYPE_ROTATION_VECTOR:
printf("sensor=%s, time=%lld, value=<%5.1f,%5.1f,%5.1f>\n",
printf("sensor=%s, time=%" PRId64 ", value=<%5.1f,%5.1f,%5.1f>\n",
getSensorName(data.type),
data.timestamp,
data.data[0],
@ -158,14 +159,14 @@ int main(int argc, char** argv)
case SENSOR_TYPE_PROXIMITY:
case SENSOR_TYPE_RELATIVE_HUMIDITY:
case SENSOR_TYPE_AMBIENT_TEMPERATURE:
printf("sensor=%s, time=%lld, value=%f\n",
printf("sensor=%s, time=%" PRId64 ", value=%f\n",
getSensorName(data.type),
data.timestamp,
data.data[0]);
break;
default:
printf("sensor=%d, time=%lld, value=<%f,%f,%f, ...>\n",
printf("sensor=%d, time=% " PRId64 ", value=<%f,%f,%f, ...>\n",
data.type,
data.timestamp,
data.data[0],