1
0
mirror of https://github.com/golang/go synced 2024-11-18 08:24:44 -07:00
go/misc/cgo/testcarchive/main.c
Christopher Nelson 93c5fbf390 misc/cgo/testcarchive: split main.c into unix and non-unix
This is in support of https://golang.org/cl/18057 which adds
support for c-archive to the Windows platform.

The signal handling tests do not compile on Windows. This splits
them out into a separate main_unix.c file, and conditionally
includes them for non-Windows platforms.

Change-Id: Ic79ce83da7656d6703505e514554748a482b81a1
Reviewed-on: https://go-review.googlesource.com/21086
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2016-03-26 00:57:23 +00:00

49 lines
847 B
C

// Copyright 2015 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
#include <stdint.h>
#include <stdio.h>
#include <string.h>
#include "p.h"
#include "libgo.h"
extern int install_handler();
extern int check_handler();
int main(void) {
int32_t res;
int r1 = install_handler();
if (r1!=0) {
return r1;
}
if (!DidInitRun()) {
fprintf(stderr, "ERROR: buildmode=c-archive init should run\n");
return 2;
}
if (DidMainRun()) {
fprintf(stderr, "ERROR: buildmode=c-archive should not run main\n");
return 2;
}
int r2 = check_handler();
if (r2!=0) {
return r2;
}
res = FromPkg();
if (res != 1024) {
fprintf(stderr, "ERROR: FromPkg()=%d, want 1024\n", res);
return 2;
}
CheckArgs();
fprintf(stderr, "PASS\n");
return 0;
}