Skip to content

Commit e2df062

Browse files
even more test fixes
1 parent fcf07cd commit e2df062

File tree

6 files changed

+157
-1
lines changed

6 files changed

+157
-1
lines changed

cross-repo.sh

Lines changed: 140 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,140 @@
1+
#!/usr/bin/env bash
2+
# stop script on error
3+
#set -e
4+
5+
sdk_list=(
6+
"awslabs/aws-c-auth"
7+
)
8+
9+
test=(
10+
"awslabs/aws-c-auth"
11+
"awslabs/aws-c-cal"
12+
"awslabs/aws-c-compression"
13+
"awslabs/aws-c-event-stream"
14+
"awslabs/aws-c-http"
15+
"awslabs/aws-c-io"
16+
"awslabs/aws-c-iot"
17+
"awslabs/aws-c-mqtt"
18+
"awslabs/aws-c-s3"
19+
"awslabs/aws-c-sdkutils"
20+
"awslabs/aws-checksums"
21+
"awslabs/aws-crt-builder"
22+
"awslabs/aws-crt-cpp"
23+
"awslabs/aws-crt-dotnet"
24+
"awslabs/aws-crt-ffi"
25+
"awslabs/aws-crt-java"
26+
"awslabs/aws-crt-nodejs"
27+
"awslabs/aws-crt-php"
28+
"awslabs/aws-crt-python"
29+
"awslabs/aws-crt-ruby"
30+
"awslabs/aws-crt-swift")
31+
32+
filename=repo_update.csv
33+
34+
# function to open webpage where you can create the PR
35+
function openpr() {
36+
github_url=`git remote -v | awk '/fetch/{print $2}' | sed -Ee 's#(git@|git://)#https://#' -e 's@com:@com/@' -e 's%\.git$%%' | awk '/github/'`;
37+
branch_name=`git symbolic-ref HEAD | cut -d"/" -f 3,4`;
38+
pr_url=$github_url"/compare/main..."$branch_name
39+
open $pr_url;
40+
}
41+
42+
# enable this to be run as test by not including parameter "create_PR"
43+
if [ $1 == "create_PR" ]; then
44+
PR=true
45+
echo "Creating PR's"
46+
else
47+
PR=false
48+
echo "Test run. Not creating PR's"
49+
fi
50+
51+
# headers for csv
52+
echo repo, status > $filename
53+
54+
for i in ${!sdk_list[@]}; do
55+
56+
echo "Repo:" ${sdk_list[$i]}
57+
# get sdk name
58+
full_sdk=${sdk_list[$i]}
59+
IFS='/' read -ra temp <<< "$full_sdk"
60+
sdk=${temp[1]}
61+
outputstring=$full_sdk,
62+
63+
# check if cloned already
64+
if [ ! -d ${sdk} ]; then
65+
echo "Cloning https://github.com/${full_sdk}.git"
66+
git clone --depth 1 --no-checkout "https://github.com/${full_sdk}.git"
67+
cd "${sdk}"
68+
69+
git sparse-checkout set .github
70+
71+
# handle master vs main
72+
if git branch | grep -q "master"; then
73+
git checkout master
74+
elif git branch | grep -q "main"; then
75+
git checkout main
76+
elif git branch | grep -q "develop"; then
77+
git checkout develop
78+
elif git branch | grep -q "version-3"; then
79+
git checkout version-3
80+
else
81+
echo "No main, master, or develop"
82+
fi
83+
cd ".github"
84+
85+
if $PR; then
86+
git checkout -b "pr-template"
87+
fi
88+
89+
90+
# handle - vs _ in file names
91+
if [ -f "PULL_REQUEST_TEMPLATE.md" ]; then
92+
si="PULL_REQUEST_TEMPLATE.md"
93+
fi
94+
echo $si
95+
if [ ! -z ${si} ]; then
96+
if grep "Issue \#" ${si}; then
97+
98+
#only make PR if this is not a test
99+
if $PR; then
100+
# update to new ancient time
101+
sed -i '' "s/*Issue #, if available:*/*Issue #, and\/or reason for changes (REQUIRED):*/" ${si}
102+
103+
echo "pushing commit"
104+
git add ${si}
105+
git commit -m "change PR template to ask for clearer wording"
106+
output=$(git push origin "pr-template" 2>&1 | grep "fatal")
107+
108+
echo "~"
109+
echo $output
110+
echo "~"
111+
112+
if ! grep "fatal" <<< "${output}" ; then
113+
echo "success pushing commit"
114+
openpr
115+
outputstring+="success pushing commit"
116+
else
117+
echo "failed pushing commit:" $output
118+
outputstring+=$output
119+
fi
120+
else
121+
outputstring+="$(grep -hnr 'Test. Not making a PR')"
122+
echo "test, not making a pr"
123+
fi
124+
else
125+
echo "'Issue #' ${sdk} repo"
126+
outputstring+="'Issue #' ${sdk} repo"
127+
fi
128+
else
129+
echo "PULL_REQUEST_TEMPLATE.md file does not exist"
130+
outputstring+="PULL_REQUEST_TEMPLATE.md file does not exist: "
131+
outputstring+=$(ls)
132+
fi
133+
cd ../..
134+
rm -rf $sdk
135+
else
136+
echo "${sdk[$i]} already exists"
137+
outputstring+="${sdk[$i]} already exists"
138+
fi
139+
echo $outputstring >> $filename
140+
done

include/aws/s3/private/s3_request.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,8 @@ struct aws_s3_request_metrics {
120120
uint32_t stream_id;
121121
/* CRT error code when the aws_s3_request finishes. */
122122
int error_code;
123+
/* Retry attempt. */
124+
uint32_t retry_attempt;
123125
} crt_info_metrics;
124126

125127
struct aws_ref_count ref_count;

include/aws/s3/s3_client.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1533,6 +1533,10 @@ void aws_s3_request_metrics_get_request_type(
15331533
AWS_S3_API
15341534
int aws_s3_request_metrics_get_error_code(const struct aws_s3_request_metrics *metrics);
15351535

1536+
/* Get retry attempt from request metrics. */
1537+
AWS_S3_API
1538+
uint32_t aws_s3_request_metrics_get_retry_attempt(const struct aws_s3_request_metrics *metrics);
1539+
15361540
AWS_EXTERN_C_END
15371541
AWS_POP_SANE_WARNING_LEVEL
15381542

source/s3_client.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1850,6 +1850,7 @@ static void s_on_pool_buffer_reserved(void *user_data) {
18501850
struct aws_s3_meta_request *meta_request = request->meta_request;
18511851
AWS_PRECONDITION(meta_request);
18521852

1853+
AWS_LOGF_DEBUG(0, "fooo %p", request->send_data.metrics);
18531854
if (request->send_data.metrics) {
18541855
struct aws_s3_request_metrics *metric = request->send_data.metrics;
18551856
aws_high_res_clock_get_ticks((uint64_t *)&metric->time_metrics.mem_acquire_end_timestamp_ns);

source/s3_request.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,7 @@ void aws_s3_request_setup_send_data(struct aws_s3_request *request, struct aws_h
102102
aws_s3_request_clean_up_send_data(request);
103103

104104
request->send_data.metrics = aws_s3_request_metrics_new(request->allocator);
105+
request->send_data.metrics->crt_info_metrics.retry_attempt = request->num_times_prepared;
105106
}
106107

107108
request->send_data.message = message;
@@ -555,3 +556,8 @@ int aws_s3_request_metrics_get_error_code(const struct aws_s3_request_metrics *m
555556
AWS_PRECONDITION(metrics);
556557
return metrics->crt_info_metrics.error_code;
557558
}
559+
560+
uint32_t aws_s3_request_metrics_get_retry_attempt(const struct aws_s3_request_metrics *metrics) {
561+
AWS_PRECONDITION(metrics);
562+
return metrics->crt_info_metrics.retry_attempt;
563+
}

tests/s3_tester.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -247,7 +247,9 @@ static void s_s3_test_meta_request_telemetry(
247247

248248
enum aws_s3_request_type request_type;
249249
aws_s3_request_metrics_get_request_type(metrics, &request_type);
250-
if (!aws_s3_request_metrics_get_send_end_timestamp_ns(metrics, &time_stamp) &&
250+
uint32_t retry_attempt = aws_s3_request_metrics_get_retry_attempt(metrics);
251+
if (!aws_s3_request_metrics_get_send_end_timestamp_ns(metrics, &time_stamp) &&
252+
retry_attempt == 0 &&
251253
(request_type == AWS_S3_REQUEST_TYPE_GET_OBJECT || request_type == AWS_S3_REQUEST_TYPE_UPLOAD_PART)) {
252254
uint64_t start_time = 0;
253255
uint64_t end_time = 0;
@@ -256,6 +258,7 @@ static void s_s3_test_meta_request_telemetry(
256258
error |= aws_s3_request_metrics_get_mem_acquire_start_timestamp_ns(metrics, &start_time);
257259
error |= aws_s3_request_metrics_get_mem_acquire_end_timestamp_ns(metrics, &end_time);
258260
error |= aws_s3_request_metrics_get_mem_acquire_duration_ns(metrics, &duration_time);
261+
AWS_LOGF_DEBUG(0, "foo %p %d %d %zu %zu %zu", metrics, error, request_type, start_time, end_time, duration_time);
259262
AWS_FATAL_ASSERT(error == AWS_OP_SUCCESS);
260263
AWS_FATAL_ASSERT(duration_time == (end_time - start_time));
261264
}

0 commit comments

Comments
 (0)