Skip to content

Commit c45a84c

Browse files
remove bad dependency in test and add macro guard for example benchmark
1 parent ac5bf2f commit c45a84c

2 files changed

Lines changed: 12 additions & 9 deletions

File tree

.github/workflows/sftp-benchmark.yml

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,6 @@ jobs:
4343
build_wolfssh:
4444
needs:
4545
- build_wolfssl
46-
- create_matrix
4746
strategy:
4847
fail-fast: false
4948
matrix:
@@ -71,7 +70,7 @@ jobs:
7170
- name: configure
7271
working-directory: ./wolfssh/
7372
run : |
74-
./configure --enable-all LDFLAGS="-L${{ github.workspace }}/build-dir/lib" CPPFLAGS="-I${{ github.workspace }}/build-dir/include -DWOLFSSH_NO_FPKI -DWOLFSSH_NO_SFTP_TIMEOUT -DWOLFSSH_MAX_SFTP_RW=4000000 -DMAX_PATH_SZ=120"
73+
./configure --enable-all LDFLAGS="-L${{ github.workspace }}/build-dir/lib" CPPFLAGS="-I${{ github.workspace }}/build-dir/include -DWOLFSSH_NO_FPKI -DWOLFSSH_NO_SFTP_TIMEOUT -DWOLFSSH_MAX_SFTP_RW=4000000 -DMAX_PATH_SZ=120 -DEXAMPLE_SFTP_BENCHMARK"
7574
7675
- name: make
7776
working-directory: ./wolfssh/
@@ -109,7 +108,7 @@ jobs:
109108
name: download-results.png
110109
path: wolfssh/download-results.png
111110

112-
- name: Comment on PR about performance
111+
- name: Comment on PR about performance
113112
env:
114113
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
115114
run: |

examples/sftpclient/sftpclient.c

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -132,8 +132,6 @@ static void err_msg(const char* s)
132132
#else
133133
#include <sys/time.h>
134134

135-
double current_time_ms(int);
136-
137135
/* return number of seconds*/
138136
word32 current_time(int reset)
139137
{
@@ -145,6 +143,9 @@ static void err_msg(const char* s)
145143
return (word32)tv.tv_sec;
146144
}
147145

146+
#ifdef EXAMPLE_SFTP_BENCHMARK
147+
double current_time_ms(int);
148+
148149
/* return number of micro seconds */
149150
double current_time_ms(int reset)
150151
{
@@ -155,7 +156,7 @@ static void err_msg(const char* s)
155156
gettimeofday(&tv, 0);
156157
return (word64)(tv.tv_sec*1000000) + tv.tv_usec;
157158
}
158-
159+
#endif
159160
#endif /* USE_WINDOWS_API */
160161
#endif /* !WOLFSSH_NO_TIMESTAMP */
161162

@@ -1107,7 +1108,8 @@ static int doAutopilot(int cmd, char* local, char* remote)
11071108
char fullpath[128] = ".";
11081109
WS_SFTPNAME* name = NULL;
11091110
byte remoteAbsPath = 0;
1110-
#if !defined(WOLFSSH_NO_TIMESTAMP) && !defined(USE_WINDOWS_API)
1111+
#if !defined(WOLFSSH_NO_TIMESTAMP) && !defined(USE_WINDOWS_API) &&\
1112+
defined(EXAMPLE_SFTP_BENCHMARK)
11111113
double currentTime;
11121114
double longBytes = 0;
11131115
FILE* f;
@@ -1144,7 +1146,8 @@ static int doAutopilot(int cmd, char* local, char* remote)
11441146
remote);
11451147
}
11461148

1147-
#if !defined(WOLFSSH_NO_TIMESTAMP) && !defined(USE_WINDOWS_API)
1149+
#if !defined(WOLFSSH_NO_TIMESTAMP) && !defined(USE_WINDOWS_API) &&\
1150+
defined(EXAMPLE_SFTP_BENCHMARK)
11481151
ret = WFOPEN(NULL, &f, fullpath, "rb");
11491152
if (ret != 0 || f == WBADFILE) return WS_BAD_FILE_E;
11501153
if (WFSEEK(NULL, f, 0, WSEEK_END) != 0) {
@@ -1177,7 +1180,8 @@ static int doAutopilot(int cmd, char* local, char* remote)
11771180
fullpath, local);
11781181
}
11791182
}
1180-
#if !defined(WOLFSSH_NO_TIMESTAMP) && !defined(USE_WINDOWS_API)
1183+
#if !defined(WOLFSSH_NO_TIMESTAMP) && !defined(USE_WINDOWS_API) &&\
1184+
defined(EXAMPLE_SFTP_BENCHMARK)
11811185
else {
11821186
currentTime = current_time_ms(0) - currentTime;
11831187
double result;

0 commit comments

Comments
 (0)