Win: Enable testing cross-compiled builds
When cross-compiling, CMakeLists.txt now generates the CTest script using relative paths, so that CTest can more easily be executed on a different machine from the build machine. Furthermore, Windows builds are now tested using md5cmp, just like on Linux, rather than a CMake script. This prevents issues with differing CMake locations between the build and test machines. This also removes some trailing spaces from the md5cmp code and improves the readability of the test code in CMakeLists.txt.
This commit is contained in:
1
md5/CMakeLists.txt
Normal file
1
md5/CMakeLists.txt
Normal file
@@ -0,0 +1 @@
|
||||
add_executable(md5cmp md5cmp.c md5.c md5hl.c)
|
||||
@@ -36,7 +36,7 @@ static void MD5Transform(unsigned int [4], const unsigned char [64]);
|
||||
#if (BYTE_ORDER == LITTLE_ENDIAN)
|
||||
#define Encode memcpy
|
||||
#define Decode memcpy
|
||||
#else
|
||||
#else
|
||||
|
||||
/*
|
||||
* OS X doesn't have le32toh() or htole32()
|
||||
@@ -134,7 +134,7 @@ MD5Init (context)
|
||||
context->state[3] = 0x10325476;
|
||||
}
|
||||
|
||||
/*
|
||||
/*
|
||||
* MD5 block update operation. Continues an MD5 message-digest
|
||||
* operation, processing another message block, and updating the
|
||||
* context.
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C)2013 D. R. Commander. All Rights Reserved.
|
||||
* Copyright (C)2013, 2016 D. R. Commander. All Rights Reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
@@ -30,6 +30,7 @@
|
||||
#include <string.h>
|
||||
#include <sys/types.h>
|
||||
#include "./md5.h"
|
||||
#include "../tjutil.h"
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
|
||||
21
md5/md5hl.c
21
md5/md5hl.c
@@ -4,12 +4,25 @@
|
||||
* can do whatever you want with this stuff. If we meet some day, and you think
|
||||
* this stuff is worth it, you can buy me a beer in return. Poul-Henning Kamp
|
||||
* ----------------------------------------------------------------------------
|
||||
* libjpeg-turbo Modifications:
|
||||
* Copyright (C) 2016, D. R. Commander
|
||||
* Modifications are under the same license as the original code (see above)
|
||||
* ----------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
#include <fcntl.h>
|
||||
#ifdef _WIN32
|
||||
#include <io.h>
|
||||
#define close _close
|
||||
#define fstat _fstat
|
||||
#define lseek _lseek
|
||||
#define read _read
|
||||
#define stat _stat
|
||||
#else
|
||||
#include <unistd.h>
|
||||
#endif
|
||||
|
||||
#include <errno.h>
|
||||
#include <stdio.h>
|
||||
@@ -55,7 +68,11 @@ MD5FileChunk(const char *filename, char *buf, off_t ofs, off_t len)
|
||||
off_t n;
|
||||
|
||||
MD5Init(&ctx);
|
||||
#if _WIN32
|
||||
f = _open(filename, O_RDONLY|O_BINARY);
|
||||
#else
|
||||
f = open(filename, O_RDONLY);
|
||||
#endif
|
||||
if (f < 0)
|
||||
return 0;
|
||||
if (fstat(f, &stbuf) < 0)
|
||||
@@ -73,11 +90,11 @@ MD5FileChunk(const char *filename, char *buf, off_t ofs, off_t len)
|
||||
i = read(f, buffer, sizeof(buffer));
|
||||
else
|
||||
i = read(f, buffer, n);
|
||||
if (i < 0)
|
||||
if (i < 0)
|
||||
break;
|
||||
MD5Update(&ctx, buffer, i);
|
||||
n -= i;
|
||||
}
|
||||
}
|
||||
e = errno;
|
||||
close(f);
|
||||
errno = e;
|
||||
|
||||
Reference in New Issue
Block a user