Skip to content

Commit

Permalink
Merge pull request #2313 from DanHeidinga/djh/shmem
Browse files Browse the repository at this point in the history
Fix if defined() formatting and add OSX
  • Loading branch information
gacholio authored Jul 4, 2018
2 parents 8ab9986 + 31ac15e commit 63d6adc
Show file tree
Hide file tree
Showing 8 changed files with 43 additions and 43 deletions.
12 changes: 6 additions & 6 deletions runtime/tests/port/j9shsemTest.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 1991, 2014 IBM Corp. and others
* Copyright (c) 1991, 2018 IBM Corp. and others
*
* This program and the accompanying materials are made available under
* the terms of the Eclipse Public License 2.0 which accompanies this
Expand Down Expand Up @@ -99,7 +99,7 @@ j9shsem_test2(J9PortLibrary *portLibrary)
PORT_ACCESS_FROM_PORT(portLibrary);
const char* testName = "j9shsem_test2";

#if defined(LINUX) | defined(J9ZOS390) | defined(AIXPPC)
#if defined(LINUX) || defined(J9ZOS390) || defined(AIXPPC) || defined(OSX)
/*
* test check that after deleting with j9shsem_destroy
* the next call to j9shsem_open() results in J9PORT_INFO_SHSEM_CREATED
Expand Down Expand Up @@ -250,7 +250,7 @@ j9shsem_test4(J9PortLibrary *portLibrary, char* argv0)
PORT_ACCESS_FROM_PORT(portLibrary);
const char* testName = "j9shsem_test4";

#if defined(LINUX) | defined(J9ZOS390) | defined(AIXPPC)
#if defined(LINUX) || defined(J9ZOS390) || defined(AIXPPC) || defined(OSX)
J9PortShSemParameters params;
char baseDir[J9SH_MAXPATH];
struct j9shsem_handle *childrensemaphore=NULL;
Expand Down Expand Up @@ -393,7 +393,7 @@ j9shsem_test5(J9PortLibrary *portLibrary)
PORT_ACCESS_FROM_PORT(portLibrary);
const char* testName = "j9shsem_test5";

#if defined(LINUX) | defined(J9ZOS390) | defined(AIXPPC)
#if defined(LINUX) || defined(J9ZOS390) || defined(AIXPPC) || defined(OSX)
/* UNIX only
* test that our code can handle missing basefile
* If someone has deleted the baseFile by mistake, we should be able to recreate/open the old area without problem.
Expand Down Expand Up @@ -572,7 +572,7 @@ j9shsem_test6_child(J9PortLibrary *portLibrary)
}


#if defined(LINUX) | defined(J9ZOS390) | defined(AIXPPC)
#if defined(LINUX) || defined(J9ZOS390) || defined(AIXPPC) || defined(OSX)

static void test7_cleanup(J9PortLibrary *portLibrary,
J9PortShSemParameters *params, struct j9shsem_handle* myhandleA,
Expand Down Expand Up @@ -628,7 +628,7 @@ int j9shsem_test7(J9PortLibrary *portLibrary) {
PORT_ACCESS_FROM_PORT(portLibrary);
const char* testName = "j9shsem_test7";

#if defined(LINUX) | defined(J9ZOS390) | defined(AIXPPC)
#if defined(LINUX) || defined(J9ZOS390) || defined(AIXPPC) || defined(OSX)
IDATA rc;
/* UNIX only
* test that retaining the basefile prevents semaphore leaks
Expand Down
16 changes: 8 additions & 8 deletions runtime/tests/port/j9shsem_deprecatedTest.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 1991, 2014 IBM Corp. and others
* Copyright (c) 1991, 2018 IBM Corp. and others
*
* This program and the accompanying materials are made available under
* the terms of the Eclipse Public License 2.0 which accompanies this
Expand All @@ -24,7 +24,7 @@
#include "testProcessHelpers.h"
#include "shmem.h"

#if defined(LINUX) | defined (J9ZOS390) | defined (AIXPPC)
#if defined(LINUX) || defined(J9ZOS390) || defined(AIXPPC) || defined(OSX)
#include <unistd.h>
#include <string.h>
#include <sys/types.h>
Expand Down Expand Up @@ -136,7 +136,7 @@ j9shsem_deprecated_test2(J9PortLibrary *portLibrary)
PORT_ACCESS_FROM_PORT(portLibrary);
const char* testName = "j9shsem_deprecated_test2";

#if defined(LINUX) | defined(J9ZOS390) | defined(AIXPPC)
#if defined(LINUX) || defined(J9ZOS390) || defined(AIXPPC) || defined(OSX)
/*
* test check that after deleting with j9shsem_deprecated_destroy
* the next call to j9shsem_deprecated_open() results in J9PORT_INFO_SHSEM_CREATED
Expand Down Expand Up @@ -293,7 +293,7 @@ j9shsem_deprecated_test4(J9PortLibrary *portLibrary, char* argv0)
PORT_ACCESS_FROM_PORT(portLibrary);
const char* testName = "j9shsem_deprecated_test4";

#if defined(LINUX) | defined(J9ZOS390) | defined(AIXPPC)
#if defined(LINUX) || defined(J9ZOS390) || defined(AIXPPC) || defined(OSX)
struct j9shsem_handle *childrensemaphore=NULL;
int i;
IDATA rc;
Expand Down Expand Up @@ -442,7 +442,7 @@ j9shsem_deprecated_test5(J9PortLibrary *portLibrary)
PORT_ACCESS_FROM_PORT(portLibrary);
const char* testName = "j9shsem_deprecated_test5";

#if defined(LINUX) | defined(J9ZOS390) | defined(AIXPPC)
#if defined(LINUX) || defined(J9ZOS390) || defined(AIXPPC) || defined(OSX)
/* UNIX only
* test that our code can handle missing basefile
* If someone has deleted the baseFile by mistake, we should be able to recreate/open the old area without problem.
Expand Down Expand Up @@ -623,7 +623,7 @@ j9shsem_deprecated_test6_child(J9PortLibrary *portLibrary)
return reportTestExit(portLibrary, testName);
}

#if defined(LINUX) | defined (J9ZOS390) | defined (AIXPPC)
#if defined(LINUX) || defined(J9ZOS390) || defined(AIXPPC) || defined(OSX)
/*Note:
* This is more than one test. The first test that fails blocks the rest of the test. The test should not fail :-)
* This test is meant to excercise the race conditions that can occur when mutliple vm's create sysv obj
Expand Down Expand Up @@ -1143,7 +1143,7 @@ j9shsem_deprecated_runTests(struct J9PortLibrary *portLibrary, char* argv0, char
} else if(strcmp(shsem_child, "j9shsem_deprecated_test6") == 0) {
return j9shsem_deprecated_test6_child(portLibrary);
}
#if defined(LINUX) | defined (J9ZOS390) | defined (AIXPPC)
#if defined(LINUX) || defined(J9ZOS390) || defined(AIXPPC) || defined(OSX)
else if(strcmp(shsem_child,"j9shsem_deprecated_test7") == 0) {
return j9shsem_deprecated_test7_testchild(portLibrary);
}
Expand Down Expand Up @@ -1173,7 +1173,7 @@ j9shsem_deprecated_runTests(struct J9PortLibrary *portLibrary, char* argv0, char
rc |= j9shsem_deprecated_test4(portLibrary, argv0);
rc |= j9shsem_deprecated_test5(portLibrary);
rc |= j9shsem_deprecated_test6(portLibrary, argv0);
#if defined(LINUX) | defined (J9ZOS390) | defined (AIXPPC)
#if defined(LINUX) || defined(J9ZOS390) || defined(AIXPPC) || defined(OSX)
rc |= j9shsem_deprecated_test7(portLibrary, argv0);
#endif
#if !(defined(WIN32) || defined(WIN64))
Expand Down
6 changes: 3 additions & 3 deletions runtime/tests/port/j9vmemTest.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 1991, 2017 IBM Corp. and others
* Copyright (c) 1991, 2018 IBM Corp. and others
*
* This program and the accompanying materials are made available under
* the terms of the Eclipse Public License 2.0 which accompanies this
Expand Down Expand Up @@ -1922,7 +1922,7 @@ void verifyFindValidPageSizeOutput(struct J9PortLibrary *portLibrary,
}
}

#if (defined(LINUX) && !defined(LINUXPPC)) || defined(WIN32)
#if (defined(LINUX) && !defined(LINUXPPC)) || defined(WIN32) || defined(OSX)

static int
j9vmem_testFindValidPageSize_impl(struct J9PortLibrary *portLibrary, char *testName)
Expand Down Expand Up @@ -2040,7 +2040,7 @@ int
j9vmem_testFindValidPageSize(struct J9PortLibrary *portLibrary)
{

#if defined(LINUX)
#if defined(LINUX) || defined(OSX)
#define J9PORT_VMEM_PAGESIZE_COUNT 5 /* This should be same as defined in port/unix_include/j9portpg.h */
#elif defined(WIN32)
#define J9PORT_VMEM_PAGESIZE_COUNT 3 /* This should be same as defined in port/win32_include/j9portpg.h */
Expand Down
18 changes: 9 additions & 9 deletions runtime/tests/port/shmem.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 1991, 2017 IBM Corp. and others
* Copyright (c) 1991, 2018 IBM Corp. and others
*
* This program and the accompanying materials are made available under
* the terms of the Eclipse Public License 2.0 which accompanies this
Expand Down Expand Up @@ -36,16 +36,16 @@

#include "shmem.h"
#include "testProcessHelpers.h"
#if defined(LINUX) || defined (J9ZOS390) || defined (AIXPPC)
#if defined(LINUX) || defined(J9ZOS390) || defined(AIXPPC) || defined(OSX)
#include <string.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <sys/ipc.h>
#include <sys/shm.h>
#include "../port/sysvipc/j9shmem.h"
#else /* defined(LINUX) || defined (J9ZOS390) || defined (AIXPPC) */
#else /* defined(LINUX) || defined (J9ZOS390) || defined (AIXPPC) || defined(OSX) */
#include "../port/win32_include/j9shmem.h"
#endif /* defined(LINUX) || defined (J9ZOS390) || defined (AIXPPC) */
#endif /* defined(LINUX) || defined (J9ZOS390) || defined (AIXPPC) || defined(OSX) */

#define SHAREDMEMORYA "sharedmemoryA"
#define SHAREDMEMORYB "sharedmemoryB"
Expand Down Expand Up @@ -457,7 +457,7 @@ int j9shmem_test5(J9PortLibrary *portLibrary) {
PORT_ACCESS_FROM_PORT(portLibrary);
const char* testName = "j9shmem_test5";

#if defined(LINUX) | defined(J9ZOS390) | defined(AIXPPC)
#if defined(LINUX) || defined(J9ZOS390) || defined(AIXPPC) || defined(OSX)
char cacheDir[J9SH_MAXPATH];
/*
* test open after reboot
Expand Down Expand Up @@ -591,7 +591,7 @@ j9shmem_test6(J9PortLibrary *portLibrary)
char cacheDir[J9SH_MAXPATH];
const char* testName = "j9shmem_test6";

#if defined(LINUX) | defined(J9ZOS390) | defined(AIXPPC)
#if defined(LINUX) || defined(J9ZOS390) || defined(AIXPPC) || defined(OSX)
/* UNIX only
* test that our code can handle missing basefile
* If someone has deleted the baseFile by mistake, we should be able to recreate/open the old area without problem.
Expand Down Expand Up @@ -1490,7 +1490,7 @@ j9shmem_test14(J9PortLibrary *portLibrary) {
return reportTestExit(portLibrary, testName);
}

#if defined(LINUX) | defined (J9ZOS390) | defined (AIXPPC)
#if defined(LINUX) || defined(J9ZOS390) || defined(AIXPPC) || defined(OSX)
/*Note:
* This is more than one test. The first test that fails blocks the rest of the test. The test should not fail :-)
* This test is meant to excercise the race conditions that can occur when mutliple vm's create sysv obj
Expand Down Expand Up @@ -2107,7 +2107,7 @@ j9shmem_runTests(J9PortLibrary *portLibrary, char* argv0, const char* shmem_chil
} else if(strcmp(shmem_child, "j9shmem_test9") == 0) {
return j9shmem_test9_child(portLibrary);
}
#if defined(LINUX) | defined (J9ZOS390) | defined (AIXPPC)
#if defined(LINUX) || defined(J9ZOS390) || defined(AIXPPC) || defined(OSX)
else if(strcmp(shmem_child, "j9shmem_test15") == 0) {
return j9shmem_test15_testchild(portLibrary);
}
Expand Down Expand Up @@ -2150,7 +2150,7 @@ j9shmem_runTests(J9PortLibrary *portLibrary, char* argv0, const char* shmem_chil
rc |= j9shmem_test13(PORTLIB);
rc |= j9shmem_test14(PORTLIB);

#if defined(LINUX) | defined (J9ZOS390) | defined (AIXPPC)
#if defined(LINUX) || defined(J9ZOS390) || defined(AIXPPC) || defined(OSX)
rc |= j9shmem_test15(portLibrary, argv0);
#endif

Expand Down
10 changes: 5 additions & 5 deletions runtime/tests/port/testProcessHelpers.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2001, 2014 IBM Corp. and others
* Copyright (c) 2001, 2018 IBM Corp. and others
*
* This program and the accompanying materials are made available under
* the terms of the Eclipse Public License 2.0 which accompanies this
Expand All @@ -25,7 +25,7 @@
#include <Windows.h>
#endif

#if defined(LINUX) | defined(J9ZOS390) | defined(AIXPPC)
#if defined(LINUX) || defined(J9ZOS390) || defined(AIXPPC) || defined(OSX)
#include <sys/types.h>
#include <sys/wait.h>
#include <unistd.h>
Expand All @@ -51,9 +51,9 @@
#define PORTTEST_PROCESS_HELPERS_DEBUG
#endif

#if defined(LINUX) | defined(J9ZOS390) | defined(AIXPPC)
#if defined(LINUX) || defined(J9ZOS390) || defined(AIXPPC) || defined(OSX)

#if defined(__GNU_LIBRARY__) && !defined(_SEM_SEMUN_UNDEFINED)
#if (defined(__GNU_LIBRARY__) && !defined(_SEM_SEMUN_UNDEFINED)) || defined(OSX)
/* union semun is defined by including <sys/sem.h> */
#else
/* according to X/OPEN we have to define it ourselves */
Expand Down Expand Up @@ -448,7 +448,7 @@ SleepFor(IDATA second)
{
#if defined(WIN32)
Sleep((DWORD)second*1000);
#elif defined(LINUX) | defined(J9ZOS390) | defined(AIXPPC)
#elif defined(LINUX) || defined(J9ZOS390) || defined(AIXPPC) || defined(OSX)
sleep(second);
#endif
}
Expand Down
8 changes: 4 additions & 4 deletions runtime/tests/redirector/jep178/testjep178.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2014, 2017 IBM Corp. and others
* Copyright (c) 2014, 2018 IBM Corp. and others
*
* This program and the accompanying materials are made available under
* the terms of the Eclipse Public License 2.0 which accompanies this
Expand Down Expand Up @@ -203,7 +203,7 @@ int main(int argc, char ** argv, char ** envp)
/* Open a handle to the jvm's shared library. */
#if defined(WIN32)
handle = LoadLibrary(buffer);
#elif defined(LINUX) || defined(AIXPPC)
#elif defined(LINUX) || defined(AIXPPC) || defined(OSX)
handle = dlopen(buffer, RTLD_NOW);
#else /* ZOS */
handle = dllload(buffer);
Expand All @@ -217,7 +217,7 @@ int main(int argc, char ** argv, char ** envp)
/* Lookup for the virtual machine entry point routine. */
#if defined(WIN32)
createJavaVM = (createJVMFP) GetProcAddress((HINSTANCE)handle, "JNI_CreateJavaVM");
#elif defined(LINUX) || defined(AIXPPC)
#elif defined(LINUX) || defined(AIXPPC) || defined(OSX)
createJavaVM = (createJVMFP) dlsym(handle, "JNI_CreateJavaVM");
#else /* Z/OS */
createJavaVM = (createJVMFP) dllqueryfn(handle, "JNI_CreateJavaVM");
Expand Down Expand Up @@ -297,7 +297,7 @@ int main(int argc, char ** argv, char ** envp)
if (NULL != handle) {
#if defined(WIN32)
FreeLibrary(handle);
#elif defined(LINUX) || defined(AIXPPC)
#elif defined(LINUX) || defined(AIXPPC) || defined(OSX)
dlclose(handle);
#else /* Z/OS */
dllfree(handle);
Expand Down
4 changes: 2 additions & 2 deletions runtime/tests/redirector/jep178/testjep178.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2014, 2014 IBM Corp. and others
* Copyright (c) 2014, 2018 IBM Corp. and others
*
* This program and the accompanying materials are made available under
* the terms of the Eclipse Public License 2.0 which accompanies this
Expand Down Expand Up @@ -33,7 +33,7 @@
#include <string.h>
#if defined(WIN32)
#include <windows.h>
#elif defined(LINUX) || defined(AIXPPC)
#elif defined(LINUX) || defined(AIXPPC) || defined(OSX)
#include <dlfcn.h>
#else
#include <dll.h>
Expand Down
12 changes: 6 additions & 6 deletions runtime/tests/shared/ProcessHelper.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2001, 2014 IBM Corp. and others
* Copyright (c) 2001, 2018 IBM Corp. and others
*
* This program and the accompanying materials are made available under
* the terms of the Eclipse Public License 2.0 which accompanies this
Expand Down Expand Up @@ -30,7 +30,7 @@
#include "j9port.h"
#include "j9memcategories.h"

#if defined(LINUX) | defined(J9ZOS390) | defined(AIXPPC)
#if defined(LINUX) || defined(J9ZOS390) || defined(AIXPPC) || defined(OSX)
#include <sys/types.h>
#include <sys/wait.h>
#include <sys/ipc.h>
Expand All @@ -49,9 +49,9 @@ extern "C" {
}
#endif

#if defined(LINUX) | defined(J9ZOS390) | defined(AIXPPC)
#if defined(LINUX) || defined(J9ZOS390) || defined(AIXPPC) || defined(OSX)

#if defined(__GNU_LIBRARY__) && !defined(_SEM_SEMUN_UNDEFINED)
#if (defined(__GNU_LIBRARY__) && !defined(_SEM_SEMUN_UNDEFINED)) || defined(OSX)
/* union semun is defined by including <sys/sem.h> */
#else
/* according to X/OPEN we have to define it ourselves */
Expand Down Expand Up @@ -146,7 +146,7 @@ CloseLaunchSemaphore (J9PortLibrary* portLibrary, IDATA semaphore)
return 0;
}

#endif /* defined(LINUX) | defined(J9ZOS390) | defined(AIXPPC) */
#endif /* defined(LINUX) | defined(J9ZOS390) | defined(AIXPPC) | defined(OSX) */


#if defined(WIN32)
Expand Down Expand Up @@ -303,7 +303,7 @@ SleepFor(IDATA second)
{
#if defined(WIN32)
Sleep((DWORD)(second*1000));
#elif defined(LINUX) | defined(J9ZOS390) | defined(AIXPPC)
#elif defined(LINUX) || defined(J9ZOS390) || defined(AIXPPC) || defined(OSX)
sleep(second);
#endif
}

0 comments on commit 63d6adc

Please sign in to comment.